electronut / pp

Code for book Python Playground by Mahesh Venkitachalam (No Starch Press, USA)
568 stars 499 forks source link

Will not save .png form of file #26

Open rwkopcke opened 4 years ago

rwkopcke commented 4 years ago

EDIT: After the installation of Ghostscript 9.50, which I obtained from https://pages.uoregon.edu/koch/Ghostscript-9.50-Full.pkg, the program writes the png file as expected on key "s" -- PIL requires the presences of Ghostscript, which is not provided with the purchase of a Mac.

Using python 3.8.1 and the current version of PIL: on keys "t" or " ", the program toggles or restarts as expected. on key "s", the program writes the .eps file, but it does not write the .png file. The program continues to run and produces the following error message when it fails to write the png file.

generating spirograph... saving drawing to spiro-09Jan2020-114601.eps/png Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py", line 1883, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/turtle.py", line 686, in eventfun fun() File "/Users/richardkopcke/PycharmProjects/Python_Playground/ch2_spirograph/original.py", line 191, in saveDrawing img.save(fileName + '.png', 'png') File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/Image.py", line 2068, in save self._ensure_mutable() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/Image.py", line 589, in _ensure_mutable self._copy() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/Image.py", line 582, in _copy self.load() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/EpsImagePlugin.py", line 330, in load self.im = Ghostscript(self.tile, self.size, self.fp, scale) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/EpsImagePlugin.py", line 143, in Ghostscript subprocess.check_call(command, startupinfo=startupinfo) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 359, in check_call retcode = call(*popenargs, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 340, in call with Popen(*popenargs, **kwargs) as p: File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'gs'