[scribus] PDFfile causes looping to fail?
Gregory Pittman
gpittman at iglou.com
Tue Feb 26 18:33:21 UTC 2019
On 2/26/19 12:52 PM, Jerry Stratton wrote:
> On Feb 26, 2019, at 8:38 AM, Gregory Pittman <gpittman at iglou.com> wrote:
>> This isn't the way to use scribus.PDFfile(). I'm not sure if it's in the 1.4.7 documentation, but at least in 1.5.x, if you look under PDF Export from the menu, there is an explanation of the user of PDFfile() at the bottom:
>>
>> pdf = scribus.PDFfile()
>> pdf.file = 'MyFile.pdf'
>> pdf.save()
>>
>> scribus.PDFfile() creates a class which you can then do further actions on.
>
> Yes, thanks. But I’m aware of that (1.4.7 does include PDFfile documentation). My problem is not with using PDFfile to save, but with using PDFfile making loops on lists fail. That’s what the simplified script is meant to show. Why does calling PDFfile cause looping on lists to fail? It means not being able to use os.path.join because os.path.join loops on a list. It also means having to detect the end of a list in a for… in… loop and manually break from it, or the script will also fail; in each case calling PDFfile causes a “list assignment index out of range error” when looping on lists after the call.
>
> If you’d like, you can use this less simple script:
>
> import scribus
>
> countDown = ['three', 'two', 'one']
>
> pdf = scribus.PDFfile()
> pdf.file = 'MyFile.pdf'
> pdf.save()
>
> for counter in countDown:
> scribus.messageBox('Countdown', counter)
>
> For me, this still results in:
>
I find that this works in 1.5.8svn, so perhaps the thing to do is upgrade your Scribus version. Have you tried adding more parameters to the messageBox() command? It seems the problem has something to do with it. Not sure why you want to make 3 messageBoxes on top of each other.
Greg
More information about the scribus
mailing list