[Scribus] Mass-export with Python file name problem

Magyar Bálint magyarbalint
Wed Mar 7 10:00:06 CET 2007


Greetings!

Hi, I'm new to this list. My problem seems fairly simple, although it 
might be cause by an actual bug. If that turns out to be the case, I'll 
submit it into the tracker.

I have the following code injected into main() of boilerplate.py:

     """Reads all files from specified directory and exports them to PDF."""
     dir = 'Z:\\directory_i_want_to_have_everything_exported_from\\'
     filelist = os.listdir(dir)
     for j in enumerate(filelist):
         scribus.openDoc(dir + j[1])
         # snip miscellaneous PDF attributes
         scribus.PDFfile().file = dir + j[1][:-6] + "pdf"
         print dir + j[1][:-6] + "pdf"
         scribus.PDFfile().save()
         scribus.closeDoc()

The problem is the following: The files in the dir have multiple dots in 
them, instead of only for the extension. Now, that print line gives me 
the correct filenames, but Scribus only includes the part before the 
first dot into the filename. So if the original was 
many.dots.be.here.sla.gz, I get many.pdf. Is it something I'm missing 
from my code? Note that if I File -> Save as... a Scribus document that 
has multiple dots in the name, the save dialog only puts the part before 
the first dot into the File name field, so it might be a bug. Any 
suggestions?

Thanks in advance,

B?lint Magyar
jegHegy at IRC

PS: Feel free to lecture me on my code, I've only started dabbling with 
Python.



More information about the scribus mailing list