'ImportError: attempted relative import with no known parent package despite having __init__.py
D:.
││
├───common
│ selenium_helper.py
│ __init__.py
│
│
├───test
│ test.py
│
I have the above directory structure and i want to import selenium_helper into test.py My test.py contains the following simple code
from ..common.selenium_helper import options
print("hello world")
when i run the test.py i get the following error.
I went through many SO posts but still not able to make this work
Traceback (most recent call last):
File "test.py", line 1, in <module>
from ..common.selenium_helper import options
ImportError: attempted relative import with no known parent package
Is there a way to resolve this issue without modifying or appending to sys path
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|