Problem with pick_photo() in Pythonista Lab #81
mmccthomas
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi @ole,
While trying out Pythonista Lab, I encountered an error in code :
import photos
photos.pick_image()
or
display(pick_image()
produces error as below. Could it be a problem with file permissions?
OSError Traceback (most recent call last)
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/Image.py:653, in Image.repr_png(self)
652 try:
--> 653 self.save(b, "PNG")
654 except Exception as e:
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/Image.py:2179, in Image.save(self, fp, format, **params)
2178 # may mutate self!
-> 2179 self._ensure_mutable()
2181 save_all = params.pop("save_all", False)
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/Image.py:598, in Image._ensure_mutable(self)
597 if self.readonly:
--> 598 self._copy()
599 else:
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/Image.py:591, in Image._copy(self)
590 def _copy(self):
--> 591 self.load()
592 self.im = self.im.copy()
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/ImageFile.py:273, in ImageFile.load(self)
271 if not self.map and not LOAD_TRUNCATED_IMAGES and err_code < 0:
272 # still raised if decoder fails to return anything
--> 273 raise_oserror(err_code)
275 return Image.Image.load(self)
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/ImageFile.py:68, in raise_oserror(error)
67 message = f"decoder error {error}"
---> 68 raise OSError(message + " when reading image file")
OSError: broken data stream when reading image file
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/IPython/core/formatters.py:348, in BaseFormatter.call(self, obj)
346 method = get_real_method(obj, self.print_method)
347 if method is not None:
--> 348 return method()
349 return None
350 else:
File /var/containers/Bundle/Application/4EC9235D-DCD6-45F3-BB56-86B65EB5B481/PythonistaLab.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL/Image.py:655, in Image.repr_png(self)
653 self.save(b, "PNG")
654 except Exception as e:
--> 655 raise ValueError("Could not save to PNG for display") from e
656 return b.getvalue()
ValueError: Could not save to PNG for display
<PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=1200x1600 at 0x13D52FED0>
Beta Was this translation helpful? Give feedback.
All reactions