Digital Marketing

Fix python "Attempted relative import in non-package"

You can launch your script with the '-m' argument:
python -m ca.i88.tests.example

if __name__ == '__main__':
    if __package__ is None:
        import sys
        from os import path
        sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) )
        from ca.i88 import myfunc
        from import myfunc


Popular posts from this blog

Make online money from the Internet