diff --git a/template/start.py b/template/start.py index 647a745..72cc5e7 100644 --- a/template/start.py +++ b/template/start.py @@ -129,6 +129,8 @@ if compiledVersion: with zipfile.ZipFile(zipfilePath, mode="r") as ourzipappfile: ourzipappfile.extract(f"sitepackages/{cboxSharedObjectVersionedName}", path=libsharedDir.name) + sys.path.append(os.path.join(zipfilePath,"sitepackages")) + cboxso = os.path.join(libsharedDir.name, f"sitepackages/{cboxSharedObjectVersionedName}") logger.info(f"Shared library extracted to: {cboxso}") os.environ["CALFBOXLIBABSPATH"] = cboxso @@ -354,6 +356,7 @@ if args.mute: #Make sure calfbox is available. +pycboxfound = False if "CALFBOXLIBABSPATH" in os.environ: logger.info("Looking for calfbox shared library in absolute path: {}".format(os.environ["CALFBOXLIBABSPATH"])) @@ -362,22 +365,29 @@ else: if compiledVersion: - from sitepackages import cbox - logger.info(f"Calbox Python module loaded: {os.path.abspath(cbox.__file__)}") + try: + from sitepackages.calfbox import cbox + logger.info(f"Calbox Python module loaded: {os.path.abspath(cbox.__file__)}") + pycboxfound = True + except Exception as e: + print (e) else: try: from calfbox import cbox logger.info("{}: using cbox python module from {} . Local version has higher priority than system wide.".format(METADATA["name"], os.path.abspath(cbox.__file__))) + pycboxfound = True except Exception as e: print (e) - print ("Here is some information. Please show this to the developers.") - if "calfbox" in sys.modules: - print (sys.modules["calfbox"], "->", os.path.abspath(sys.modules["calfbox"].__file__)) - else: - print ("calfbox python module is not in sys.modules. This means it truly can't be found or you forgot --mute") - print ("sys.path start and tail:", sys.path[0:5], sys.path[-1]) - exitWithMessage("Calfbox module could not be loaded") +if not pycboxfound: + print ("Here is some information. Please show this to the developers.") + if "calfbox" in sys.modules: + print (sys.modules["calfbox"], "->", os.path.abspath(sys.modules["calfbox"].__file__)) + else: + print ("calfbox python module is not in sys.modules. This means it truly can't be found or you forgot --mute") + + print ("sys.path start and tail:", sys.path[0:5], sys.path[-5:-1]) + exitWithMessage("Calfbox module could not be loaded") #Capture Ctlr+C / SIGINT and let @atexit handle the rest.