Closed heubi95 closed 10 years ago
According to http://stackoverflow.com/questions/16981921/python-3-relative-imports, importing from "." only seems to work properly if the application / test case is run using python -m ...
. As this is not the case when running them from the IDE (e.g. PyCharms), ImportError
s ensue.
The reason why it still worked on my machine was because I added the cutplace folder to PYTHONPATH
a long time ago.
So the current workaround of using from cutplace import ...
actually is the proper solution to this issue.
When running test_ranges.py under PyCharms, the following exception occurs:
Traceback (most recent call last): File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pycharm\utrunner.py", line 135, in
module = loadSource(a[0])
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pycharm\utrunner.py", line 40, in loadSource
module = imp.load_source(moduleName, fileName)
File "C:\Python34\lib\imp.py", line 171, in load_source
module = methods.load()
File "", line 1220, in load
File "", line 1200, in _load_unlocked
File "", line 1129, in _exec
File "", line 1471, in exec_module
File "", line 321, in _call_with_frames_removed
File "C:\Users\Heubi\Documents\GitHub\cutplace\cutplace\test_ranges.py", line 19, in
from . import ranges
SystemError: Parent module '' not loaded, cannot perform relative import