Skip to content

Commit

Permalink
V1.18.18
Browse files Browse the repository at this point in the history
  • Loading branch information
jgyates committed Oct 14, 2023
1 parent ae2b494 commit da89f9e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
9 changes: 8 additions & 1 deletion OtherApps/modbusdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
from genmonlib.mymodbus import ModbusProtocol
except Exception as e1:
print("\n\nThis program is used for the testing of modbus registers.")
print("\n\nThis program requires the modules mymodbus.py and myserial.py to reside in the genmonlib directory.\n")
managedfile = f"/usr/lib/python{sys.version_info.major:d}.{sys.version_info.minor:d}/EXTERNALLY-MANAGED"
if os.path.isfile(managedfile):
print("\n\nYou appear to be running in a managed python environemnt. To run this program see this page: ")
print("\n\n https://github.com/jgyates/genmon/wiki/Appendix-S---Working-in-a-Managed-Python-Environment\n")
else:
print("\nThe required python libraries are not installed. You must run the setup script first.\n")
print("\n\n https://github.com/jgyates/genmon/wiki/3.3--Setup-genmon-software")

print("\n\nError: " + str(e1))
sys.exit(2)

Expand Down
13 changes: 11 additions & 2 deletions OtherApps/serialtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@
import sys
import time

import serial

try:
import serial
except Exception as e1:
managedfile = f"/usr/lib/python{sys.version_info.major:d}.{sys.version_info.minor:d}/EXTERNALLY-MANAGED"
if os.path.isfile(managedfile):
print("\n\nYou appear to be running in a managed python environemnt. To run this program see this page: ")
print("\n\n https://github.com/jgyates/genmon/wiki/Appendix-S---Working-in-a-Managed-Python-Environment\n")
else:
print("\nThe python serial libary is not install. You must run the setup script first.\n")
print("\n\n https://github.com/jgyates/genmon/wiki/3.3--Setup-genmon-software")
sys.exit(1)

# ------------ VersionTuple -----------------------------------------------------
def VersionTuple(value):
Expand Down
6 changes: 0 additions & 6 deletions genloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,6 @@ def CheckBaseSoftware(self):
if not self.ExecuteCommandList(command_list):
self.InstallBaseSoftware()

# /usr/lib/python3.11/EXTERNALLY-MANAGED
managedfile = f"/usr/lib/python{sys.version_info.major:d}.{sys.version_info.minor:d}/EXTERNALLY-MANAGED"
if os.path.isfile(managedfile):
self.OverrideManagedPackages = True
else:
self.OverrideManagedPackages = False
self.PipChecked = True
return True
except Exception as e1:
Expand Down
11 changes: 11 additions & 0 deletions genmonlib/mycommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ def InVirtualEnvironment(self):
(hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))
except:
return False
# ------------ MyCommon::InManagedLibaries ----------------------------------
def ManagedLibariesEnabled(self):
try:
# /usr/lib/python3.11/EXTERNALLY-MANAGED
managedfile = f"/usr/lib/python{sys.version_info.major:d}.{sys.version_info.minor:d}/EXTERNALLY-MANAGED"
if os.path.isfile(managedfile):
return True
else:
return False
except:
return False
# ------------ MyCommon::VersionTuple ---------------------------------------
def VersionTuple(self, value):

Expand Down

0 comments on commit da89f9e

Please sign in to comment.