• import sys,os print(os.path.abspath('.'))

    That's your current path. You can usually use relative paths to the main script that you ran -- e.g open('test.jpg') will open the file in the same folder as your script.

    In some cases, if you have a module in site-packages, a way to get back to the main script in pythonista is

    import sys,os print(os.path.abspath(sys.path[0]))

    due to the way that pythonista adds the script that you pressed the play button on to the top of the sys.path.

    If you run that little script from a script located in folder inside iCloud folder, it will print out the absolute path, and you can use that in your scripts to write to iCloud. Note, you usually cannot write directly to the iCloud folder itself, you need a subfolder.

  • @cvp

    Now, I can make it a PIL image this way. Thank you so much.

  • @mikael @ccc It's working wonders now, thank you! Just a dumb mistake as usual. Great link too!

  • Hello there @mikael !

    I see what your saying but what you cannot see is originally (and before i fixed the duplicate streams) i had somthing similar to this:

    img = Image.open('my_image.png') img.load() img_rs = img.resize((256, 256), 1) with io.BytesIO() as iodata: img_rs.save(iodata, 'png') texture=scene.Texture(ui.Image.from_data(iodata.getvalue(), ... ...

    i changed it to img=img... to reduce code knowing ill never need that exact ref to original again during this loop session.reason is i place the Texture object in a cache dict and from here on is called from there 🤓🤓


    I also forgot to include my finally block that handles any mishaps once caching is complete..

    finally: iodata.close() f.close() img.close() del img del f del iodata for x in locals(): print(x)
  • @Loimeee try

    import photos assets = photos.get_assets() asset = photos.pick_asset(assets=assets) pil_image = photos.get_image() pil_image.show()
  • @Phuket2 You can access named images with Image.open

Internal error.

Oops! Looks like something went wrong!