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

Path reorder fails #33

Open
krummrey opened this issue Jan 1, 2016 · 4 comments
Open

Path reorder fails #33

krummrey opened this issue Jan 1, 2016 · 4 comments

Comments

@krummrey
Copy link

krummrey commented Jan 1, 2016

Whenever I try to reorder paths I get this error: Do I have to preprocess the file in some way?
Traceback (most recent call last): File "eggbot_reorder.py", line 170, in <module> e.affect() File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/inkex.py", line 268, in affect self.effect() File "eggbot_reorder.py", line 149, in effect item = ( id, self.get_start_end( node, transform ) ) File "eggbot_reorder.py", line 108, in get_start_end sp = simplepath.parsePath( d ) File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/simplepath.py", line 90, in parsePath token, isCommand = lexer.next() File "/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/simplepath.py", line 31, in lexPath length = len(d) TypeError: object of type 'NoneType' has no len()

@oskay
Copy link
Contributor

oskay commented Jan 1, 2016

I have not seen this error, and I cannot seem to reproduce it, trying today on a new file.

This is likely due to an improperly formed SVG file, at least according to some definition of "improperly", according to Inkscape.

I would suggest trying the following, as a first pass:
Edit > Select all in all layers
Object > Ungroup (Possibly more than once, if you have nested groups in your file)
Path > Object to path

If converting all of your objects to paths does not work, I am very curious how the file was made. Does this have imported artwork? Do you have a procedure to replicate the issue from within Inkscape, starting with a new file?

If all else fails you might try to zip and send us the SVG file (by e-mail) so that we can examine and try to reproduce the issue.

@krummrey
Copy link
Author

krummrey commented Jan 4, 2016

The SVGs came all from Illustrator CS6. I had ungrouped them but for some reason I had to do the
Path > Object to path
to get it to work. Now it works like a charm.
Thanks for the suggestions.

@krummrey krummrey closed this as completed Jan 4, 2016
@ShelMi
Copy link

ShelMi commented Aug 12, 2016

My experience is identical with krummrey's - both the error and the positive results from oskay's suggested fix. Until I chanced to find this issue and solution in github, I had given up on using eggbot_reorder. I daresay others may have had this problem and given up also.

Since the fix is so simple and effective, I propose that when there is an error, eggbot_reorder.py should print oskay's instructions for attempting the fix. Demo svg file below, after proposed change:

Original:

    def get_start_end( self, node, transform ):
        """Given a node, return the start and end points"""
        d = node.get( 'd' )
        sp = simplepath.parsePath( d )

Suggested change:

    def get_start_end( self, node, transform ):
        """Given a node, return the start and end points"""
        d = node.get( 'd' )
        try:
            sp = simplepath.parsePath( d )
        except TypeError:
            inkex.errormsg  (
    'Internal error occurred, please try the following steps:\n\
    1.  Select all objects you want to reorder\n\
    2.  Ungroup [Object/Ungroup] (repeat until "Group" no longer appears in status line)\n\
    3.  Convert to path [Path/Object to Path]\n'
                            )

Here is a simple demo svg file which demonstrates the problem.
eggbot_reorder_fail_demo.zip

@oskay oskay reopened this Aug 12, 2016
@sterlingcrispin
Copy link

thanks! awesome to run into this fix! This should get added into the Axidraw plugin as well super helpful

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

No branches or pull requests

4 participants