[Scribus] Old Python Script Crashing

Henry Hartley henryhartley
Wed Dec 5 15:33:45 CET 2007

A few years ago (2004, to be precise) I wrote, with some advice from
this list, a script that generated a calendar in Scribus.  As the year
draws to a close, I was thinking I might create a calendar for next year
so I pulled out the script and tried to run it in a more recent Scribus
but it won't run.

I have Scribus 1.3.4 on Windows XP and Python 2.5.  I found and fixed a
number of problems with the script.  I have in the code, I bunch of
places where objects, either Image or Text, are created and then
appended to an Objects collection.  Please excuse me if I use the wrong
terms but I don't really know Python -- Perl and PHP are more my thing.
Anyway, take these four lines of code:

  ob = createImage(Xmgn, Ymgn, dayw*7, ImgHt, "Image" + str(Mn))
  ob = createText(Xmgn, 2*Ymgn+ImgHt, dayw*7, TextHt, "Text" + str(Mn))

The third line, where I try to create the text object causes an error
that identifies that line and says:

  NameExistsError: An object with the requested name already exists.

What is odd is this script used to run.  I thought this was due to a
change in Python but when I searched on "NameExistsError" the first
thing I found was on the Scribus site.  

I had assumed it was the existence of "ob" that was the problem.  The
page I found, which says I'll get this error makes it sound like it's
the "Text"+str(Mn) that's being reused, not ob.  Is that right?  But Mn
is the month and it is incremented between each use so it shouldn't be
the same twice.

Any advice would be appreciated.  If you need to see more code to be
able to help, I'd be happy to provide it.


More information about the scribus mailing list