I am new to python and I found a very intesting library I need to play with which is only written in python
here us part of my code
from pkgutil import get_data
grammar = get_data(__name__, "thl.lark").decode("utf-8")
Now when I run it I get
Traceback (most recent call last):
File "/Users/xxx/thl/thl-jupyter-2020/thl/test.py", line 6, in <module>
grammar = get_data(__name__, "thl.lark").decode("utf-8")
File "/xxx/.pyenv/versions/3.9.0/lib/python3.9/pkgutil.py", line 620, in get_data
spec = importlib.util.find_spec(package)
File "/xxx/.pyenv/versions/3.9.0/lib/python3.9/importlib/util.py", line 114, in find_spec
raise ValueError('{}.__spec__ is None'.format(name))
ValueError: __main__.__spec__ is None
Any idea what is going on?
question from:
https://stackoverflow.com/questions/65946554/when-running-a-simple-python-code-it-complains-about-main-and-spec-being-none 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…