I'm running into an error when attempting to import a file in the parent directory.
Code from test/log_line.py
:
#! /usr/bin/env python3
from ..lib_common import log_line
Error:
$ py -3 test/log_line.py
Traceback (most recent call last):
File "test/log_line.py", line 2, in <module>
from .. import lib_common
ImportError: attempted relative import with no known parent package
Directory Structure:
./
| test/
| | log_line.py
| lib_common.py
| __init__.py
lib_common.py
contains the log_line
function.
Added __init__.py
at the suggestion of @Pavel.
Any idea why Python is giving me the error? Googling the traceback returned one somewhat-related result. No luck.