I encounter one problem today. My textext didn’t work on Inkscape 0.48, I get the error
1 | textext.py:55: DeprecationWarning: the md5 module is deprecated; use hashlib instead import os, sys, tempfile, traceback, glob, re, md5, copy |
2 | Traceback (most recent call last): File "textext.py", line 306, in <module> |
3 | raise RuntimeError("Neither pygtk nor Tkinter is available!") |
4 | 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 and 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
54 | import inkex |
55 | import os, sys, tempfile, traceback, glob, re, md5, copy |
56 | from lxml import etree |
and replace it for
54 | import inkex |
55 | import os, sys, tempfile, traceback, glob, re, copy |
56 | import hashlib |
57 | from lxml import etree |
- And replace this
868
def
__init__(
self
, document):
869
PdfConverterBase.__init__(
self
, document)
870
self
.
hash
=
None
871
def
convert(
self
,
*
a,
*
*
kw):
872
# compute hash for generating unique ids for sub-elements
873
self
.
hash
=
md5.new(
'%s%s'
%
(a, kw)).hexdigest()[:
8
]
874
return
PdfConverterBase.convert(
self
,
*
a,
*
*
kw)
875
def
pdf_to_svg(
self
):
876
exec_command([
'pdf2svg'
,
self
.tmp(
'pdf'
),
self
.tmp(
'svg'
),
'1'
])
-
for
868
def
__init__(
self
, document):
869
PdfConverterBase.__init__(
self
, document)
870
self
.
hash
=
None
871
USE_GTK
=
False
872
def
convert(
self
,
*
a,
*
*
kw):
873
# compute hash for generating unique ids for sub-elements
874
m
=
hashlib.md5()
875
m.update(
'%s%s'
%
(a, kw))
876
self
.
hash
=
m.hexdigest()[:
8
]
877
return
PdfConverterBase.convert(
self
,
*
a,
*
*
kw)
878
def
pdf_to_svg(
self
):
879
exec_command([
'pdf2svg'
,
self
.tmp(
'pdf'
),
self
.tmp(
'svg'
),
'1'
])
Restart Inkscape and the Tex Text works.
attention: you should pay attentions to the space or indent when you replace. or you will have a indent wrong in line871 when you run it.
more information you can visit:
https://bitbucket.org/pv/textext/issue/55/textext-using-inkscape048
but just using my this method of my passage is enough to solve the problem.
it works well!