[sword-devel] usfm2osis.py and tag \cp

Chris Little chrislit at crosswire.org
Thu Oct 11 10:40:22 MST 2012


I hope I've fixed this now. (I haven't tested that it functions 
correctly, but the error was fairly obvious from the traceback below.)

The application will almost always need Ctrl-C to break out because of 
the multithreading (and because I haven't bothered to add much exception 
handling).

--Chris

On 10/11/2012 07:40 AM, Peter von Kaehne wrote:
> The USFM \cp tag (used for chapter markers different from those of the used versification) crashes usfm2osis.py reliably. The programme needs a Ctrl-C interrupt to get out of its state.
>
> Following minimal USFM code creates below attached error message.
>
> \id EST
> \h ESTER
> \c 1
> \cp A
> \s En Mordekai eh Ouraman
> \p
> \v 1 Mordekai,
>
> ---------------------
>
>
> peter at AOA110:~/Bibles/Pohnpeian/apo_usfm/Pohnapo$ usfm2osis.py Pohnester 17ESTpohn.SFM.bak
> Sorting book files naturally.
> Process Worker-2:
> Traceback (most recent call last):
>    File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
>      self.run()
>    File "/usr/local/bin/usfm2osis.py", line 1440, in run
>      osis = convertToOsis(job)
>    File "/usr/local/bin/usfm2osis.py", line 1321, in convertToOsis
>      osis = cvtChaptersAndVerses(osis, relaxedConformance)
>    File "/usr/local/bin/usfm2osis.py", line 640, in cvtChaptersAndVerses
>      osis = re.sub(r'(<chapter [^<]+sID[^<]+/>.+?<chapter eID[^>]+/>)', replaceChapterNumber, osis, flags=re.DOTALL)
>    File "/usr/lib/python2.7/re.py", line 151, in sub
>      return _compile(pattern, flags).sub(repl, string, count)
>    File "/usr/local/bin/usfm2osis.py", line 633, in replaceChapterNumber
>      ctext = re.sub(r'"\$BOOK\$\.([^"\.]+)"', '"$BOOK$.'+ca+'"', ctext)
> UnboundLocalError: local variable 'ca' referenced before assignment
>
> ^CTraceback (most recent call last):
>    File "/usr/local/bin/usfm2osis.py", line 1557, in <module>
>      k,v=result_queue.get()
>    File "/usr/lib/python2.7/multiprocessing/queues.py", line 117, in get
>      res = self._recv()
> KeyboardInterrupt
>
>
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
>




More information about the sword-devel mailing list