0

I've spent the last 2 days trying to figure this out and am totally confused. Is it even possible for a python3 app to access files in the filesystem that aren't bundled with the app?

If not, pyInstaller will only be useful in my case for testing and not for production, as my app needs to access an existing IPFS server's config file outside of the app.

From all I've been able to find, providing path arguments on the command line and other filesystem references won't work. I have yet to find examples of that, so my presumption is pyInstaller isn't like an appImage encapsulation. I studied and played around with info found from this post and a this related video, alot!

If my presumption is correct (I hope I'm wrong), then how can I configure pyInstaller for my app where the structure is:

project_folder (venv root folder)
     |__src
     |   |__AppName
     |   |     |__main.py
     |   |     |__module A
     |   |     |__module B 
     |   |     |__module ...
     |   |
     |   |__config
     |         |__images
     |         |     |__*.png
     |         |
     |         |__logfile
     |         |__*.json
     |   
     |___bin/
     |___include/
     |___lib/
     |___share/

There's much in common between the aforementioned links above, but my attempts to use them as a model to structure my app produce errors that don't make sense to me about "using a relative import reference with no parent" and other import errors. I get errors just trying to print sys._MEIPASS (I'm using pyinstaller version 5.12.0).

-- 6/25/2023 --- The errors I see are back to original errors before I attempted to use the file structure above. Ran out of time to work this out. My last attempt reverted to a flat file structure where the "src" folder was the name of my application and it's contents were my app's source files. I provide locations of all other files with command line options and are external to the app.

The original & current problem is with the RNS module. pyinstaller finds that module but can't find modules in the RNS/Interfaces and vendor folders desite attempts to use hooks and --hidden-imports. Looking at the RNS source code that makes no sense to me and I'm clueless on how to resolve these errors (I no longer have the console output, only warn file. Errors were all related to "Interface undefined"):

missing module named StringIO - imported by setuptools._vendor.six (conditional), RNS.vendor.six (conditional), pkg_resources._vendor.six (conditional)
missing module named 'usbserial4a.cdcacmserial4a' - imported by RNS.Interfaces.Android.RNodeInterface (delayed, conditional), RNS.Interfaces.Android.SerialInterface (delayed, conditional), RNS.Interfaces.Android.KISSInterface (delayed, conditional)
missing module named usb4a - imported by RNS.Interfaces.Android.RNodeInterface (delayed, conditional), RNS.Interfaces.Android.SerialInterface (delayed), RNS.Interfaces.Android.KISSInterface (delayed)
missing module named usbserial4a - imported by RNS.Interfaces.Android.RNodeInterface (delayed, conditional), RNS.Interfaces.Android.SerialInterface (delayed, conditional), RNS.Interfaces.Android.KISSInterface (delayed, conditional)
missing module named jnius - imported by RNS.Interfaces.Android.RNodeInterface (delayed)
missing module named validate - imported by RNS.vendor.configobj (delayed, conditional)
missing module named compiler - imported by RNS.vendor.configobj (delayed, conditional)

Most of the conditional errors under Interfaces are not important since those interfaces aren't used anyway.

  • you absolutely can access files on the filesystem using pyinstaller with --onefile. – Alexander Jun 25 '23 at 00:29
  • After copying the code in the video and playing around with it I was able to finally come to that conclusion. However I find it very difficult to follow all the various import contexts and apply that example to my app. I don't need the wsgi layer at all, but the relative paths have to be adjusted without it and that's where my confusion comes from. – Thomas Freedman Jun 25 '23 at 01:09

0 Answers0