Scribus > Scripts and Plugins

In Script Console: Can Python Be Configured?


I'm trying to get a handle on the Python interface both for Unix and Windows.

I'm running the stable build 1.4.1.  There is a dynamic link library (DLL) in the main directory, i.e. C:\Program Files (x86)\Scribus 1.4.1, for python: python27.dll.  I read a post somewhere where someone mentioned removing the dll along with some directories and then the system's python would be utilized.  I tried appending "HOLD" to the file name and the lib, dlls, and tcl directories and found that the scripting engine just became inoperative.  So I'm guessing that the python that ships with this release, python 2.7, is the only python available within the scripting environment; you cannot invoke a higher version of python with the Windows release.  Is this a correct statement?

I'm working off the Subversion HEAD, 1.5.0.svn, and finding that the python exposed through the scripting interface is version 2.6.6.  I click Script-->Show Console and then in the upper pain enter:

--- Code: ---print(sys.version)
--- End code ---
that produces

--- Code: ---2.6.6 (r266:84292, Mar 25 2011, 22:27:52)
[GCC 4.4.5]
--- End code ---

In Gentoo, we have slots that allow for installations of various versions of software.  For Python, I have the following installed:

--- Code: ---[U] dev-lang/python
     Available versions:
        (2.5)   2.5.4-r4
        (2.6)   2.6.6-r2 ~2.6.7-r2 2.6.8
        (2.7)   2.7.2-r3 ~2.7.3 2.7.3-r1 ~2.7.3-r2
        (3.1)   3.1.4-r3 ~3.1.4-r4 3.1.5
        (3.2)   3.2.2 ~3.2.2-r1 3.2.3 ~3.2.3-r1
        {-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml}
     Installed versions:  2.6.6-r2(2.6)(22:29:13 03/25/11)(gdbm ncurses readline sqlite ssl threads wide-unicode xml -berkdb -build -doc -elibc_uclibc -examples -ipv6 -tk -wininst)
2.7.2-r3(2.7)(05:35:55 11/07/11)(gdbm ncurses readline sqlite ssl threads wide-unicode xml -berkdb -build -doc -elibc_uclibc -examples -ipv6 -tk -wininst)
3.1.4-r3(3.1)(05:47:17 11/07/11)(gdbm ncurses readline sqlite ssl threads wide-unicode xml -build -doc -elibc_uclibc -examples -ipv6 -tk -wininst)
3.2.3(3.2)(21:13:08 06/13/12)(gdbm ncurses readline sqlite ssl threads tk wide-unicode xml -build -doc -elibc_uclibc -examples -ipv6 -wininst)
     Description:         Python is an interpreted, interactive, object-oriented programming language.

--- End code ---

You select which version you want operative by the "eselect" command.

--- Code: ---themis src # eselect python list
Available Python interpreters:
  [1]   python2.6
  [2]   python2.7
  [3]   python3.1
  [4]   python3.2 *
themis src #

--- End code ---

In this case, I have version 3.2 selected as indicated by the asterisk.  I cannot remember which slot of python I had operative when I built python from the Subversion pull, but I'm pretty sure I had 3.2 selected.  It takes about 15 minutes to build Scribus on my laptop, and I've gone through several builds seeing if I can affect the outcome of which version of Python runs in the console.

With this background, I'm wondering if one can specify which version of Python is running in Scribus's console, or is that hardwired into the product?  I acknowledge that Gentoo's slot system adds an additional layer of complexity.

When I select Script->Scribus Scripts->Font Sample, I get this error message:

--- Code: ---This script will not work without Tkinter
Please install and try again
--- End code ---

My python version 3.2 does have tkinter (changed to lowercase for Python 3.+) available (however, version 2.6 does not) as I get the sample window when running: 
--- Code: ---python -m tkinter
--- End code ---

So, this topic is designed to address the question of whether the version of Python running from the script interface is configurable either at run time or during the build process.

I found a partial answer to my question (at least for a Windows build):

only 2.7, 3.x will not work

See line 327 in, version 17537


[0] Message Index

Go to full version