View Issue Details

IDProjectCategoryView StatusLast Update
0009559ScribusScripterpublic2016-12-16 19:40
Reporterale Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Product Version1.3.9 
Target VersionFixed in Version 
Summary0009559: fix sys.path.insert()
Descriptionno idea of what the problem was... but here is the solution by yofel:

<yofel> hm, about phitoo_s python issue, that's because here on ubuntu the C API seems to set sys.path[0] not to an empty string but to /usr/lib/python2.6 which you assume is sys.path[1], so you're overwriting the base search path when initializing the script engine.
<yofel> why not use "sys.path.insert(0, \"%1\")\n" instead of
"sys.path[0] = \"%1\"\n" in



2011-02-28 13:15

reporter   ~0025678

As I can not add relationships a note will have to do.
Related to 0009736


2011-02-28 18:09

administrator   ~0025682

How do we know they are related?


2011-03-01 08:33

reporter   ~0025689

I do not know, I was mearly "estimating" based on the following indications:
[1] hints that PIL freezes scribus, [2] describes a similar (may be same) problem
and links to [3]. [3] in turn to mee looks like a duplicate to this bug.
0009736 in turn does look likte the "PIL freeze bug...
So now I'm still confused, but on I higher level.
Could maybe someone build a scribus-ng with the "proposed fix" form ubuntu I would gladly try if it solves "my" script-hang.
Thank you very much for any help it is greatly appreciated!



2011-03-08 05:30

reporter   ~0025760

FWIW, I have attached a bt to the failed running of a script by Gregory Pittman.

The script is at the top of the bt


2011-03-08 05:31


9559Notes.txt (7,138 bytes)

#!/usr/bin/env python
# -*- coding: utf-8  -*-

    import scribus
except ImportError:
    print "Unable to import the 'scribus' module. This script will only run within"
    print "the Python interpreter embedded in Scribus. Try Script->Execute Script."
    from PIL import Image
except ImportError:
    result = scribus.messageBox('PIL Error','Cannot import PIL',scribus.ICON_ERROR)

imageload = scribus.fileDialog('Load image','Images(*.jpg *.png *.tif *.JPG *.PNG *.jpeg *.JPEG *.TIF)',haspreview=1)
im = 
xsize, ysize = im.size
result = scribus.messageBox('Information about your image', 'width = ' + str(xsize) + ', ' + 'height = ' + str(ysize), scribus.BUTTON_OK)


[owen@localhost scribus140-build]$ gdb /opt/scribus140/bin/scribus-1.4.0.svn 
GNU gdb (GDB) Fedora (7.2-45.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /opt/scribus140/bin/scribus-1.4.0.svn...done.
(gdb) run
Starting program: /opt/scribus140/bin/scribus-1.4.0.svn 
[Thread debugging using libthread_db enabled]
[New Thread 0xb7d8eb70 (LWP 10444)]
[New Thread 0xb723bb70 (LWP 10445)]
Detaching after fork from child process 10446.
Detaching after fork from child process 10447.
Detaching after fork from child process 10448.
Detaching after fork from child process 10449.
Detaching after fork from child process 10450.
[New Thread 0xb68ffb70 (LWP 10451)]
[New Thread 0xb5effb70 (LWP 10452)]
[Thread 0xb68ffb70 (LWP 10451) exited]
[Thread 0xb5effb70 (LWP 10452) exited]
[New Thread 0xb5effb70 (LWP 10453)]
[New Thread 0xb68ffb70 (LWP 10454)]
[New Thread 0xb56feb70 (LWP 10455)]
[New Thread 0xb4efdb70 (LWP 10456)]
[Thread 0xb56feb70 (LWP 10455) exited]
[Thread 0xb4efdb70 (LWP 10456) exited]
Program received signal SIGINT, Interrupt.
0x00110416 in __kernel_vsyscall ()
Missing separate debuginfos, use: debuginfo-install GConf2-2.31.91-1.fc14.i686 ORBit2-2.14.19-1.fc14.i686 OpenEXR-libs-1.7.0-1.fc14.i686 aspell-0.60.6-12.fc14.i686 avahi-libs-0.6.27-2.fc14.i686 bzip2-libs-1.0.6-1.fc14.1.i686 cairo-1.10.2-1.fc14.i686 cups-libs-1.4.6-1.fc14.i686 dbus-libs-1.4.0-2.fc14.i686 expat-2.0.1-10.fc13.i686 fontconfig-2.8.0-2.fc14.i686 freetype-2.4.2-4.fc14.i686 gamin-0.1.10-8.fc14.i686 glib2-2.26.0-2.fc14.i686 glibc-2.13-1.i686 gnutls-2.8.6-2.fc14.i686 hyphen-2.5-2.fc14.i686 ilmbase-1.0.2-2.fc14.i686 jasper-libs-1.900.1-16.fc14.i686 kdelibs-4.5.5-1.fc14.i686 keyutils-libs-1.2-6.fc12.i686 krb5-libs-1.8.2-8.fc14.i686 lcms-libs-1.19-2.fc14.i686 libICE-1.0.6-2.fc13.i686 libSM-1.1.0-7.fc12.i686 libX11-1.3.4-3.fc14.i686 libXau-1.0.6-1.fc14.i686 libXcursor-1.1.10-5.fc14.i686 libXext-1.1.2-2.fc14.i686 libXfixes-4.0.5-1.fc14.i686 libXi-1.3.2-1.fc14.i686 libXinerama-1.1-2.fc13.i686 libXrandr-1.3.0-5.fc13.i686 libXrender-0.9.6-1.fc14.i686 libcom_err-1.41.12-6.fc14.i686 libffi-3.0.9-1.fc13.i686 libgcc-4.5.1-4.fc14.i686 libgcrypt-1.4.5-4.fc13.i686 libgpg-error-1.9-1.fc14.i686 libjpeg-turbo-1.0.1-1.fc14.1.i686 libmng-1.0.10-4.fc12.i686 libpng-1.2.44-1.fc14.i686 libselinux-2.0.96-6.fc14.1.i686 libstdc++-4.5.1-4.fc14.i686 libtasn1-2.7-1.fc14.i686 libtiff-3.9.4-3.fc14.i686 libuuid-2.18-4.8.fc14.i686 libxcb-1.7-1.fc14.i686 libxml2-2.7.7-2.fc14.i686 nss-softokn-freebl-3.12.9-5.fc14.i686 openssl-1.0.0d-1.fc14.i686 pixman-0.18.4-1.fc14.i686 podofo-libs-0.8.1-2.fc14.i686 python-2.7-8.fc14.1.i686 python-imaging-1.1.7-2.fc14.i686 python-libs-2.7-8.fc14.1.i686 qt-4.7.1-17.fc14.i686 qt-x11-4.7.1-17.fc14.i686 xz-libs-4.999.9-0.2.beta.20100401git.fc14.i686 zlib-1.2.5-2.fc14.i686
(gdb) bt
#0  0x00110416 in __kernel_vsyscall ()
#1  0x006a0765 in sem_wait@@GLIBC_2.1 () from /lib/
#2  0x002114c8 in PyThread_acquire_lock () from /usr/lib/
#3  0x001dcec9 in PyEval_RestoreThread () from /usr/lib/
#4  0x014d3d94 in ScripterCore::slotRunScriptFile (this=0x8e16ce8, fileName=..., inMainInterpreter=false)
    at /home/owen/Builds/scribus140/scribus/plugins/scriptplugin/scriptercore.cpp:372
#5  0x014d2e61 in ScripterCore::runScriptDialog (this=0x8e16ce8) at /home/owen/Builds/scribus140/scribus/plugins/scriptplugin/scriptercore.cpp:217
#6  0x014e01dc in ScripterCore::qt_metacall (this=0x8e16ce8, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbfffe1d8)
    at /home/owen/Builds/scribus140-build/scribus/plugins/scriptplugin/moc_scriptercore.cxx:100
#7  0x05ab5beb in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/
#8  0x05ac50c7 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/
#9  0x069c8fca in QAction::triggered(bool) () from /usr/lib/
#10 0x069c924b in QAction::activate(QAction::ActionEvent) () from /usr/lib/
#11 0x06e68c6d in ?? () from /usr/lib/
#12 0x06e6f7c3 in ?? () from /usr/lib/
#13 0x06e706ae in QMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/
#14 0x06a2985b in QWidget::event(QEvent*) () from /usr/lib/
#15 0x06e70b77 in QMenu::event(QEvent*) () from /usr/lib/
#16 0x069d026c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/
#17 0x069d588d in QApplication::notify(QObject*, QEvent*) () from /usr/lib/
#18 0x05aaf3b3 in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/
#19 0x069d11f8 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/
#20 0x06a5a72c in ?? () from /usr/lib/
#21 0x06a58957 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/
#22 0x06a83790 in ?? () from /usr/lib/
#23 0x00ae0192 in g_main_context_dispatch () from /lib/
#24 0x00ae0978 in ?? () from /lib/
#25 0x00ae0c35 in g_main_context_iteration () from /lib/
#26 0x05add0ad in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/
#27 0x06a83406 in ?? () from /usr/lib/
#28 0x05aae54a in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/
#29 0x05aae7fa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/
#30 0x05ab33a7 in QCoreApplication::exec() () from /usr/lib/
#31 0x069ce078 in QApplication::exec() () from /usr/lib/
#32 0x08981b19 in mainApp (argc=1, argv=0xbffff2f4) at /home/owen/Builds/scribus140/scribus/main_nix.cpp:84
#33 0x08981a9f in main (argc=1, argv=0xbffff2f4) at /home/owen/Builds/scribus140/scribus/main_nix.cpp:52

9559Notes.txt (7,138 bytes)


2011-03-08 07:41

administrator   ~0025761

This change has no effect on the related bug.. tested here myself. The change seems sound but I don't know about embedding Python into apps myself. Anyone know of other apps and what they call for the path setup?


2011-03-08 11:10

administrator   ~0025765

- cm += QString("sys.path[0] = \"%1\"\n").arg(escapedAbsPath);
+ cm += QString("sys.path.insert(0, \"%1\")\n").arg(escapedAbsPath);

was applied as a part of r16430.. do we want that or not?


2016-12-16 16:56

manager   ~0043066

@gpittman what's the state of this issue?


2016-12-16 19:40

developer   ~0043067

I don't know if I understand what the original issue was.
I can run the little scriptling that's in the notes - all it does is give feedback about an image's size. No errors occurred.

Issue History

Date Modified Username Field Change
2010-12-06 13:19 ale New Issue
2011-02-28 13:15 user0 Note Added: 0025678
2011-02-28 18:09 cbradney Note Added: 0025682
2011-03-01 08:33 user0 Note Added: 0025689
2011-03-08 05:30 owencook Note Added: 0025760
2011-03-08 05:31 owencook File Added: 9559Notes.txt
2011-03-08 07:41 cbradney Note Added: 0025761
2011-03-08 11:10 cbradney Note Added: 0025765
2016-12-16 16:56 Kunda Note Added: 0043066
2016-12-16 16:56 Kunda Tag Attached: #pending
2016-12-16 19:40 gpittman Note Added: 0043067