Update python code for python 3.8 or higher compatibility

Changes:
     - Update shebang directive to use python3 explicitly.
     - remove preexec_fn feature which is deprecated in higher
       python version 3.8 and above.
     - bufsize fix, from documentation bufsize 1 means line buffered
      (only usable if universal_newlines=True i.e., in a text mode)
      refer: https://docs.python.org/3/library/subprocess.html
     - Fix SyntaxWarning: "is" with "=="

Change-Id: Ib96c1ba8c2327d6774d0d731b48ca7e61a4a297a
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/bin/auto_status_file.py b/bin/auto_status_file.py
index 1a372f7..d1614f3 100755
--- a/bin/auto_status_file.py
+++ b/bin/auto_status_file.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See help text for details.
diff --git a/bin/event_notification_util.py b/bin/event_notification_util.py
index 66cf970..380a120 100755
--- a/bin/event_notification_util.py
+++ b/bin/event_notification_util.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See help text for details.
diff --git a/bin/generate_inventory b/bin/generate_inventory
index 77c8f70..b56d22e 100755
--- a/bin/generate_inventory
+++ b/bin/generate_inventory
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 r"""
 Generate an inventory variable file containing a list of properties
 fields from the YAML phosphor-dbus-interfaces repository.
diff --git a/bin/generate_testsuite_info.py b/bin/generate_testsuite_info.py
index ffd713e..7cafd1e 100755
--- a/bin/generate_testsuite_info.py
+++ b/bin/generate_testsuite_info.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Use robot framework API to extract test data from test suites.
diff --git a/bin/obmc_ser_num b/bin/obmc_ser_num
index 6d2efeb..96fa7e0 100755
--- a/bin/obmc_ser_num
+++ b/bin/obmc_ser_num
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This program will get the system serial number from an OBMC machine and print it to stdout.
diff --git a/bin/plug_ins/Auto_reboot/cp_master b/bin/plug_ins/Auto_reboot/cp_master
index 1a885b5..8dd9e0e 100755
--- a/bin/plug_ins/Auto_reboot/cp_master
+++ b/bin/plug_ins/Auto_reboot/cp_master
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Set the auto_boot policy according to the caller's wishes.
diff --git a/bin/plug_ins/FFDC/cp_ffdc_check b/bin/plug_ins/FFDC/cp_ffdc_check
index 97a3f44..8d51271 100755
--- a/bin/plug_ins/FFDC/cp_ffdc_check
+++ b/bin/plug_ins/FFDC/cp_ffdc_check
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 from gen_print import *
 from gen_valid import *
diff --git a/bin/plug_ins/Soft_errors/cp_post_boot b/bin/plug_ins/Soft_errors/cp_post_boot
index f49cd26..4eb951c 100755
--- a/bin/plug_ins/Soft_errors/cp_post_boot
+++ b/bin/plug_ins/Soft_errors/cp_post_boot
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 from gen_print import *
 from gen_valid import *
diff --git a/bin/plug_ins/Stop/cp_stop_check b/bin/plug_ins/Stop/cp_stop_check
index fd63304..e3ef1cb 100755
--- a/bin/plug_ins/Stop/cp_stop_check
+++ b/bin/plug_ins/Stop/cp_stop_check
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Check for stop conditions.  Return code of 2 if stop conditions are found.
diff --git a/bin/print_ffdc_functions b/bin/print_ffdc_functions
index 016c119..7d56584 100755
--- a/bin/print_ffdc_functions
+++ b/bin/print_ffdc_functions
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See help text for details.
diff --git a/bin/process_plug_in_packages.py b/bin/process_plug_in_packages.py
index a9d1bcf..bd389c8 100755
--- a/bin/process_plug_in_packages.py
+++ b/bin/process_plug_in_packages.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See help text for details.
diff --git a/bin/prop_call.py b/bin/prop_call.py
index eab1c77..15cff57 100755
--- a/bin/prop_call.py
+++ b/bin/prop_call.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See help text for details (--help or -h option)..
diff --git a/bin/validate_plug_ins.py b/bin/validate_plug_ins.py
index 13ec687..a202d2e 100755
--- a/bin/validate_plug_ins.py
+++ b/bin/validate_plug_ins.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import sys
 try:
diff --git a/bin/websocket_monitor.py b/bin/websocket_monitor.py
index f1de2c6..846ccd5 100755
--- a/bin/websocket_monitor.py
+++ b/bin/websocket_monitor.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See help text for details.
diff --git a/data/Palmetto.py b/data/Palmetto.py
index 05a14a1..24842de 100755
--- a/data/Palmetto.py
+++ b/data/Palmetto.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python3
 
 HOME_PATH = './'
 CACHE_PATH = '/var/cache/obmc/'
diff --git a/data/Witherspoon.py b/data/Witherspoon.py
index d5dab6a..e106eb9 100755
--- a/data/Witherspoon.py
+++ b/data/Witherspoon.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python3
 
 # System states
 # state can change to next state in 2 ways:
diff --git a/data/ipmi_raw_cmd_table.py b/data/ipmi_raw_cmd_table.py
index 2be3dac..c6af003 100644
--- a/data/ipmi_raw_cmd_table.py
+++ b/data/ipmi_raw_cmd_table.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 IPMI raw commands table:
diff --git a/data/ipmi_rest_fru_field_map.py b/data/ipmi_rest_fru_field_map.py
index 80f8479..0ada176 100644
--- a/data/ipmi_rest_fru_field_map.py
+++ b/data/ipmi_rest_fru_field_map.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 IPMI REST FRU field mapping:
diff --git a/data/ipmi_variable.py b/data/ipmi_variable.py
index 64aae68..b9958ed 100644
--- a/data/ipmi_variable.py
+++ b/data/ipmi_variable.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 r"""
 Contains channel-related constants.
diff --git a/data/model.py b/data/model.py
index 27a744a..de5ca9a 100755
--- a/data/model.py
+++ b/data/model.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python -u
+#!/usr/bin/env python3 -u
 import sys
 from robot.libraries.BuiltIn import BuiltIn
 import imp
diff --git a/data/pel_variables.py b/data/pel_variables.py
index f5aa729..aec1b8b 100644
--- a/data/pel_variables.py
+++ b/data/pel_variables.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 r"""
 Contains PEL related constants.
diff --git a/data/pldm_variables.py b/data/pldm_variables.py
index f3f8ce9..c5407d6 100755
--- a/data/pldm_variables.py
+++ b/data/pldm_variables.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 r"""
 Contains PLDM-related constants.
diff --git a/data/vpd_variables.py b/data/vpd_variables.py
index 3512776..dc310c8 100644
--- a/data/vpd_variables.py
+++ b/data/vpd_variables.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 r"""
 Contains VPD related constants.
diff --git a/extended/run_keyword.py b/extended/run_keyword.py
index 3bb89c2..2d1ab51 100644
--- a/extended/run_keyword.py
+++ b/extended/run_keyword.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module is the python counterpart to run_keyword.robot.
diff --git a/ffdc/collect_ffdc.py b/ffdc/collect_ffdc.py
index 78791e5..7711fd6 100644
--- a/ffdc/collect_ffdc.py
+++ b/ffdc/collect_ffdc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 CLI FFDC Collector.
diff --git a/ffdc/ffdc_collector.py b/ffdc/ffdc_collector.py
index c91503a..4a8cfa4 100644
--- a/ffdc/ffdc_collector.py
+++ b/ffdc/ffdc_collector.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See class prolog below for details.
diff --git a/ffdc/lib/ssh_utility.py b/ffdc/lib/ssh_utility.py
index 32fef63b..e695f3d 100644
--- a/ffdc/lib/ssh_utility.py
+++ b/ffdc/lib/ssh_utility.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import paramiko
 from paramiko.ssh_exception import AuthenticationException
diff --git a/ffdc/lib/telnet_utility.py b/ffdc/lib/telnet_utility.py
index 81668d6..08e4071 100644
--- a/ffdc/lib/telnet_utility.py
+++ b/ffdc/lib/telnet_utility.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 import time
diff --git a/ffdc/plugins/date_time_utils.py b/ffdc/plugins/date_time_utils.py
index 8bc46d4..65bcb88 100644
--- a/ffdc/plugins/date_time_utils.py
+++ b/ffdc/plugins/date_time_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains functions having to do with date time filter.
diff --git a/ffdc/plugins/redfish.py b/ffdc/plugins/redfish.py
index 8815555..33a0669 100644
--- a/ffdc/plugins/redfish.py
+++ b/ffdc/plugins/redfish.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains functions having to do with redfish path walking.
diff --git a/ffdc/plugins/scp_execution.py b/ffdc/plugins/scp_execution.py
index 859925f..0aca54c 100644
--- a/ffdc/plugins/scp_execution.py
+++ b/ffdc/plugins/scp_execution.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 import os
diff --git a/ffdc/plugins/ssh_execution.py b/ffdc/plugins/ssh_execution.py
index 0be7c19..087d887 100644
--- a/ffdc/plugins/ssh_execution.py
+++ b/ffdc/plugins/ssh_execution.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 import os
diff --git a/ffdc/plugins/telnet_execution.py b/ffdc/plugins/telnet_execution.py
index 7ae23c1..7cfd78b 100644
--- a/ffdc/plugins/telnet_execution.py
+++ b/ffdc/plugins/telnet_execution.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 import os
diff --git a/gui/data/gui_variables.py b/gui/data/gui_variables.py
index b6375ba..230d70f 100644
--- a/gui/data/gui_variables.py
+++ b/gui/data/gui_variables.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 r"""
 Contains xpaths and related string constants applicable for new Vue based OpenBMC GUI.
diff --git a/gui/data/resource_variables.py b/gui/data/resource_variables.py
index 256d28b..07413d7 100644
--- a/gui/data/resource_variables.py
+++ b/gui/data/resource_variables.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 r"""
 Contains xpaths and related string constants applicable to all openBMC GUI
diff --git a/gui/lib/supporting_libs.py b/gui/lib/supporting_libs.py
index 9375fee..4cc3044 100644
--- a/gui/lib/supporting_libs.py
+++ b/gui/lib/supporting_libs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 r"""
 This is an extended user library to support Robot Selenium code.
diff --git a/gui/lib/utils_get_version.py b/gui/lib/utils_get_version.py
index 29994db..0c7f279 100755
--- a/gui/lib/utils_get_version.py
+++ b/gui/lib/utils_get_version.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import gen_print as gp
 import gen_cmd as gc
diff --git a/lib/bmc_network_utils.py b/lib/bmc_network_utils.py
index d73a1e1..a704392 100644
--- a/lib/bmc_network_utils.py
+++ b/lib/bmc_network_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Network generic functions.
diff --git a/lib/bmc_redfish.py b/lib/bmc_redfish.py
index 5ce17f6..1679ca4 100644
--- a/lib/bmc_redfish.py
+++ b/lib/bmc_redfish.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See class prolog below for details.
diff --git a/lib/bmc_redfish_utils.py b/lib/bmc_redfish_utils.py
index 2ea250f..a361146 100644
--- a/lib/bmc_redfish_utils.py
+++ b/lib/bmc_redfish_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 BMC redfish utility functions.
diff --git a/lib/bmc_ssh_utils.py b/lib/bmc_ssh_utils.py
index c82788f..3aa90fa 100755
--- a/lib/bmc_ssh_utils.py
+++ b/lib/bmc_ssh_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides many valuable bmc ssh functions such as bmc_execute_command.
diff --git a/lib/boot_data.py b/lib/boot_data.py
index f1b7147..eaa7a52 100755
--- a/lib/boot_data.py
+++ b/lib/boot_data.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module has functions to support various data structures such as the boot_table, valid_boot_list and
diff --git a/lib/code_update_utils.py b/lib/code_update_utils.py
index 35953c7..e8ee562 100644
--- a/lib/code_update_utils.py
+++ b/lib/code_update_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides utilities for code updates.
diff --git a/lib/disable_warning_urllib.py b/lib/disable_warning_urllib.py
index 55a7239..4c08a24 100644
--- a/lib/disable_warning_urllib.py
+++ b/lib/disable_warning_urllib.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 import logging
 import warnings
 try:
diff --git a/lib/dump_utils.py b/lib/dump_utils.py
index 94c409f..add5f5b 100755
--- a/lib/dump_utils.py
+++ b/lib/dump_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This file contains functions which are useful for processing BMC dumps.
diff --git a/lib/event_notification.py b/lib/event_notification.py
index 1e12bbc..363caf4 100755
--- a/lib/event_notification.py
+++ b/lib/event_notification.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import requests
 import websocket
diff --git a/lib/external_intf/management_console_utils.py b/lib/external_intf/management_console_utils.py
index 2cc62a9..d754bea 100644
--- a/lib/external_intf/management_console_utils.py
+++ b/lib/external_intf/management_console_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import os
 import re
diff --git a/lib/firmware_utils.py b/lib/firmware_utils.py
index 99ad7c6..959693d 100755
--- a/lib/firmware_utils.py
+++ b/lib/firmware_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains functions which pertain to firmware.
diff --git a/lib/func_args.py b/lib/func_args.py
index 4edb5cd..306af38 100644
--- a/lib/func_args.py
+++ b/lib/func_args.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides argument manipulation functions like pop_arg.
diff --git a/lib/func_timer.py b/lib/func_timer.py
index 27cfa52..0021163 100644
--- a/lib/func_timer.py
+++ b/lib/func_timer.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Define the func_timer class.
diff --git a/lib/gen_arg.py b/lib/gen_arg.py
index b89d4cd..afa7b57 100755
--- a/lib/gen_arg.py
+++ b/lib/gen_arg.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides valuable argument processing functions like gen_get_options and sprint_args.
diff --git a/lib/gen_call_robot.py b/lib/gen_call_robot.py
index 62ea130..2e51626 100755
--- a/lib/gen_call_robot.py
+++ b/lib/gen_call_robot.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides functions which are useful to plug-ins call-point programs that wish to make external
@@ -359,7 +359,7 @@
     # It TMP_ROBOT_DIR_PATH is set, it means the caller wanted the robot output initially directed to
     # TMP_ROBOT_DIR_PATH but later moved to FFDC_DIR_PATH.  Otherwise, we're done.
 
-    if os.environ.get("TMP_ROBOT_DIR_PATH", "") is "":
+    if os.environ.get("TMP_ROBOT_DIR_PATH", "") == "":
         return
 
     # We're directing these to the FFDC dir path so that they'll be subjected to FFDC cleanup.
diff --git a/lib/gen_cmd.py b/lib/gen_cmd.py
index 18b79e9..cac5ba4 100644
--- a/lib/gen_cmd.py
+++ b/lib/gen_cmd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides command execution functions such as cmd_fnc and cmd_fnc_u.
@@ -83,6 +83,7 @@
     sub_proc = subprocess.Popen(cmd_buf,
                                 bufsize=1,
                                 shell=True,
+                                universal_newlines=True,
                                 executable='/bin/bash',
                                 stdout=subprocess.PIPE,
                                 stderr=stderr)
@@ -353,11 +354,11 @@
     func_out_history_buf = ""
     for attempt_num in range(1, max_attempts + 1):
         sub_proc = subprocess.Popen(command_string,
-                                    preexec_fn=os.setsid,
                                     bufsize=1,
                                     shell=True,
                                     universal_newlines=True,
                                     executable='/bin/bash',
+                                    stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
                                     stderr=stderr)
         if fork:
diff --git a/lib/gen_misc.py b/lib/gen_misc.py
index 8857d63..ad5beea 100755
--- a/lib/gen_misc.py
+++ b/lib/gen_misc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides many valuable functions such as my_parm_file.
diff --git a/lib/gen_plug_in.py b/lib/gen_plug_in.py
index 95776d5..fc57cef 100755
--- a/lib/gen_plug_in.py
+++ b/lib/gen_plug_in.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides functions which are useful for running plug-ins.
diff --git a/lib/gen_plug_in_utils.py b/lib/gen_plug_in_utils.py
index 825801f..7ec2088 100755
--- a/lib/gen_plug_in_utils.py
+++ b/lib/gen_plug_in_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides functions which are useful to plug-in call point programs.
diff --git a/lib/gen_print.py b/lib/gen_print.py
index d65ed39..5f87343 100755
--- a/lib/gen_print.py
+++ b/lib/gen_print.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides many print functions such as sprint_var, sprint_time, sprint_error, sprint_call_stack.
diff --git a/lib/gen_robot_keyword.py b/lib/gen_robot_keyword.py
index 1bac73d..f4b2e73 100755
--- a/lib/gen_robot_keyword.py
+++ b/lib/gen_robot_keyword.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides robot keyword execution functions such as run_key..
diff --git a/lib/gen_robot_plug_in.py b/lib/gen_robot_plug_in.py
index 0920067..0f6deda 100755
--- a/lib/gen_robot_plug_in.py
+++ b/lib/gen_robot_plug_in.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides functions which are useful for running plug-ins from a robot program.
diff --git a/lib/gen_robot_print.py b/lib/gen_robot_print.py
index 7dd1384..fb958e0 100755
--- a/lib/gen_robot_print.py
+++ b/lib/gen_robot_print.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This file contains functions useful for printing to stdout from robot programs.
diff --git a/lib/gen_robot_ssh.py b/lib/gen_robot_ssh.py
index b79daf6..38391d1 100755
--- a/lib/gen_robot_ssh.py
+++ b/lib/gen_robot_ssh.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides many valuable ssh functions such as sprint_connection, execute_ssh_command, etc.
diff --git a/lib/gen_robot_utils.py b/lib/gen_robot_utils.py
index fd15eed..bd61a87 100644
--- a/lib/gen_robot_utils.py
+++ b/lib/gen_robot_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains utility and wrapper functions useful to robot python
diff --git a/lib/gen_robot_valid.py b/lib/gen_robot_valid.py
index df8038c..5580a5e 100755
--- a/lib/gen_robot_valid.py
+++ b/lib/gen_robot_valid.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides validation functions like valid_value(), valid_integer(), etc. for robot programs.
diff --git a/lib/gen_valid.py b/lib/gen_valid.py
index d934054..57c1a1d 100755
--- a/lib/gen_valid.py
+++ b/lib/gen_valid.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides validation functions like valid_value(), valid_integer(), etc.
diff --git a/lib/ipmi_client.py b/lib/ipmi_client.py
index 85a7342..7eb8f08 100644
--- a/lib/ipmi_client.py
+++ b/lib/ipmi_client.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 A python companion file for ipmi_client.robot.
diff --git a/lib/ipmi_utils.py b/lib/ipmi_utils.py
index 910db87..a23e9e5 100644
--- a/lib/ipmi_utils.py
+++ b/lib/ipmi_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Provide useful ipmi functions.
diff --git a/lib/jobs_processing.py b/lib/jobs_processing.py
index 3368bd7..5555b62 100644
--- a/lib/jobs_processing.py
+++ b/lib/jobs_processing.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains keyword functions to support multiprocessing
diff --git a/lib/logging_utils.py b/lib/logging_utils.py
index 5186b17..e621d5e 100644
--- a/lib/logging_utils.py
+++ b/lib/logging_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Provide useful error log utility keywords.
diff --git a/lib/obmc_boot_test.py b/lib/obmc_boot_test.py
index 17a329e..0f69e03 100755
--- a/lib/obmc_boot_test.py
+++ b/lib/obmc_boot_test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module is the python counterpart to obmc_boot_test.
diff --git a/lib/openbmc_ffdc.py b/lib/openbmc_ffdc.py
index e4153f8..5a4657b 100644
--- a/lib/openbmc_ffdc.py
+++ b/lib/openbmc_ffdc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module is the python counterpart to openbmc_ffdc.robot..
diff --git a/lib/openbmc_ffdc_list.py b/lib/openbmc_ffdc_list.py
index 910bce0..d3ca829 100755
--- a/lib/openbmc_ffdc_list.py
+++ b/lib/openbmc_ffdc_list.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 r"""
 #    @file     openbmc_ffdc_list.py
 #    @brief    List for FFDC ( First failure data capture )
diff --git a/lib/openbmctool_utils.py b/lib/openbmctool_utils.py
index 7f98963..a6c94e9 100755
--- a/lib/openbmctool_utils.py
+++ b/lib/openbmctool_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides many valuable openbmctool.py functions such as
diff --git a/lib/pel_utils.py b/lib/pel_utils.py
index 2ad9f52..9321347 100644
--- a/lib/pel_utils.py
+++ b/lib/pel_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 PEL functions.
diff --git a/lib/pldm_utils.py b/lib/pldm_utils.py
index 8e0f2cc..35fe929 100755
--- a/lib/pldm_utils.py
+++ b/lib/pldm_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 PLDM functions.
diff --git a/lib/redfish_plus.py b/lib/redfish_plus.py
index 96e9daf..e2125ca 100755
--- a/lib/redfish_plus.py
+++ b/lib/redfish_plus.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 See redfish_plus class prolog below for details.
diff --git a/lib/redfish_request.py b/lib/redfish_request.py
index 1918a07..6add29f 100644
--- a/lib/redfish_request.py
+++ b/lib/redfish_request.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 import requests
 import urllib.request
diff --git a/lib/secureboot/secureboot.py b/lib/secureboot/secureboot.py
index 99728c8..1aa5f06 100644
--- a/lib/secureboot/secureboot.py
+++ b/lib/secureboot/secureboot.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides some functions for Secure Boot verification.
diff --git a/lib/state.py b/lib/state.py
index ea45dd2..b688566 100755
--- a/lib/state.py
+++ b/lib/state.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains functions having to do with machine state: get_state,
@@ -571,12 +571,12 @@
         if os_host is None:
             os_host = ""
 
-    if os_username is "":
+    if os_username == "":
         os_username = BuiltIn().get_variable_value("${OS_USERNAME}")
         if os_username is None:
             os_username = ""
 
-    if os_password is "":
+    if os_password == "":
         os_password = BuiltIn().get_variable_value("${OS_PASSWORD}")
         if os_password is None:
             os_password = ""
diff --git a/lib/state_map.py b/lib/state_map.py
index 908b159..5d72b5a 100644
--- a/lib/state_map.py
+++ b/lib/state_map.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 State Manager module:
diff --git a/lib/tally_sheet.py b/lib/tally_sheet.py
index c48e161..03162af 100755
--- a/lib/tally_sheet.py
+++ b/lib/tally_sheet.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Define the tally_sheet class.
diff --git a/lib/tftp_update_utils.py b/lib/tftp_update_utils.py
index 2d0f7e3..6220591 100644
--- a/lib/tftp_update_utils.py
+++ b/lib/tftp_update_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains functions for tftp update.
diff --git a/lib/utilities.py b/lib/utilities.py
index dd7da09..6416aa9 100755
--- a/lib/utilities.py
+++ b/lib/utilities.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python -u
+#!/usr/bin/env python3 -u
 import sys
 from robot.libraries.BuiltIn import BuiltIn
 import imp
diff --git a/lib/utils.py b/lib/utils.py
index 72cb202..20dbef1 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Companion file to utils.robot.
diff --git a/lib/utils_files.py b/lib/utils_files.py
index 3395e65..0b19432 100755
--- a/lib/utils_files.py
+++ b/lib/utils_files.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains file functions such as file_diff.
diff --git a/lib/var_funcs.py b/lib/var_funcs.py
index 72a0f62..fdde68e 100644
--- a/lib/var_funcs.py
+++ b/lib/var_funcs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Define variable manipulation functions.
diff --git a/lib/var_stack.py b/lib/var_stack.py
index 0b73b91..3ea3813 100644
--- a/lib/var_stack.py
+++ b/lib/var_stack.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Define the var_stack class.
diff --git a/lib/vpd_utils.py b/lib/vpd_utils.py
index 38a86d7..eb31c71 100644
--- a/lib/vpd_utils.py
+++ b/lib/vpd_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 VPD functions.
diff --git a/lib/wrap_utils.py b/lib/wrap_utils.py
index de678b3..231dff8 100755
--- a/lib/wrap_utils.py
+++ b/lib/wrap_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module provides functions which are useful for writing python wrapper functions (i.e. in this context, a
diff --git a/openpower/vpd/test_vpd.robot b/openpower/vpd/test_vpd.robot
index 02ab34f..d12c163 100644
--- a/openpower/vpd/test_vpd.robot
+++ b/openpower/vpd/test_vpd.robot
@@ -3,7 +3,7 @@
 ...             Before running this suite, create a data/vpd_data.py file with
 ...             all VPD data to verify from system.
 ...
-...             #!/usr/bin/python
+...             #!/usr/bin/env python3
 ...             VPD_DETAILS = {
 ...                 "/system/chassis/motherboard": {
 ...                     "DR": "SYSTEM BACKPLANE",
diff --git a/robot_custom_rules.py b/robot_custom_rules.py
index 1c917f2..ef10c84 100644
--- a/robot_custom_rules.py
+++ b/robot_custom_rules.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # Custom rules file for robotframework-lint.
 # Example usage: python -m rflint -rA robot_standards -R robot_custom_rules.py .
 import re
diff --git a/syslib/utils_keywords.py b/syslib/utils_keywords.py
index 40437e6..f2368b6 100644
--- a/syslib/utils_keywords.py
+++ b/syslib/utils_keywords.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module contains keyword functions to supplement robot's built in
diff --git a/syslib/utils_os.py b/syslib/utils_os.py
index 5e6ef9c..f163201 100755
--- a/syslib/utils_os.py
+++ b/syslib/utils_os.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This file contains utilities associated with the host OS.
diff --git a/templates/pgm_template.py b/templates/pgm_template.py
index c597992..91e104e 100755
--- a/templates/pgm_template.py
+++ b/templates/pgm_template.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 This module is the python counterpart to pgm_template.py.
diff --git a/templates/python_pgm_template b/templates/python_pgm_template
index 12e80ce..fcd0c6f 100644
--- a/templates/python_pgm_template
+++ b/templates/python_pgm_template
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 from gen_print import *
 from gen_arg import *
diff --git a/tools/ct_metrics/gen_csv_results.py b/tools/ct_metrics/gen_csv_results.py
index 78b323d..342fe69 100755
--- a/tools/ct_metrics/gen_csv_results.py
+++ b/tools/ct_metrics/gen_csv_results.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Use robot framework API to extract test result data from output.xml generated
diff --git a/tools/github_issues_to_csv b/tools/github_issues_to_csv
index 7dc1ed0..e1e0221 100644
--- a/tools/github_issues_to_csv
+++ b/tools/github_issues_to_csv
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 r"""
 Exports issues from a list of repositories to individual CSV files.