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

Group instance has no attribute 'name' #16

Open
ghost opened this issue Sep 27, 2017 · 7 comments
Open

Group instance has no attribute 'name' #16

ghost opened this issue Sep 27, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Sep 27, 2017

I can't get svg2mod to work. I put svg2mod.py in its own directory and svg.py etc in an "svg" subdirectory. When I run svg2mod with @kasbah's "https://kaspar.h1x.com/oshwa-2.4.svg", (see svg2mod issue "Problems converting.."), I see the following:

`C:\svg2mod>svg2mod -i oshwa-2.4.svg --format pretty -p 1.0

Parsing SVG...

No handler for element {http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd}namedview

No handler for element {http://www.w3.org/2000/svg}metadata

No handler for element {http://www.w3.org/2000/svg}defs

Traceback (most recent call last):

File "C:\svg2mod\svg2mod.py", line 1436, in

main()

File "C:\svg2mod\svg2mod.py", line 98, in main

exported.write()

File "C:\svg2mod\svg2mod.py", line 721, in write

self._prune()

File "C:\svg2mod\svg2mod.py", line 568, in _prune

if name == item.name:

AttributeError: Group instance has no attribute 'name'`

I know next to nothing about Python. Does anybody have any idea what I might be doing wrong?

@kasbah
Copy link
Contributor

kasbah commented Sep 27, 2017

I just tried it again and that example still works for me. What version of Python are you running?

C:\svg2mod>svg2mod -i oshwa-2.4.svg --format pretty -p 1.0

That doesn't make sense to me, do you mean C:\svg2mod\svg2mod.py -i oshwa-2.4.svg --format pretty -p 1.0 ?

@ghost
Copy link
Author

ghost commented Sep 27, 2017

Thanks Kasbah,

C:\svg2mod>svg2mod -i oshwa-2.4.svg --format pretty -p 1.0

I'm working in Windows. The "C:\svg2mod>" is the shell prompt. I used exactly the same command line as you did in your Nov 17, 2016 posting to svg2mod issue "Problems converting..". (I used your command line and your SVG file, to eliminate those items as possible issues.)

Python identifies itself with:

Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32

Could I perhaps have svg.py set up incorrectly? My directory tree looks like this:

Directory of C:\svg2mod
2017-09-27  04:14             7,026 oshwa-2.4.svg
2017-09-27  02:18            39,014 svg2mod.py
2017-09-27  01:18    <DIR>          svg

Directory of C:\svg2mod\svg
2017-09-27  01:00            11,240 geometry.py
2017-09-27  01:18            15,326 geometry.pyc
2017-09-27  00:59            22,372 svg.py
2017-09-27  01:18            24,461 svg.pyc
2017-09-27  01:00               113 __init__.py
2017-09-27  01:18               396 __init__.pyc

@kasbah
Copy link
Contributor

kasbah commented Sep 27, 2017

You say you are invoking svg2mod but you don't have an svg2mod executable, only a svg2mod.py executable, so I am a bit confused by that.

What do you mean "set up", you should be able to just clone the repository and use that. Alternatively you can download a zip of the repo and unpack it. Your svg folder doesn't look like the one in the repo.

@ghost
Copy link
Author

ghost commented Sep 27, 2017

Thanks again Kasbah,

That was exactly my problem. That is, when I tried running svg2mod on its own, it complained about svg.py missing, so I downloaded that package separately and I obviously botched the installation. It would be helpful if the Readme.md file included install instructions, such as you have just provided.

Now that I have svg2mod working, I seem to have found a bug. I'm trying to convert some text to a logo. The conversion is almost correct, but the center of the 'O's are drooping. I'll look into that some more, and report it separately, if it's not something that I'm doing incorrectly.

inkscape
pcvnew

@kasbah
Copy link
Contributor

kasbah commented Sep 27, 2017

Good stuff, the image looks a bit like svg2mod doesn't fully understand the enclosed paths. I wrote about how to handle that on the kicad.info forum a while back. If you are still having problems with it you should open a separate issue.

@ghost
Copy link
Author

ghost commented Sep 27, 2017

Thanks once more,

I had no idea what I was doing, but I was able to follow your procedure and even simplify it somewhat, since I needed to generate "positive" text. It worked perfectly.

"You say you are invoking svg2mod but you don't have an svg2mod executable, only and svg2mod.py executable, so I am a bit confused by that."

I'm not sure how it works either. I know that the MS-DOS shell will execute batch files without a ".BAT" extension. Perhaps the Python installer adds some entry to the registry that makes it work.

@kasbah
Copy link
Contributor

kasbah commented Nov 30, 2017

Do you think this OK to be closed or is there something unresolved remaining?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant