[scribus] while loop in python script crashes scribus

a.l.e ale.comp_06 at xox.ch
Fri Jan 30 13:47:38 CET 2009


hi chantal
>     TextFile = open('/home/chantal/scribus/wiki.txt', 'r')
>     while 1:
>         info = TextFile.readline()
>         if not info: break
>         if info != '\n':
>             Add = Add + info
>         else:
> 		#maak textbox
> 		TextBox = scribus.createText(60, VerticalPosition, Width, Height)
> 		VerticalPosition=VerticalPosition+VerticalMarge+Height
> 		#vul de textbox
> 		scribus.setText(Add, TextBox)
> 		#check of alles wel past
> 		OverflowChar = scribus.textOverflows(TextBox)
> 		while OverflowChar > 0:
> 			Height=Height+100
> 			sizeObject(Width,Height,TextBox)
> 			OverflowChar = scribus.textOverflows(TextBox)
>   
not sure if i got it right (can't try the script atm... i could do it 
tomorrow...) but:

i think you're not doing what you're thinking you're doing :-)

here yo are reading the text line by line and if the line is empty (are 
you sure that '\n' is the end of line character? in most languages you 
have to use "\n" (with double quotes)), set the text as the snippet read 
up to now minus the empty lines.
you won't add the last lines before EOF since you will break into




More information about the scribus mailing list