Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurred while converting text from LaTeX to SVG #10

Closed
DanielBiskup opened this issue Mar 21, 2018 · 10 comments
Closed

Error occurred while converting text from LaTeX to SVG #10

DanielBiskup opened this issue Mar 21, 2018 · 10 comments
Assignees
Labels
bug Something isn't working Workaround available This is essentially a bug but a workaround is available which might be used until a fix is provided.
Milestone

Comments

@DanielBiskup
Copy link

I have installed
Inkscape 0.92.1 r15371
ghostscript 9.06
pstoedit 3.62

When type something in the textext gui and click "preview" I get a preview as expected. When I click "save" a window with the heading "Error occurred while converting text from LaTeX to SVG:" opens, containing the following message:
u'{http://www.inkscape.org/namespaces/inkscape}version' Traceback (most recent call last): File "/home/boris/.config/inkscape/extensions/asktext.py", line 491, in cb_ok self.callback(self.text, self.preamble_file, self.global_scale_factor) File "textext.py", line 224, in <lambda> old_node), File "textext.py", line 337, in do_convert self.document.getroot().attrib['{%s}version' % inkex.NSS["inkscape"]].split(' ')[0]).encode('string-escape') File "lxml.etree.pyx", line 2355, in lxml.etree._Attrib.__getitem__ (src/lxml/lxml.etree.c:62354) KeyError: u'{http://www.inkscape.org/namespaces/inkscape}version'

@leberwurstsaft
Copy link
Collaborator

Is this in a new document or an old one?

@jcwinkler
Copy link
Member

I confirm this error. Strange. Will investigate this evening. Please stay tuned!

@jcwinkler jcwinkler added the bug Something isn't working label Mar 21, 2018
@toktan
Copy link

toktan commented Mar 25, 2018

I wished to install TeXtext with inkscape and texlive. I installed the followings in order using installers with default setting. 1) Inkscape 0.92.2.exe (Python 2.7 interpreter checked) 2) TexText-Windows-0.7.1.exe
3)Install-PyGTK-2.24-Inkscape-0.92.2-64bit.exe 4)pstoeditsetup_x64.exe(.h,.lib, as well as plugins SVG,…checked) 5)ImageMagick-6.9.9-39-Q16-x64-static.exe(ImageMagick-6.9.7-x-Q16-x64-static.exe can no longer obtained from ftp://ftp.imagemagick.org/pub/ImageMagick/ and I could only get ImageMagick-6.9.7-10.zip from there.) 6) gs920w64.exe The result is the same with Boris; Preview ok but error in svg save. The message is :u'{http://www.inkscape.org/namespaces/inkscape}version'
Traceback (most recent call last):
File "asktext.py", line 491, in cb_ok
self.callback(self.text, self.preamble_file, self.global_scale_factor)
File "textext.py", line 224, in
old_node),
File "textext.py", line 337, in do_convert
self.document.getroot().attrib['{%s}version' % inkex.NSS["inkscape"]].split(' ')[0]).encode('string-escape')
File "src/lxml/lxml.etree.pyx", line 2467, in lxml.etree._Attrib.getitem (src/lxml/lxml.etree.c:70679)
KeyError: u'{http://www.inkscape.org/namespaces/inkscape}version'
If this information is a duplicate annoyance please accept my apology. TeXText is wonderful tool for me to write figures for a physics paper and I have quit portable version after switching to texlive. Thank you.

@oedfors
Copy link

oedfors commented Mar 27, 2018

I have the same issue, but only on one of my two computers/systems. Both have the same setup (as far as I know), but there is obviously some difference between them ... both running Antergos Linux and textext works just fine on one of them. Is there anything I can do to help out with the debugging (maybe compare something between my two systems)?

@sizmailov
Copy link
Collaborator

It seems that error occurs only for new documents, specifically script fails to extract inkscape version out of non-existing file:

textext/textext.py

Lines 336 to 337 in 4b4de50

new_node.attrib['{%s}inkscapeversion' % TEXTEXT_NS] = (
self.document.getroot().attrib['{%s}version' % inkex.NSS["inkscape"]].split(' ')[0]).encode('string-escape')

I'm not sure what is the real purpose of storing inkscape version, but commenting those two lines out fixes problem for me.

An obvious workaround is to save document before using this plugin.

@jcwinkler
Copy link
Member

@sizmailov is right, the problem is the version attribute that TexText stores into its freshly created node. The reason for doing so is that we want to know with which version of Inkscape the node has been created with. History has been shown that it helps when processing nodes which have been created in older versions of Inkscape, e.g. if something has been changed in Inkscape.

Now, the problem is the following: If a node is created in an Inkscape document that has not been yet saved (i.e. a new document), then the inkscape version attribute (i.e. inkscape:version="0.92.2 (5c3e80d, 2017-08-06)") is not avaible in the svg node passed to Textext. In nodes that have already been saved once it is.

I failed to find this error during my testing and obviously I have been working with already saved documents the last weeks only...

Workaround: Save the document once before you begin editing with TexText.

I will provide a patch the next days.

@jcwinkler jcwinkler self-assigned this Mar 27, 2018
@jcwinkler jcwinkler added the Workaround available This is essentially a bug but a workaround is available which might be used until a fix is provided. label Mar 27, 2018
@jcwinkler jcwinkler added this to the 0.7.2 milestone Mar 27, 2018
jcwinkler added a commit to jcwinkler/textext that referenced this issue Mar 27, 2018
Fixes textext#10 "Error occurred while converting text from LaTeX to SVG"

Unfortunately when a node processed by TexText comes from an Inkscape
document that has never been saved before no version attribute is
provided by Inkscape. The corresponding call to the key fails. In these
cases no version attribute is stored in the TexText node. It is not
ideal but currently I do not see any other solution. Completely ommiting
this piece of information is not an option in my opinion. We should grab
what can be grabbed.
@jcwinkler
Copy link
Member

I provided a fix in the master branch of my fork of the project. You need to replace your textext.py by the one from the branch (make a backup copy first!). Seems to work at a first glance here, but needs more thorough testing, of course. Will provide a pull-request as far as testing is finished.

@toktan
Copy link

toktan commented Mar 27, 2018 via email

@manoloula
Copy link

Error ocurred while converting text from Latex to svg
[Error 5] Acceso denegado: 'c:\users\yasmely\appdata\local\temp\tmpxw0dsqtextext_'

Alguien que me pueda orientar

@manoloula
Copy link

manoloula commented May 4, 2020

error Inkscape Latex

Se produjo un error al convertir el texto de Latex a svg
[Error 5] Acceso denegado: 'c: \ users \ yasmely \ appdata \ local \ temp \ tmpxw0dsqtextext_'

Alguien que me pueda orientar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Workaround available This is essentially a bug but a workaround is available which might be used until a fix is provided.
Projects
None yet
Development

No branches or pull requests

7 participants