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.
Including extra files in XCode Export
-
Dear friends:
Pythonista is really amazing. Developing IOs apps is a lot simpler and lots of fun.
I have a problem, though. I've made some code with Pythonista which reads info from extra .txt.py files. The code works perfectly well within Pythonista, opening the .txt.py files, but when I export it as XCode the files are not included and when I try to run the app I got the error message: "Cannot open blahblah.txt.py file" I've tried to move the .txt.py files to several locations within the project, but I keep getting the same error message.
Any recommendations on where should the .txt.py extra files should be put?
Thanks a lot for your kind help
Da5id
-
What do you get when you
import os print(os.getcwd()) print(os.getcwdu())
-
I had something similar. I posted the solution here --
https://omz-forums.appspot.com/pythonista/post/5882075823472640
If this doesn't work, try and chown -R on this directory to your user.
-
Problem solved. I just checked which is the current directory, as ccc proposed, and find out that the text files have to be included within the app support files of the IPhone simulator in my Mac.
Moving them to the pylib didn't work.Thanks a lot for your kind help.
-
Also, if you are not satisfied with the Current Working Directory (CWD), you can always change directories and explore other parts of your file system via os.chdir(), os.listdir(), and the really cool os.walk().
import os os.chdir('../Pythonista.app') # changes the CWD for fileName in os.listdir('.'): print(fileName) print('-' * 30) for fileName in os.listdir('/System/Library/Fonts/Cache'): print(fileName) print('-' * 30)