spakin / SimpInkScr

Simple Inkscape Scripting
https://inkscape.org/~pakin/%E2%98%85simple-inkscape-scripting
GNU General Public License v3.0
321 stars 32 forks source link

Installation under Windows not working #51

Closed lukassemmler closed 2 years ago

lukassemmler commented 2 years ago

Hello, sorry if this is a no-brainer, but I'm having trouble to get this extension running under Windows.

Environment:

Steps to reproduce the bug:

  1. Install Inkscape v1.2 (dc2aedaf03, 2022-05-15) for Windows via .exe: https://inkscape.org/release/1.2/windows/64-bit/.
  2. Downloaded the lastest release (v3.1.0) of this extension.
  3. Unzip the archive to get the folder simple_inkscape_scripting.
  4. Copy the folder simple_inkscape_scripting to C:\Program Files\Inkscape\share\inkscape\extensions.
  5. Start Inkscape via C:\Program Files\Inkscape\bin\inkscape.exe.
  6. Open a new document via "New Document".
  7. Start the extension via Menubar --> Extensions --> Render --> Simple Inkscape Scripting...
  8. Insert a simple example script into the field "Python code":

    
    for i in range(10, 0, -1):
       ellipse((width/2, height/2), (i*30, i*20 + 10),
               fill='#0000%02x' % (255 - 255*i//10), stroke='white')
  9. Click on "Apply".
  10. A modal "'Simple Inkscape Scripting' working, please wait...' is opened.
  11. Immediately after, an error modal is opened:

    Inkscape has received additional data from the script executed. The script did not return an error, but this may indicate the results will not be as expected.

    C:\Program Files\Inkscape\bin\pythonw.exe: can't find '__main__' module in 'C:\\Program Files\\Inkscape'

By the way, I have two entries "Simple Inkscape Scripting..." under "Extensions". I assume this is not intentional, but both commands behave exactly the same and there is no second simple_inkscape_scripting folder in my extensions folder.

Any help would be appreciated!

spakin commented 2 years ago

I have no idea why you're getting an error message or why "Simple Inkscape Scripting…" shows up twice under Extensions. Although I don't have a Windows system I can use for testing, #23 indicates that other users have successfully run the extension under Windows.

Do any extensions work on your system? How about other extensions you installed yourself? I'd think that if Inkscape can't find '__main__' module for Simple Inkscape Scripting, it won't be able to find it for any other extension, either.

lukassemmler commented 2 years ago

Hey @spakin , thank you for your response! Well, the preinstalled extensions seem to work, but I have to test again.

Anyways, I just tried installing and running the extension on my laptop - and lo and behold, it worked!

Maybe it's because I have Inkscape v1.1.2 (b8e25be833, 2022-02-05) on my laptop? Maybe I messed up something with the Python PATH on my pc? I'm not sure. At least I have a working example for comparison now.

I will try again this weekend, when I have access to my other machine again (the one with the installation error).

spakin commented 2 years ago

I'm glad to hear you have a working system with which to compare. I look forward to learning what you find out this weekend.

For the record, I currently have Inkscape 1.1.1 (3bf5ae0d25, 2021-09-20) and Inkscape 1.3-dev (8eed98e, 2022-06-05) on my Linux system, and Simple Inkscape Scripting works with both of them.

lukassemmler commented 2 years ago

Alright, here are my results after testing on the faulty machine:

Anyway, thanks for your help @spakin ! I'm looking forward to some scripting now 😄

spakin commented 2 years ago

Thanks for the detailed description!

I've successfully run Simple Inkscape Scripting under Inkscape 1.2 on Linux so we have at least that data point. I had not heard of the Extension Manager before your post so my installations are always performed by manually copying a directory into the Inkscape extensions directory. It sounds like what we don't know is if 1.2 is broken on Windows in general or only on your installation. You may want to test the 1.3 development version to see if you have more luck with that.

I'm glad to hear that you do have the ability to run Simple Inkscape Scripting, even though it's with an older version of Inkscape. I sure hope the problem gets fixed (or fixes itself) in a future release.