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.


    ModuleNotFoundError when run from External Files

    Pythonista
    2
    6
    2033
    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.
    • maxelon
      maxelon last edited by maxelon

      If I try and run programs from an external file, it gives me a ModuleNotFoundError, even though the module is in the same folder and it runs perfectly from my Mac. For example,

      File 1: (dummy.py) has this line:
      print('Hello')

      File 2: (dummy2.py) has this line:
      import dummy

      When I run File 2, on my Mac I get 'Hello' printed. On Pythonista, I get ModuleNotfoundError.

      Can someone help me understand what is going on?

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @maxelon last edited by

        @maxelon for me, it works. Be sure no uppercase and in same folder

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

          Definitely no upper case and in the same folder, and it does works from my Mac. I can also make it work from Pythonista’s iCloud Script Library area, just not from a folder accessed by External Files.

          cvp 2 Replies Last reply Reply Quote 0
          • cvp
            cvp @maxelon last edited by

            @maxelon ok, sorry, I didn't read it correctly. It is normal, your import would no access your external folder.

            1 Reply Last reply Reply Quote 0
            • cvp
              cvp @maxelon last edited by cvp

              @maxelon it works, if:

              • I rename both .py into mydummy and mydummy2 (perhaps is dummy system reserved)
              • I put both files in iCloud Drive/test folder (not Pythonista3 iCloud)
              • I open external folder test
              • I run mydummy2

              maxelon 1 Reply Last reply Reply Quote 0
              • maxelon
                maxelon @cvp last edited by

                @cvp thanks. That fixed things. I had been trying with the individual files in the External Files area, but once I placed the whole folder in External Files, everything works, even with the ‘dummy.py’ name. Much appreciated.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors