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

Peter von Kaehne refdoc at gmx.net
Thu Oct 11 07:40:59 MST 2012


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

 



More information about the sword-devel mailing list