• h3ky1

    Thanks @stephen and @mikael

    I moved the test folder (as below - there was a higher app folder also which I have now shown here):

    app/tests/test_basic.py
    app/app/core.py

    and included this in the test_*.py scripts:

    module_path = os.path.join(os.path.dirname(sys.path[0]), 'app')
    sys.path.append(module_path)
    import core
    

    which allows for dynamic determination of the appropriate path.

    Unfortunately, this sits above an import statement and PEP 8 doesn't like it...oh well.

    posted in Pythonista read more
  • h3ky1

    I have the same problem as @RainmanNoodles. I had an app that was getting too large for Pythonista alone so I moved it to a git repository, got Working Copy and embarked on syncing between PyCharms -- Cloud Git -- Working Copy -- Pythonista.

    Along the way, I restructured everything so that I can ultimately package the app. The current problem is that while I have a pretty standard structure, I cannot seem to import at the package level. Given something like this (which works on a PC with PyCharms):

    README.md
    LICENSE
    setup.py
    requirements.txt
    app/__init__.py
    app/core.py
    app/helpers.py
    app/tests/test_basic.py
    app/tests/test_advanced.py
    docs/conf.py
    docs/index.rst
    

    The script test_basic.py cannot seem to import the core using a variety of import methods

    from app import core as core
    ...
    import app.core as core
    ...
    

    Pythonista gives the ModuleNotFoundError "No module named..." when this works on PC/PyCharms. I believe this is also true if the tests folder is at the same level as the app folder.

    I have read a few scattered things about modifying sys.path and Pythonista's inability to search up the directory tree for anything (a) not on the device AND (b) not in the Script Library...but no advice to help me solve the problem yet.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!