View Issue Details

IDProjectCategoryView StatusLast Update
0008183ScribusScripterpublic2009-06-24 12:28
Reporternanorod Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformIntel Centrino Core 2 DuoOSWindows VistaOS Version6.0 - SP1
Product Version1.3.5svn 
Summary0008183: Python plugin load error
DescriptionI 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 InformationC:\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>
    import linecache
  File "C:\Program Files\Python26\lib\linecache.py", line 9, in <module>
    import os
  File "C:\Program Files\Python26\lib\os.py", line 757
    bs = b""
           ^
SyntaxError: invalid syntax
TagsNo tags attached.
Patch

Activities

nanorod

2009-06-20 12:38

reporter   ~0021992

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.

plinnell

2009-06-23 21:21

viewer   ~0022018

Scribus ships its own python. Do you need python installed separately ?

plinnell

2009-06-23 21:28

viewer   ~0022019

Scribus ships its own python. do you need a separate install ?

jghali

2009-06-23 21:38

administrator   ~0022020

Last edited: 2009-06-23 21:38

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

nanorod

2009-06-24 09:16

reporter   ~0022022

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?

jghali

2009-06-24 10:17

administrator   ~0022023

>>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?

Currently not.

nanorod

2009-06-24 11:03

reporter   ~0022025

>> 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.

jghali

2009-06-24 12:28

administrator   ~0022028

Last edited: 2009-06-24 12:37

>>>> 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.

Issue History

Date Modified Username Field Change
2009-06-20 12:10 nanorod New Issue
2009-06-20 12:38 nanorod Note Added: 0021992
2009-06-23 21:21 plinnell Note Added: 0022018
2009-06-23 21:28 plinnell 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