mgmax / inkscape-roland-cutstudio

Unofficial Inkscape Windows Plugin for Roland CutStudio
16 stars 7 forks source link

Exceptions when CutStudio not installed, Win10, Inkscape 1.2 #29

Open dtwitkowski opened 10 months ago

dtwitkowski commented 10 months ago

Describe the bug When installed on Windows 10 under Inkscape 1.2, with CutStudio not installed, the Extension throws Exceptions.

To Reproduce Input file: Does the bug also happen with this test file: https://github.com/mgmax/inkscape-roland-cutstudio/raw/master/test-input.svg ? YES

Steps to reproduce the behavior (please change as needed):

  1. Open the file with Inkscape
  2. Extensions - Roland CutStudio - Open in CutStudio

Does the issue also occur on a second computer? UNKNOWN. Installation on MacOS reportedly works.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Traceback (most recent call last): File "C:\Program Files\Inkscape\share\inkscape\extensions\roland_cutstudio.py", line 414, in Popen([which("CutStudio\CutStudio.exe", True), "/import", destination], creationflags=DETACHED_PROCESS, close_fds=True) File "C:\Program Files\Inkscape\share\inkscape\extensions\roland_cutstudio.py", line 89, in which raise Exception("Cannot find " + str(program) + " in any of these paths: " + str(pathlist) + ". Either the program is not installed, PATH is not set correctly, or this is a bug.") Exception: Cannot find CutStudio\CutStudio.exe in any of these paths: ['C:\Program Files\Inkscape\bin', 'C:\Program Files\Inkscape\bin\', 'C:\WINDOWS\system32', 'C:\WINDOWS', 'C:\WINDOWS\System32\Wbem', 'C:\WINDOWS\System32\WindowsPowerShell\v1.0\', 'C:\WINDOWS\System32\OpenSSH\', 'C:\Program Files\PuTTY\', 'C:\Program Files\WireGuard\', 'C:\Program Files\WinMerge', 'C:\Program Files\dotnet\', 'C:\WSJT\wsjtx\bin', 'C:\Users\dtwit\AppData\Local\Microsoft\WindowsApps', 'C:\Program Files (x86)\Nmap', 'C:\SDelete', 'C:\Program Files\CutStudio', '', 'C:\Program Files\Inkscape\bin\', 'C:\Program Files', 'C:\Program Files (x86)', 'C:\Program Files\', 'C:\Program Files\Inkscape\share']. Either the program is not installed, PATH is not set correctly, or this is a bug.

Versions (please complete the following information):

Additional context I tried setting the PATH to include "C:\Program Files\CutStudio" but this didn't help.

mgmax commented 10 months ago

Good find. This case was never intended to work, but feel free to find a solution and submit a Pull Request. :-)

Basically, the Exception handling (try...except) here https://github.com/mgmax/inkscape-roland-cutstudio/blob/master/roland_cutstudio.py#L419C9-L419C9 needs to be moved "outside" so that it also covers the Windows specific code https://github.com/mgmax/inkscape-roland-cutstudio/blob/master/roland_cutstudio.py#L412

Or you find CutStudio somewhere and install it. Or switch to Inkcut and get rid of CutStudio :-) Unfortunately, Inkcut doesn't support special features like cropmark detection.

dtwitkowski commented 10 months ago

Thanks Max. I was confused by the code/instructions section Using Without CutStudio Installed - I presumed that meant this extension would work as a standalone converter, but I guess not under Windows?

mgmax commented 10 months ago

Yes, the extension will fall back to just saving the file when CutStudio is missing. I never expected that someone needs this on Windows. Feel free to contribute improved code that solves the issue.