[Scribus] Differences between startup script and regular script

Yegor Jbanov yegor.jbanov
Fri Dec 7 07:28:37 CET 2007


What is the difference between running a Scripter script during
startup and running the same script using the Script menu?

I am running Scribus on Ubuntu 7.04, GhostScript 8.15.4.

I wrote a script which embeds a simple HTTP server into Scribus
(BaseHTTPServer provided with standard Python). When I run it from the
menu it works. I can access the server from the browser and the server
can access Scribus API and generate output from my documents.

When I run it as a startup script Scribus crashes with a message
"Scribus crashes due to Signal #11" upon the first HTTP request from
the browser.

Here's the console output:

Scribus Crash
Scribus crashes due to Signal #11
Calling Emergency Save
Saving: /tmp/scribus-server/serverpI2QPI/processors/invProc/invoice.sla.emergency
Segmentation fault (core dumped)

(remind me again where does the core gets dumped so I could analyze it?)

I am not sure where exactly it crashes in my Python code. I will
investigate further. As you see it tries to save the document I open
for this particular HTTP request, so it must be somewhere after the
document is opened. I suspect it has something to do with PDF export.
(BTW, don't pay attention to the /tmp/scribus-server/... folders.
These have nothing to do with Scribus. I create these myself.)

Here's the piece of code I am running (note again, it works when I run
it manually from the menu):

        # Location of the current sources
        (srcLocation, scriptFile) = os.path.split(__file__)

        # Open Scribus document
        scribus.openDoc(srcLocation + '/invoice.sla')

        # Save as PDF first
        pdfFilePath = workDir + '/invoice.pdf'
        pdf = scribus.PDFfile()
        pdf.file = pdfFilePath

        # Package up the result into a deliverable file
        if (isPreview):
            # Convert PDF to PPM
            ppmFilePref = workDir + '/invoice'
            ppmCommand = 'pdftoppm -f 1 -l 1 ' + pdfFilePath + ' ' + ppmFilePref
            # Convert PPM to JPG
            Image.open(ppmFilePref + '-000001.ppm').save(resultFile)
            # Zip the contents into the resultFile
            archive = zipfile.ZipFile(resultFile, 'w')

        # Close Scribus template document

Any pointers will be appreciated.



More information about the scribus mailing list