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.
Inconsistent behavior when sharing photos into pythonista?
-
I've been doing some experiments with sharing image files into pythonista from the built-in photos app, to do things like zip up and share elsewhere. But I seem to get inconsistent data.
Here's my very simple experimental code:
import appex def test_save_images(): images = appex.get_images_data() for idx, image in enumerate(images): filename = "zfile-" + str(idx) + ".jpg" with open(filename, "wb") as ot: ot.write(image) if __name__ == '__main__': test_save_images()
Then I go into the built-in photos app, select two of photos, and share them into pythonista via "run pythonista script."
So far, I've done this twice, and neither time has it worked properly.
The first time, instead of saving both photos into the pythonista filesystem, it saved one photo, twice.
The second time, it saved both photos, but it saved a total of three photos---it saved one photo once, and one photo twice.
I obviously find this a little confusing. Why is
get_images_data
not passing the number of photos that I would expect into the script?