omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    3
    5
    2495
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • da5id
      da5id last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by

        What do you get when you

        import os
        print(os.getcwd())
        print(os.getcwdu())
        
        1 Reply Last reply Reply Quote 0
        • montedavis
          montedavis last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • da5id
            da5id last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • ccc
              ccc last edited by

              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)
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB Forums | Contributors