phrack / ShootOFF-legacy

An open source framework to enhance laser dry fire training.
BSD 4-Clause "Original" or "Old" License
30 stars 17 forks source link

Ghostscript on Windows missing #54

Closed cbdmaul closed 10 years ago

cbdmaul commented 10 years ago

Receive the following when attempting to save a jpeg, png, or gif, pyinstaller does not identify it as a missing dependency

Exception in Tkinter callback Traceback (most recent call last): File "C:\Python27\lib\lib-tk\Tkinter.py", line 1470, in call return self.func(*args) File "shootoff.py", line 417, in save_feed_image img.save(image_file, extension[1:]) File "C:\Python27\lib\site-packages\PIL\Image.py", line 1421, in save self.load() File "C:\Python27\lib\site-packages\PIL\EpsImagePlugin.py", line 311, in load self.im = Ghostscript(self.tile, self.size, self.fp) File "C:\Python27\lib\site-packages\PIL\EpsImagePlugin.py", line 75, in Ghosts cript raise WindowsError('Unable to locate Ghostscript on paths') WindowsError: Unable to locate Ghostscript on paths

phrack commented 10 years ago

Can you clarify if this always happens on Windows or just from a PyInstaller package?

Just for the sake of recording this information: the trick to getting PyInstaller to find some of the dependencies is to explicitly import it in shootoff.py even if it isn't actually used there. That causes it to find and include dependencies it misses otherwise.

cbdmaul commented 10 years ago

It always happens if ghostscript is missing. I don't know what happens if I have it installed. It takes some effort to install it on windows.

phrack commented 10 years ago

It now checks to see if Ghostscript is installed similar to how PIL does. If Ghostscript is installed it will let you save as a png, eps, gif, or jpeg, otherwise it will only let you save as an eps. You have to manually enter the extension on Windows when saving the file, but it will figure it out on everything else (weird tkinter bug on Windows only).

To install Ghostscript on Windows you have to use the installer from here: http://www.ghostscript.com/download/gsdnld.html AND add the install location's bin directory to the path.

I've confirmed the fix on Windows and Linux. The extension issue is annoying on Windows, but I couldn't find a fix.