Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Exporting on Windows fails with permission issue #9

Open
mitchcurtis opened this issue Dec 22, 2017 · 11 comments
Open

Exporting on Windows fails with permission issue #9

mitchcurtis opened this issue Dec 22, 2017 · 11 comments

Comments

@mitchcurtis
Copy link

I created a folder to export to:

C:\Users\Mitch\Documents\inkscape-layer-export-test

I exported via the extension, but got this error:

Traceback (most recent call last):
File "export_layers.py", line 112, in
_main()
File "export_layers.py", line 108, in _main
e.affect()
File "C:\Program Files\Inkscape\share\extensions\inkex.py", line 283, in affect
self.effect()
File "export_layers.py", line 39, in effect
self.export_layers(layer_dest_svg_path, show_layer_ids)
File "export_layers.py", line 66, in export_layers
doc.write(dest)
File "src\lxml\lxml.etree.pyx", line 2033, in lxml.etree._ElementTree.write (src\lxml\lxml.etree.c:62933)
File "src\lxml\serializer.pxi", line 512, in lxml.etree._tofilelike (src\lxml\lxml.etree.c:133361)
File "src\lxml\serializer.pxi", line 571, in lxml.etree._create_output_buffer (src\lxml\lxml.etree.c:134025)
File "src\lxml\serializer.pxi", line 560, in lxml.etree._create_output_buffer (src\lxml\lxml.etree.c:133825)
IOError: [Errno 13] Permission denied

I checked the permissions on the file, and they looked fine.

The .svg file I used is here: drawing.zip

@Nodragem
Copy link

Nodragem commented Feb 2, 2018

Same issue here with the exact same error.

@mitchcurtis
Copy link
Author

I ended up fixing it like this:

mitchcurtis@c5fd268

@Nodragem
Copy link

Nodragem commented Feb 3, 2018

Hi @mitchcurtis,

I tried your code and it works pretty well!
The only problem I 've got with it is that I needed to change the default path ~/ to the absolute path on my hard drive (e.g. D:\Gamedev\mygame\raw_assets\). I am on Windows.

Also, maybe you could rename your extension to something like Export Layers to PNG (ninepatch support). As for now, with the current name, I would have never thought your extension was answering my needs :)

Thanks a lot!

@mitchcurtis
Copy link
Author

Hi. :)

The only problem I 've got with it is that I needed to change the default path ~/ to the absolute path on my hard drive (e.g. D:\Gamedev\mygame\raw_assets). I am on Windows.

What would you prefer happened? Your path should be remembered for the current Inkscape session at least, but I'm not sure what I can do about the default path.

Also, maybe you could rename your extension to something like Export Layers to PNG (ninepatch support). As for now, with the current name, I would have never thought your extension was answering my needs :)

I would, but it's for work, and the purpose of the extension is specifically to export 9-patch assets; exporting layers in general is just a bonus. :)

@Nodragem
Copy link

Nodragem commented Feb 4, 2018

What I meant is that ~/ did not work on Windows, so I thought the extension was not working. So maybe yo could replace it with ./ or nothing or a button to browse the hard drive.

As for now, this is the only extension that exports layers on Windows.
Maybe I could fork it and make few changes if you don't mind.

@mitchcurtis
Copy link
Author

mitchcurtis commented Feb 4, 2018

What I meant is that ~/ did not work on Windows, so I thought the extension was not working. So maybe yo could replace it with ./ or nothing

Would "./" work on all platforms? I'm not sure if there's a default path that will work on Windows, Mac and Linux.

Replacing it with nothing could work.

or a button to browse the hard drive.

This isn't possible currently; see: https://github.com/mitchcurtis/inkscape-9-patch-export#using-it

As for now, this is the only extension that exports layers on Windows.
Maybe I could fork it and make few changes if you don't mind.

Sure, go for it. :) I'd also merge a pull request that removes the default path.

@kpanas
Copy link

kpanas commented Mar 28, 2018

Hi @jespino , was the problem fixed? I've downloaded the newest version and still cannot export (win7). Doesn't matter if I use the direct path or "./", nothing works.

Thanks!

@mitchcurtis
Copy link
Author

@kpanas what was the error you got? And what was the path you used?

@kpanas
Copy link

kpanas commented Mar 28, 2018

@mitchcurtis I've used "D:\Dropbox\phd\gfx\vector" (the same directory that the .svg file is in). Here is the error (I cannot copy the text for some reason):
image
Thanks.

@mitchcurtis
Copy link
Author

@kpanas I don't think the issue was ever fixed in this fork in that case. You can try using https://github.com/mitchcurtis/inkscape-9-patch-export instead.

@dmitry-t
Copy link

dmitry-t commented Apr 10, 2018

The problem is that on Windows a temporary file created for export needs cannot be opened again:

Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).

So the solution is quite simple: pass file objects into internal functions instead of their names.

I will prepare a pull request if there are no objections. But I'll need help with testing the solution on platforms other than Windows.

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

No branches or pull requests

4 participants