Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Gives an error at the line that I marked.
-
# coding: utf-8 import ui import appex import Image v = ui.load_view() img = appex.get_image() if img: v["image"].image = ui.Image(str(img)) #Error occurs here, it says IOError couldn't display image or something like that v.present('sheet') if not img: v.close()
How do I correct it? Please help!
-
@happy_variable
I don't know why you get that error, but tryappex.get_attachments()[0]
instead ofappex.get_image()
That did it for me :/Oh, and remove the
str()
aroundimg
on the line you get the error -
appex.get_image()
had issues that are now fixed in the current beta... See https://forum.omz-software.com/topic/3498/error-when-trying-to-get-a-photo-attachment-in-a-mail and https://github.com/omz/Pythonista-Issues/issues/169 -
I think the main problem here is that
appex.get_image()
returns aPIL.Image
, but theui.Image
constructor expects an image name or file path...Something like this should work (it's possible that workarounds are needed for the App Store version of Pythonista 3 because of the aforementioned bug in
appex
):img_data = appex.get_image_data() if img_data: v['image'].image = ui.Image.from_data(img_data) # ...
-
Thanks a lot! THAT WORKS!!! Without you I could have wasted time on trying to correct this error!