In compiler options / command line I have put : c:\python33\python.exe "$fn" (I dont know what "$fn" is, it was there already so I left it.) That is my python directory. however Python loads and crashes immediately and I get this error :
Using document type compiler options....
Fatal Python error: Py_Initialize: unable to load the file system codec
File "C:\Users\Jack\AppData\Roaming\Xidicone\Zeus\zScript\PyLib\encodings\__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
What am I doing wrong?
Setting the compiler to Python 3.x
-
- Posts: 7
- Joined: Sat May 25, 2013 11:02 am
You have done everything correctly but what has happened is the newer Python has picked up the older Python library that comes with Zeus.
I'll have to do some testing at this end to see how to fix this.
But in the mean time go to this folder:
and rename PyLib to PyLib-Old
I'm hoping that will stop the new Python finding the old library so it will then use it's version of the library files.
Cheers Jussi
I'll have to do some testing at this end to see how to fix this.
But in the mean time go to this folder:
Code: Select all
C:\Users\Jack\AppData\Roaming\Xidicone\Zeus\zScript\
I'm hoping that will stop the new Python finding the old library so it will then use it's version of the library files.
Cheers Jussi
-
- Posts: 7
- Joined: Sat May 25, 2013 11:02 am
To fix this properly you can do the following.
Firstly put back the Zeus PyLib folder which will break the compiler option.
Now for some further information on how the compile works.
To compile (syntax check) a Python file from inside Zeus this zpython.cmd batch file (found in the Zeus install folder) is used:
This batch file is run via the Compiler options found in the Python document type using this command line:
The "$f" and "$fdd" above equate to the file name and file drive directory of the currently active file and are passed to the batch file as arguments.
You will notice that the pythonc.exe is being used to compile the file. This executable is nothing more than the Python 2.7.2 version that comes with Zeus.
In your case you want to run the latest Python 3.x so just change the batch file to use the correct Python version as follows:
And make sure the Python Compiler command line is set to this:
But after doing this when you compile a file you will get the same error that you reported earlier:
This is because Zeus has set the PYTHONPATH environment variable to point to this folder:
But this folder contains the 2.72 version of the library not the required 3.3 version.
To fix this just set the PYTHONPATH environment variable by hand as follows:
Now if you restart Zeus and recompile the file, this time the Python executable will find the correct version of the library files 
Cheers Jussi
Firstly put back the Zeus PyLib folder which will break the compiler option.
Now for some further information on how the compile works.
To compile (syntax check) a Python file from inside Zeus this zpython.cmd batch file (found in the Zeus install folder) is used:
Code: Select all
@echo off
REM Move to the file's directory
cd %2
REM Remove the double quotes from the file name argument
set file_name=%1
set file_name=%file_name:"=%
REM Run a syntax check on the file provided
call pythonc.exe -c "compile(open('%file_name%').read(), '%file_name%', 'exec')"
Code: Select all
zpython.cmd "$f" "$fdd"
You will notice that the pythonc.exe is being used to compile the file. This executable is nothing more than the Python 2.7.2 version that comes with Zeus.
In your case you want to run the latest Python 3.x so just change the batch file to use the correct Python version as follows:
Code: Select all
call C:\Python33\python.exe -c "compile(open('%file_name%').read(), '%file_name%', 'exec')"
Code: Select all
zpython.cmd "$f" "$fdd"
Code: Select all
Fatal Python error: Py_Initialize: unable to load the file system codec
File "C:\Users\Jack\AppData\Roaming\Xidicone\Zeus\zScript\PyLib\encodings\__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
This is because Zeus has set the PYTHONPATH environment variable to point to this folder:
Code: Select all
C:\Users\Jack\AppData\Roaming\Xidicone\Zeus\zScript\PyLib\
To fix this just set the PYTHONPATH environment variable by hand as follows:
- Start Run, Control Panel menu
- System, Advance System Settings
- Environment Variables
Code: Select all
C:\Python33\Lib;

Cheers Jussi
Another thing you should do is make sure the C:\Python33 folder is in the system PATH environment variable.
Use the Control Panel, Environment Variables (as described earlier) to edit the PATH environment variable, adding this folder to that variable:
Cheers Jussi
Use the Control Panel, Environment Variables (as described earlier) to edit the PATH environment variable, adding this folder to that variable:
Code: Select all
C:\Python33