View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0008183||Scribus||Scripter||public||2009-06-20 12:10||2009-06-24 12:28|
|Platform||Intel Centrino Core 2 Duo||OS||Windows Vista||OS Version||6.0 - SP1|
|Summary||0008183: Python plugin load error|
|Description||I have Python 2.6 installed.|
I always ran my scripts with "python scriptname.py", from the command line. Yesterday I wanted to try to run them by double-clicking from Windows Explorer. They didn't work.
After some research, I discovered that my environment was lacking a variable, there was PYTHONPATH, but not PYTHONHOME (which, accordingly to the Python documentation, fulfills a different role, although they can point to the same directory).
After having set up that variable (with the same value as PYTHONPATH), my Python scripts began to work by double-clicking from Explorer.
But today I opened Scribus and a message box said that the Python plugin failed to load. I removed the environment variable PYTHONHOME and Scribus loaded properly.
The full error message follows.
|Additional Information||C:\Program Files\Python26\lib\site.py:150: Warning: 'with' will become a reserved keyword in Python 2.6|
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "C:\Program Files\Python26\lib\warnings.py", line 6, in <module>
File "C:\Program Files\Python26\lib\linecache.py", line 9, in <module>
File "C:\Program Files\Python26\lib\os.py", line 757
bs = b""
SyntaxError: invalid syntax
|Tags||No tags attached.|
||To avoid confusion, when I talk about Python scripts in this report, I'm not referring to scripts that ship with Scribus, but to completely different ones, not Scribus-related.|
|Scribus ships its own python. Do you need python installed separately ?|
|Scribus ships its own python. do you need a separate install ?|
Setting PYTHONHOME will create a conflict between Scribus python and your python. In fact setting PYTHONHOME will basically prevent several python versions to coexist on Windows.
Your best options is probably to delete scribus python version. For that you should delete/rename in scribus install directory :
- the python dll
- the dlls, lib (not libs!!), and tcl directory
I have installed Python for scripting before having Scribus.
Different Python versions should coexist on the same machine (i.e. let's say a user has both 2.6 and 3.0).
I think Scribus should ship with a Python version that has been checked to work with (as it does now), but that shouldn't conflict with any other Python installation on the user computer, and moreover, the user shouldn't touch Scribus directories to resolve a problem.
The main point here is that if I later install another program which comes with Python, then that could potentially be another source of conflict.
Does Scribus set up a custom environment when loading Python? If not, since it knows both the home and the lib paths of its embedded interpreter, can it set it up?
>>Different Python versions should coexist on the same machine
That won't be possible if you set PYTHONHOME at system level
>>Does Scribus set up a custom environment when loading Python? If not, since it knows both the home and the lib paths of its embedded interpreter, can it set it up?
>> That won't be possible if you set PYTHONHOME at system level
Of course, but i.e. I can keep that environment variable for my "main" Python version and if I want to use another one, I can write a shell script that will properly set the environment for that.
>> Currently not.
I see. Well, I'm not a Python expert, I just gave a quick look at the docs, and found that scripts can manipulate sys.path (which reflects PYTHONPATH) and that Py_SetPythonHome(char *home) can be used to change the Python home directory.
Hope that's useful.
>>>> That won't be possible if you set PYTHONHOME at system level
>>Of course, but i.e. I can keep that environment variable for my "main" Python version and if I want to use another one, I can write a shell script that will properly set the environment for that.
Yes, but the problem of that way of doing is the upgrade path when changing default python version for eg from 2.6 to 3.0. If scripts for 2.6 have not been appropriately written to run with 2.6 and 3.0 scripts to run with 3.0, changing PYTHONHOME will break 2.6 scripts. That's imho a good reason not to set PYTHONHOME at system level. With scripts appropriately written, PYTHONHOME is not quite needed.
>> I just gave a quick look at the docs, and found that scripts can manipulate sys.path (which reflects PYTHONPATH) and that Py_SetPythonHome(char *home) can be used to change the Python home directory.
Unfortunately Py_SetPythonHome() is not quite useable on Windows being not unicode compliant. Installing scribus in a directory with specific names would prevent scribus python to function properly.
|2009-06-20 12:10||nanorod||New Issue|
|2009-06-20 12:38||nanorod||Note Added: 0021992|
||Note Added: 0022018|
||Note Added: 0022019|
|2009-06-23 21:38||jghali||Note Added: 0022020|
|2009-06-23 21:38||jghali||Note Edited: 0022020|
|2009-06-24 09:16||nanorod||Note Added: 0022022|
|2009-06-24 10:17||jghali||Note Added: 0022023|
|2009-06-24 11:03||nanorod||Note Added: 0022025|
|2009-06-24 12:28||jghali||Note Added: 0022028|
|2009-06-24 12:34||jghali||Note Edited: 0022028|
|2009-06-24 12:37||jghali||Note Edited: 0022028|