[scribus] PDFfile causes looping to fail?

Jerry Stratton scribusjerry at hoboes.com
Tue Feb 26 10:58:41 UTC 2019


I have the following script that I have simplified down to the basics:

----------------------
import scribus

countDown = ['three', 'two', 'one']

#scribus.PDFfile()
for counter in countDown:
	scribus.messageBox('Countdown', counter)
----------------------

If I run it with scribus.PDFfile commented out, as above, it pops up a window for “three”, “two”, “one” as I expect. If I uncomment the scribus.PDFfile() line, however, I get the countdown, but after the final item I also get this error:

Traceback (most recent call last):
 File "<string>", line 8, in <module>
 File "/Users/jerry/bin/Scribus/testPDF.py", line 6, in <module>
   for counter in countDown:
IndexError: list assignment index out of range

The error appears to show up whenever a list is looped through; for example, os.path.join will fail with the same error:

----------------------
import scribus

scribus.PDFfile()
os.path.join('/Users/', 'fred.pdf')
----------------------

Produces:

Traceback (most recent call last):
 File "<string>", line 8, in <module>
 File "/Users/jerry/bin/Scribus/testPDF.py", line 4, in <module>
   os.path.join('/Users/', 'fred.pdf')
 File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.7/posixpath.py", line 67, in join
   for b in p:
IndexError: list assignment index out of range

I did a Google search on lists.scribus.info for “list assignment index out of range” and only found an unfinished discussion back in 2009.

Am I doing something wrong?

Currently I’m getting around it by not using os.path.join to create paths after calling PDFfile(), using string concatenation instead; and checking inside the loop if the loop variable is currently equal to the end variable,  breaking out if so. But that only works for unique lists, of course.

I am using Scribus 1.4.7 (Build ID: C-C-T-F-C1.14.12-Mac/Aqua) on macOS 10.14.3.

Jerry


More information about the scribus mailing list