Discussion:
[Docutils-users] LaTeX writer crash
Mikołaj Machowski
2015-07-21 08:17:58 UTC
Permalink
Below traceback, OS info and docutils version. HTML export works without problems. Note that I have long list of empty (so far) hyperlinks - maybe that is the cause?

File itself in attachment. Command
rst2latex.py 01.txt 01.tex

Traceback (most recent call last):
File "/usr/bin/rst2latex.py", line 26, in <module>
publish_cmdline(writer_name='latex', description=description)
File "/usr/lib/python2.7/site-packages/docutils/core.py", line 352, in publish_cmdline
config_section=config_section, enable_exit_status=enable_exit_status)
File "/usr/lib/python2.7/site-packages/docutils/core.py", line 219, in publish
output = self.writer.write(self.document, self.destination)
File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write
self.translate()
File "/usr/lib/python2.7/site-packages/docutils/writers/latex2e/__init__.py", line 246, in translate
self.document.walkabout(visitor)
File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 166, in walkabout
visitor.dispatch_visit(self)
File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1882, in dispatch_visit
return method(node)
File "/usr/lib/python2.7/site-packages/docutils/writers/latex2e/__init__.py", line 2176, in visit_footnote
num,text = node.astext().split(None,1)
ValueError: need more than 1 value to unpack
[/home/mmachowski/pauzaniasz-w-mnw/tekst] % uname -a
CYGWIN_NT-6.1 dokfoto_MM 2.0.4(0.287/5/3) 2015-06-09 12:22 x86_64 Cygwin
[/home/mmachowski/pauzaniasz-w-mnw/tekst] % rst2latex.py --version
rst2latex.py (Docutils 0.12 [release], Python 2.7.10, on cygwin)

ps. Wonder if it comes through since sf is down.
Guenter Milde
2015-08-05 10:26:53 UTC
Permalink
Dear Mikołaj,

thank you for the bug report.
Post by Mikołaj Machowski
Below traceback, OS info and docutils version. HTML export works
without problems.
I get 160 errors of type

/tmp/01.txt:28: (ERROR/3) Unknown target name: "02.08.06".

here.
Post by Mikołaj Machowski
Note that I have long list of empty (so far)
hyperlinks - maybe that is the cause?
No. A minimal example for the problematic input is::

Epiroci zaprosili na tron Alketasa [180]_, ...

.. [180] R. 312

which produces the pseudo-XML::

<document source="/tmp/test02.rst">
<paragraph>
Epiroci zaprosili na tron Alketasa
<footnote_reference ids="id1" refid="id2">
180
, …
<footnote backrefs="id1" ids="id2" names="180">
<label>
180
<enumerated_list enumtype="upperalpha" prefix="" start="18" suffix=".">
<list_item>
<paragraph>
312

i.e. The text R. 312 is parsed as the first item of an enumerated list,
which is surely not what you intended and looks strange in HTML, too.
see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#enumerated-lists

You can avoid this by escaping::

Epiroci zaprosili na tron Alketasa [180]_, ...

.. [180] \R. 312


However, for footnotes that start with anything that is not a paragraph,
the problem remains:

...
Post by Mikołaj Machowski
File "/usr/lib/python2.7/site-packages/docutils/writers/latex2e/__init__.py", line 2176, in visit_footnote
num,text = node.astext().split(None,1)
ValueError: need more than 1 value to unpack
I changed the code to be more stable for these cases, found a follow-up bug
and fixed as well and will upload the fix to the repository soon.

Thanks,

Günter


------------------------------------------------------------------------------
Guenter Milde
2015-08-12 15:24:50 UTC
Permalink
Post by Guenter Milde
Post by Mikołaj Machowski
File "/usr/lib/python2.7/site-packages/docutils/writers/latex2e/__init__.py", line 2176, in visit_footnote
num,text = node.astext().split(None,1)
ValueError: need more than 1 value to unpack
I changed the code to be more stable for these cases, found a follow-up bug
and fixed as well and will upload the fix to the repository soon.
It should work now with revision 7904 of the SVN repository.
http://sourceforge.net/p/docutils/code/7904/

Günter


------------------------------------------------------------------------------
Mikołaj Machowski
2015-08-16 18:59:18 UTC
Permalink
Thank you very much Guenter :)
Both for fix and debugging of my document.

With kind regards,

Mikolaj

Loading...