pyknit.py main() fails to run
ben-hampson opened this issue · comments
The main()
function isn't working properly.
Attempt 1: in the CLI: pyknit 'k2 p4'
:
pyKnit 0.0.3
Traceback (most recent call last):
File "/Users/bhampson/code/learn/pycon-us-2021/pyknit/venv-3.8-jupyter/bin/pyknit", line 33, in <module>
sys.exit(load_entry_point('pyknit', 'console_scripts', 'pyknit')())
File "/Users/bhampson/code/learn/pycon-us-2021/pyknit/pyknit/pyknit/pyknit.py", line 213, in main
print(pyknit.parse_written(args.instruction_row, legend))
NameError: name 'pyknit' is not defined
Attempt 2: Running using the venv Python interpreter: /Users/bhampson/code/learn/pycon-us-2021/pyknit/venv-3.8-jupyter/bin/python /Users/bhampson/code/learn/pycon-us-2021/pyknit/pyknit/pyknit/pyknit.py
:
Traceback (most recent call last):
File "/Users/bhampson/code/learn/pycon-us-2021/pyknit/pyknit/pyknit/pyknit.py", line 13, in <module>
from pyknit import GaugeSwatch, Chart
File "/Users/bhampson/code/learn/pycon-us-2021/pyknit/pyknit/pyknit/pyknit.py", line 13, in <module>
from pyknit import GaugeSwatch, Chart
ImportError: cannot import name 'GaugeSwatch' from partially initialized module 'pyknit' (most likely due to a circular import) (/Users/bhampson/code/learn/pycon-us-2021/pyknit/pyknit/pyknit/pyknit.py)
Related error:
https://github.com/terriko/pyknit/blame/main/pyknit/pyknit.py#L200
parse_written
is not imported.
I suspect that's because of some restructuring we did to the class. It should probably be import pyknit
and then use pyknit.GaugeSwatch
and the like the way we do in the updated examples.
I was able to resolve this error by renaming pyknit.py
and importing it as the last import of __init__.py
I was able to resolve this error by renaming pyknit.py and importing it as the last import of
__init__.py
#43