Fixing textext on Inkscape 0.48
I encounter one problem today. My textext didn’t work on Inkscape 0.48, I get the error
textext.py:55: DeprecationWarning: the md5 module is deprecated; use hashlib instead import os, sys, tempfile, traceback, glob, re, md5, copy
Traceback (most recent call last): File "textext.py", line 306, in <module>
raise RuntimeError("Neither pygtk nor Tkinter is available!")
RuntimeError: Neither pygtk nor Tkinter is available!
The error is due to a module depreciated on the python version used on Inkscape, and that Textext uses. However, it was pretty easy to solve.
- First you need to download the python packages that are missing, thanks to David Gleich whom packed everything together, avoiding us the trouble of download them and put the pieces together.
- Unzip them
C:\Program Files\Inkscape\python\Lib\site-packages
Then you need to update your textext files, thanks to Pascal Schulthess for the solution.
- Go to
C:\Program Files\Inkscape\share\extensions, and opentextext.pyfile - Now replace
import inkex import os, sys, tempfile, traceback, glob, re, md5, copy from lxml import etree
and replace it for
import inkex import os, sys, tempfile, traceback, glob, re, copy import hashlib from lxml import etree
- And replace this
def __init__(self, document): PdfConverterBase.__init__(self, document) self.hash = None def convert(self, *a, **kw): # compute hash for generating unique ids for sub-elements self.hash = md5.new('%s%s' % (a, kw)).hexdigest()[:8] return PdfConverterBase.convert(self, *a, **kw) def pdf_to_svg(self): exec_command(['pdf2svg', self.tmp('pdf'), self.tmp('svg'), '1'])for
def __init__(self, document): PdfConverterBase.__init__(self, document) self.hash = None USE_GTK = False def convert(self, *a, **kw): # compute hash for generating unique ids for sub-elements m = hashlib.md5() m.update('%s%s' % (a, kw)) self.hash = m.hexdigest()[:8] return PdfConverterBase.convert(self, *a, **kw) def pdf_to_svg(self): exec_command(['pdf2svg', self.tmp('pdf'), self.tmp('svg'), '1'])
Restart Inkscape and that would do the work.







Hi,
I have tried your solution and it minimized the errors. Nevertheless it says now:
File “textext.py”, line 870
def __init__(self, document):
^
IndentationError: unindent does not match any outer indentation level
Do you have any suggestions on what might be wrong? The line 870 is line 868 in your code.
Greetings
Python is very picky about indenting. make sure that in each codeblock you have the same indentation. Use spaces as opposed to tabs. Compare ou inserted code to the other functions and adjust the indentation accordingly.
So, having followed these instructions I can get rid of the first complaint re: hashlib. But I’m still getting:
File “textext.py”, line 307, in
raise RuntimeError(“Neither pygtk nor Tkinter is available!”)
RuntimeError: Neither pygtk nor Tkinter is available!
Any advice?
Probably it is because the python in Inkscape is not updated, try to to replace the files with the download files I explain in the post.
Cheers, it’s fixed now. I forgot to put the files where I needed them…
Thank you for good information. TexText works now.
thanks, now latex works fine under inkscape 0.48 (I use portable inkscape from http://portableapps.com/)
Before doing the modification, these packages should be install on the system:
1,install Miktex, then the pdflatex.exe should be in the PATH
2,install gs902w32.exe, download from http://code.google.com/p/ghostscript/, gswin32.exe should in PATH
3,install pstoeditsetup350.exe, and pstoedit.exe should in PATH
4,install textext-0.4.4.exe
5,do the modifications as you mentioned.
Then, every thing works fine. thanks.
I did all the procedure you described but i have this error:
textext.py:227: GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)’ failed
txt.get_buffer().set_text(err_msg)
Do you know how can i solve it?
Many thanks in advance
Michele
Many Many thanks! that help me a lot!
It is very interesting. But I still don’t fix this problem. Could you describe your install in details. I installed Python 2.5.4, pstoedit and textext extension. Then I did what you said in your post. But the problem still exists!
Did you use the packages in the links?
If you use those, there is no need to install other things. Everything comes in those packages.
If you did, the other thing that comes to my mind is that previous installation are giving problem. Try to check which python inkscape is looking for.
Hai i have followed the procedure but i am getting the following error
Traceback (most recent call last):
File “textext.py”, line 211, in cb_ok
self.callback(self.text, self.preamble_file, self.scale_factor)
File “textext.py”, line 370, in
converter_cls, old_node))
File “textext.py”, line 388, in do_convert
new_node = converter.convert(text, preamble_file, scale_factor)
File “textext.py”, line 756, in convert
new_node = self.svg_to_group()
File “textext.py”, line 778, in svg_to_group
tree = etree.parse(self.tmp(‘svg’))
File “lxml.etree.pyx”, line 2692, in lxml.etree.parse (src/lxml/lxml.etree.c:49594)
File “parser.pxi”, line 1500, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71364)
File “parser.pxi”, line 1529, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:71647)
File “parser.pxi”, line 1429, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:70742)
File “parser.pxi”, line 975, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:67740)
File “parser.pxi”, line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63824)
File “parser.pxi”, line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64745)
File “parser.pxi”, line 565, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64088)
XMLSyntaxError: Document is empty, line 1, column 1
could you please help in this matter
Hi, I had a similar problem, and it turned out that my 32-bit pstoedit refused to work with 64-bit version of ghostscript. Installing 64-bit version of pstoedit fixed the problem for me, maybe you should check if your tools are all 32-bit / 64-bit.
Thank you for the reply. It worked for me
I can confirm that this fixes the error mentioned.
Hi,
I follow exactly as it said. And I was extremely careful about the indent and space.
But I still got this error,
File “textext.py”, line 872
USE_GTK = False
^
IndentationError: unexpected indent
Could you please help in this manner
Did you check this?
Awesome post. Solved my problem in 5 minutes. Gracias
De nada…
I’m glad it helps…
Thanks to all the great posts I got to the point of entering some TeX inputs.
But when I enser something like $a$ or anything normal TeX input and press “OK” I get this stream of error messages:
Traceback (most recent call last):
File “textext.py”, line 211, in cb_ok
self.callback(self.text, self.preamble_file, self.scale_factor)
File “textext.py”, line 370, in
converter_cls, old_node))
File “textext.py”, line 390, in do_convert
converter.finish()
File “textext.py”, line 680, in finish
self.remove_temp_files()
File “textext.py”, line 737, in remove_temp_files
self.try_remove(self.tmp_path)
File “textext.py”, line 744, in try_remove
os.rmdir(filename)
WindowsError: [Error 145] : ‘c:\\docume~1\\mingshey\\locals~1\\temp\\tmpw1uq17′
When I rummage the directory ‘c:\\docume~1\\mingshey\\locals~1\\temp\\tmpw1uq17′ and open the texput.log file which reports the error:
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (Web2C 2011) (format=pdflatex 2011.10.3) 3 OCT 2011 21:04
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**c:\docume~1\mingshey\locals~1\temp\tmpawgi2e\tmp.tex -interaction=nonstopmode
-halt-on-error
! Emergency stop.
c:\docume
~1\mingshey\locals~1\temp\tmpawgi2e\tmp.tex -interaction=nonsto…
End of file on the terminal!
Here is how much of TeX’s memory you used:
1 string out of 493633
83 string characters out of 3145073
49245 words of memory out of 3000000
3405 multiletter control sequences out of 15000+200000
3640 words of font info for 14 fonts, out of 3000000 for 9000
831 hyphenation exceptions out of 8191
0i,0n,0p,1b,6s stack positions out of 5000i,500n,10000p,200000b,50000s
! ==> Fatal error occurred, no output PDF file produced!
I overlooked the issue with TeX Live. I was working with TeXLive and now I see I have to download MikTeX.
Thanks for all the help!
Hey,
First of all thanks a lot. It solved a few errors, but now there are new ones:
Traceback (most recent call last):
File “textext.py”, line 937, in
e.affect()
File “C:\Program Files (x86)\Inkscape\share\extensions\inkex.py”, line 215, in affect
self.effect()
File “textext.py”, line 349, in effect
% ‘;\n’.join(converter_errors))
RuntimeError: No Latex -> SVG converter available:
Pdf2Svg: Command pdf2svg failed: [Error 2] Das System kann die angegebene Datei nicht finden;
PstoeditPlotSvg: Command pstoedit -help failed: [Error 2] Das System kann die angegebene Datei nicht finden;
SkConvert: Command pstoedit failed: [Error 2] Das System kann die angegebene Datei nicht finden
Sorry for the german parts. There is just standing, that the system cannot find the files. I tried to fix this problem without success. Maybe somebody can help me.
Greetz, duckfunny
Hello Duck funny. I am exactly getting the same errors as yours:
Traceback (most recent call last):
File “textext.py”, line 936, in
e.affect()
File “C:\Program Files (x86)\Inkscape\share\extensions\inkex.py”, line 215, in affect
self.effect()
File “textext.py”, line 349, in effect
% ‘;\n’.join(converter_errors))
RuntimeError: No Latex -> SVG converter available:
Pdf2Svg: Command pdf2svg failed: [Error 2] The system cannot find the file specified;
PstoeditPlotSvg: Command pstoedit -help failed: [Error 2] The system cannot find the file specified;
SkConvert: Command pstoedit failed: [Error 2] The system cannot find the file specified
Kindly help me with the solution.
I fixed this by added the pstoedit path to the path system variable.
Ok, now the latex-formula is working somehow, there are still errors but i get my latextext. I followed this [url=http://en.wikiversity.org/wiki/User:Egm6341.s10.team3.heejun/Inkscape]this[\url] to fix the problem above. But now there is the next problem. After the dialog box for textext following error happens:
textext.py:177: GtkWarning: Attempting to store changes into `C:\Programme\HOME\.recently-used.xbel’, but failed: Datei »C:\Programme\HOME\.recently-used.xbel.95WE3V« konnte nicht angelegt werden: Permission denied
gtk.main()
textext.py:177: GtkWarning: Attempting to set the permissions of `C:\Programme\HOME\.recently-used.xbel’, but failed: Permission denied
gtk.main()
Anyone an idea what to do?
Greetz, duckfunny
Hi, that looks like you have some issues with your folder permissions. Try to see if the “Read Only” option is marked. Then, uncheck it.
Hey, thank you for your quick answer! Thats solved the errors by Latex-Formula. This works now fine. TexText says me now: “Error when examining the file C:\Programme\HOME with fstat(): No such file or directory”. When I ignore this message and use the textext dialog box to create latex signs it seems to be working but nothing appears. greetz
Thank you very much for this post, it solved my issues within minutes.
Since the original author does not seem to maintain textext any more, would it be interesting to take textext and your fix to start a branch?
How to configure texText for inkscape 0.48 version on Linux PC?
Hi, I haven’t try to use this fix in a Linux box. But, the issues are related to python. So you may start looking in there.
Try to replace the code, as explained. And then pray that your version of python works. I’m not sure if Inkscape uses the python installed in Linux or it uses its own, like Windows. You should try to change it so it includes the latest versions.
Good luck in your endeavor.
This immediately fixed my problem, thank you so much!!
Thanks for the instructions!
It seems to have solved most of the problems only now I get an error from windows regarding pstoedit, “The application was unable to start correctly (0xc000007b)” consequently inkscape returns an IO error, presumably as it’s looking for something that pstoedit should have created.
Traceback (most recent call last):
File “eqtexsvg.py”, line 156, in
e.affect()
File “C:\Program Files (x86)\Inkscape\share\extensions\inkex.py”, line 215, in affect
self.effect()
File “eqtexsvg.py”, line 150, in effect
svg_open(self, svg_file)
File “eqtexsvg.py”, line 81, in svg_open
doc = inkex.etree.parse(filename)
File “lxml.etree.pyx”, line 2692, in lxml.etree.parse (src/lxml/lxml.etree.c:49594)
File “parser.pxi”, line 1500, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71364)
File “parser.pxi”, line 1529, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:71647)
File “parser.pxi”, line 1429, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:70742)
File “parser.pxi”, line 975, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:67740)
File “parser.pxi”, line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63824)
File “parser.pxi”, line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64745)
File “parser.pxi”, line 563, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64060)
IOError: Error reading file ‘c:\users\jamesd~1\appdata\local\temp\inkscape-zs_jeu\eq.svg’: failed to load external entity “file:///c:/users/jamesd~1/appdata/local/temp/inkscape-zs_jeu/eq.svg”
Any help would be much appreciated!
Hello,
Thanks for explanation, but I have the same problem described here :
Thanks for your help!
It worked perfectly for me. Although at first I encountered some errors, I removed all the modifications and modified the file again very carefully… Indentations and spaces are very sensitive in this sort of file I suppose. Therefore, edit the lines one by one in each section and when you’re copy pasting, have an extra eye for your selection. thank you author again!
can you help me with error message after following your solutions:
Traceback (most recent call last):
File “textext.py”, line 212, in cb_ok
self.callback(self.text, self.preamble_file, self.scale_factor)
File “textext.py”, line 371, in
converter_cls, old_node))
File “textext.py”, line 389, in do_convert
new_node = converter.convert(text, preamble_file, scale_factor)
File “textext.py”, line 753, in convert
self.pdf_to_svg()
File “textext.py”, line 767, in pdf_to_svg
raise NotImplementedError
NotImplementedError
Hello people from WordPress… Check this solution… It worked for me and now I have TeXtext running with Inkscape 0.48 without errors (In Linux of course….):
http://gaortizg.wordpress.com/2012/01/29/how-to-write-with-latex-in-inkscape/
See you later…..
I have all these paths entered, but still get the same error message, but in english:
Traceback (most recent call last):
File “textext.py”, line 937, in
e.affect()
File “C:\Program Files (x86)\Inkscape\share\extensions\inkex.py”, line 215, in affect
self.effect()
File “textext.py”, line 349, in effect
% ‘;\n’.join(converter_errors))
RuntimeError: No Latex -> SVG converter available:
Pdf2Svg: Command pdf2svg failed: [Error 2] The system cannot find the file specified;
PstoeditPlotSvg: Command pstoedit -help failed: [Error 2] The system cannot find the file specified;
SkConvert: Command pstoedit failed: [Error 2] The system cannot find the file specified
Yes I also have the same problem with same error message. Somebody help….
Superb! Work just a you said. Had the same problem with inkscape 0.48 on OS X 10.6.8, installed dependencies via macports but when trying to use textext had the problem you described here. Replaced everything, restarted, and it works!
Thanks a lot, you saved my day!
please can you specify the way to add the pstoedit path to the path system variable. what did you write in the path system variable
thanks in advance
I have done the same. But I get the error message:
Traceback (most recent call last):
File “textext.py”, line 937, in
e.affect()
File “C:\Program Files (x86)\Inkscape\share\extensions\inkex.py”, line 215, in affect
self.effect()
File “textext.py”, line 349, in effect
% ‘;\n’.join(converter_errors))
RuntimeError: No Latex -> SVG converter available:
Pdf2Svg: Command pdf2svg failed: [Error 2] The system cannot find the file specified;
PstoeditPlotSvg: Command pstoedit -help failed: [Error 2] The system cannot find the file specified;
SkConvert: Command pstoedit failed: [Error 2] The system cannot find the file specified
Waiting for your reply…. Plz Plz help……
Hello, dear human being looking at your computer.
I come to you as a last resort.
It’s been two days that I’ve been trying to install Textext 0.4.4 for Inkscape 0.48 (under Windows XP, using Miktek 2.9)
I followed
- these instructions http://laconsigna.wordpress.com/2010/11/13/fixing-textext-on-inkscape-0-48/
- and these instructions http://en.wikiversity.org/wiki/User:Egm6341.s10.team3.heejun/Inkscape#Install_Textext
- and these instructions http://people.orie.cornell.edu/jmd388/design/guides/textext.pdf
- and I’ve looked through this board https://bitbucket.org/pv/textext/issues
But I keep having the same error message when I try to write something in Textext:
Traceback (most recent call last):
File “textext.py”, line 211, in cb_ok
self.callback(self.text, self.preamble_file, self.scale_factor)
File “textext.py”, line 370, in
converter_cls, old_node))
File “textext.py”, line 388, in do_convert
new_node = converter.convert(text, preamble_file, scale_factor)
File “textext.py”, line 752, in convert
self.pdf_to_svg()
File “textext.py”, line 766, in pdf_to_svg
raise NotImplementedError
NotImplementedError
Please, help me…
I should also mention that reading
https://bitbucket.org/pv/textext/issue/55/textext-using-inkscape048
it seams like it is better to use 32 bit software even if having a 64 bit computer. I that true?
However, I replaced my GS View and Ghostscript with their respective 32 bit versions, but it did not make any difference to the error messages.
/Lars