At some days I don’t like developing very much. I’ve got a tiny little Python helper app that fixes screwed up encodings. The code works fine in the PyCharm IDE. It also works fine when executing the built app from terminal. When using the shell in Xojo to execute the app I get
[quote]Fatal Python error: Py_Initialize: unable to load the file system codec
zipimport.ZipImportError: can’t decompress data; zlib not available
Current thread 0x00007fff72d82000 (most recent call first):
Abort trap: 6[/quote]
Goggle tells me that this is a problem between different Python installations: “Check PYTHONPATH and PYTHONHOME system variable and make sure it doesn’t points to Python 2.x”
The Xojo docs tell me that a Xojo shell is not the normal shell. Can I change PYTHONPATH and PYTHONHOME dynamically for the Xojo shell to reflect the path to the Python in the app?
The code needs a library that needs Python 3 so that using the Einhugur plugin for the Python code is not possible.
@Björn Einhugur: can I use the plugin at the customer without having Python 3 installed? For myself this is no problem. I can’t have my users install Python.
Now the usual stupid question: which values for path and home do I need? The Frameworks or the Resources folder in my app?
The value of PYTHONPATH in PyCharm is:
‘PYTHONPATH’: ‘/Users/beatrixwillius/PycharmProjects/ftfy:/Applications/Develop/PyCharm CE.app/Contents/helpers/pydev:/Users/beatrixwillius/Library/Caches/PyCharmCE2018.2/cythonExtensions’,
[quote]bash: PYTHONHOME: command not found
Fatal Python error: Py_Initialize: unable to load the file system codec
zipimport.ZipImportError: can’t decompress data; zlib not available
@Björn Einhugur: can I use the plugin at the customer without having Python 3 installed? For myself this is no problem. I can’t have my users install Python.[/quote]
As far as I know then you always need to install Python to run any sort of Python. (Including when running it from Xojo)
@Alberto de Poo: the zlib is in the app. The app thinks that Python is somewhere else and can’t find the zlib. But I don’t know how to point the app to the correct Python version.
@Alberto de Poo: that certainly looks perverted but less so than the ideas I was toying with. For instance, I can do a “do shell script” from an AppleScript. But this needs a fixed script. And I read about dockerizing Python (shudder).
@Steve Wilson and @Björn Eiríksson : I’ll keep copying Python into my app in mind.