Fix python "Attempted relative import in non-package"
You can launch your script with the '-m' argument:
python -m ca.i88.tests.example
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
else:
from ..ca.i88 import myfunc
Comments
Post a Comment