[scribus] getAllText Sometimes Failing

Gregory Pittman gpittman at iglou.com
Thu Mar 4 13:32:38 UTC 2021


On 3/3/21 8:38 PM, Matt Miller wrote:
> I've attached a test case that seems to show that getAllText() is sometimes succeeding and sometimes failing. When it fails it doesn't throw an error, but it just retrieves a string of length 1, instead of retrieving the actual text of the chain. I see this on 1.5.6.1 and 1.5.7.svn, in both Linux and Windows.
> 
> To run the test open the .sla and from the script menu execute chapter_heading_style.py.  The text frame name "debug" at the very top will contain the word "Error" if the getAllText() call in the script fails.  What I see is that it works fine the first time, then it fails on every subsequent try, until I alter something on the document.  For example, if I grab and move the "debug" text frame a bit then getAllText() will succeed once, and then fail repeatedly again.  Saving and reopening the document also causes the script to work again the first time.
> 
> Thanks.
> 
> 
> --
> 
>   Matt Miller
>   mailto:matt.miller at fastmail.com
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.scribus.net/pipermail/scribus/attachments/20210303/83076fa0/attachment.htm>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 7.25x9-Wide-Margin-Self-Pronouning_Mal.sla
> Type: application/octet-stream
> Size: 83787 bytes
> Desc: not available
> URL: <http://lists.scribus.net/pipermail/scribus/attachments/20210303/83076fa0/attachment.obj>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: chapter_heading_style.py
> Type: application/octet-stream
> Size: 3084 bytes
> Desc: not available
> URL: <http://lists.scribus.net/pipermail/scribus/attachments/20210303/83076fa0/attachment-0001.obj>

Hi Matt,

I have a hard time trying to figure out what you're trying to do with this script. Somewhere in your Scribus installation there should be a folder named samples.
On my Linux (Fedora), it's in /usr/share/scribus. Inside samples is a script named ExtractText.py, which uses getAllText() to collect all the text from a document and save it in a text file. This still works in 1.5.x.

Greg




More information about the scribus mailing list