That works once I have the file inside the Pythonista container. However, Pythonista seems to only allow import of certain kinds of file extensions into the container. Files with zip extension for example are blocked.
I found a workaround: From Files app, import the .zip file into Working Copy. In Working Copy, rename the file extension to .txt, then share from Working Copy into Pythonista iCloud Folder. Now just read the "text" file with open("foo.txt", "rb") and interpret in binary mode.
But why not allow import of arbitrary files in the first place?
I have several of binary files in my iCloud Drive that I want to analyze with Python(ista). Using either the Files app, or Pythonista's import dialog, I can import many types of files into my Pythonista workspace, for example, .txt, image files and PDF files.
However, importing .zip files or .sqlite3 database files (or many other binary file types) does not work for me.
Any advice for how I can process arbitrary files with Pythonista?