[scribus] PDFfile causes looping to fail?

ZASKE Martin zm at revue-gugu.org
Tue Feb 26 22:31:16 UTC 2019


I tested your actual script from your last mail on my Scribus 1.5.4
(Windows 10) and got your exact error message.

My python editor had pointed out a wrong quote-character at the end of
your message box (line 35). When I corrected to a normal " the error was
gone. Hope this helps.


This is the line, note the ending quotes are different:
 	scribus.messageBox("No Open Document", "You need to have a document
open to save it as PDF.”)




Martin


On 26.02.2019 20:48, Jerry Stratton wrote:
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> 
> import scribus
> import os
> 
> #don't do anything unless there's a document open
> if scribus.haveDoc():
> 	#get the folder to save to
> 	saveTo = scribus.fileDialog('Folder to save characters to:', isdir=True, issave=True)
> 
> 	if saveTo:
> 		#deselect, or it will only print the current selection
> 		scribus.deselectAll()
> 		layers = scribus.getLayers()
> 		
> 		#first, make sure only the background is set to print
> 		for layer in layers:
> 			if layer == 'Background':
> 				scribus.setLayerPrintable(layer, True)
> 			else:
> 				scribus.setLayerPrintable(layer, False)
> 
> 		#now, go through each non-background layer and export as PDF
> 		exporter = scribus.PDFfile()
> 		for layer in layers:
> 			if layer != 'Background':
> 				scribus.setLayerPrintable(layer, True)
> 				filePath = os.path.join(saveTo, layer + '.pdf')
> 				exporter.file = filePath
> 				exporter.save()
> 				scribus.setLayerPrintable(layer, False)
> 
> else:
> 	scribus.messageBox("No Open Document", "You need to have a document open to save it as PDF.”)




-- 
ZASKE Martin
responsable GʊGʊ
BP 50 - Bassila - Bénin
tel GʊGʊ 66.66.11.11
tel pers 97.44.62.95



More information about the scribus mailing list