[scribus] problems with the Scripter

Gregory Pittman gregp_ky at yahoo.com
Sat Jul 9 23:44:17 UTC 2011

On 07/09/2011 02:02 PM, wibr wrote:
> Hi all,
> while writing my first lines using the scripter API some things came up:
> 1. it would be nice if the version of python, which is used by the
> scripter, appears somewhere in the documentation
Not sure what system you're using, but in my Fedora Linux I just run

rpm -q python

Scribus uses whatever is on your system (though I think maybe it is 
included in the Windows builds).

> 2. can I somehow use "print" in my scripts / see the output of that? It
> would be convenient for debugging, now I use messageBoxes, but a simple
> print would be better. I tried to use the integrated console, but it had
> some problems with my indentations. (worked fine without console, though)

for me, the advantage a messageBox is that it doesn't kill the script, 
and I get feedback, click Ok to resume.
If I were doing it a lot in a given script, I might turn the message 
into a function I could call repeatedly if needed. If I wanted something 
I could just review later, I would create a list, then append to the 
list and save to a file. You could alternatively make a function that 
would create a text frame (which might even be outside the borders of 
the page) and put your message in there, then delete the frame from the 
document after you get what you need.
> 4. Now the problem why I got stuck:
> At some point of my script I have something like this:
> scribus.gotoPage(pageCounter)
> for oneItem in scribus.getPageItems():
> if oneItem[1] == 4: # 4 = Textfield
> test1=oneItem[0]+' '+str(pageCounter # it e.g. 'Text50 3'
> test2=scribus.getText(oneItem[0])# empty! but it's not!
> So I don't know why the getText would return an empty string, since
> there is definitely some Text in this text field. (I checked manually
> after the script was done)

Have a look at


which in part does a similar thing.
As I look your fragment here, there may be a problem with this line
for oneItem in scribus.getPageItems():

you might try an intermediary variable to collect the item names, like this:

d = scribus.getPageItems()
for oneItem in d:

In my script, I used getAllText() and I know that works, so you might 
try that too, even though I don't know why getText() shouldn't work.


More information about the scribus mailing list