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.py
file - 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.
Inkscape 0.48
Sorry for my late comment on this but I wasn’t here. Anyhow, the new version of Inkscape is available now!
I’m downloading now, this is what they said about it:
This version of the SVG-based vector graphics editor brings a new Spray tool, multipath editing, superscripts and subscripts in text, as well as numeric control of text kerning, tracking, rotation and more, several new extensions for web developers and first take at adaptive user interface.
The release notes are here. I can’t wait to test it. 💡
Inkscape in Windows Command Line
Inkscape is a great tool to draw excellent pictures, and is open source. Although it has some problems when working in Windows, nevertheless there are plenty solutions.
One of those problems is the command line. In Windows the command line doesn’t give any output because everything is redirected to the stdout
and stderr
. In the documentation they mention that they are working on it, but there are some solutions already. Is just about wrap Inkscape to other software.
Now that we can see the output when we try to work in batches or simple files you will notice that Inkscape does not produce any results or give some error about the files do not exist. That is because it uses the path of where is installed and not the current directory. To solve this — and avoid writing the full path all the time — we can use the %CD%
windows variable which holds the current directory full path. For example to convert the figure.png
to eps we will input
inkscape -f "%CD%\figure.png" -E "%CD%\figure.eps"
the inkscape
command could be replaced by the command that you use once the Inkscape executable is wrapped to show output, the -f
option sets the input file, and the -E
option is for set the export as eps file. Note that the %CD%
option uses an aditional backslash (‘\’) at the end to create a correct path for the files.
Talking