xyz2tex/svg2tikz

Unable to find convert_file method on module

Closed this issue · 2 comments

I pip installed svg2tikz on Manjaro Linux, without error messages

Tried to import convert_file as shown on http://xyz2tex.github.io/svg2tikz/moduleguide.html

>>>from svg2tikz import convert_file
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'convert_file' from 'svg2tikz' (/home/villares/thonny-python-env/lib/python3.11/site-packages/svg2tikz/__init__.py)

>>>import svg2tikz    # no error
>>> svg2tikz.convert_file
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'svg2tikz' has no attribute 'convert_file'

Also, could not reach svg2tikz on the command line
and python -m svg2tikz:

/home/villares/miniconda3/bin/python: No module named svg2tikz.__main__; 'svg2tikz' is a package and cannot be directly executed

Hello @villares

Thanks for the head up. For you first problem, the pip version is not up to date with git (working on the next release). To import the functins you can do: svg2tikz.extensions.tikz_export import convert_svg (also the git branche fix some issues so if you can afford to use it it will be better)

For the other problem I will check to fix that

Hello @villares, sorry for the delay

I checked the issue and the install of the command line should be fixed in #137. You should directly have access to svg2tikz from the command line. python -m svg2tikz does not work as for now the project is a package but it could be improved to let access to this feature if needed in the future :)