You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error when I'm trying to run your example code with python 3.9
Code:
importtypedparsefromtypingimportOptionaldefmain(file: str, number: Optional[int] =6):
"""Display first lines of a file. Args: file: file to display number: number of lines to display """withopen(file, "r") asf:
foriinrange(0, number):
print(f.readline(), end="")
if__name__=="__main__":
typedparse.parse(main, generate_short_flags=True)
Error:
Traceback (most recent call last):
File "/Users/nikita/Projects/personal/keynote-highlight/keynote_highlight/main.py", line 56, in <module>
typedparse.parse(main, generate_short_flags=True)
File "/Users/nikita/Library/Caches/pypoetry/virtualenvs/keynote-highlight-P7sqe0O--py3.9/lib/python3.9/site-packages/typedparse/__init__.py", line 27, in parse
return ArgParserFactory(generate_short_flags=generate_short_flags).create(obj).parse()
File "/Users/nikita/Library/Caches/pypoetry/virtualenvs/keynote-highlight-P7sqe0O--py3.9/lib/python3.9/site-packages/typedparse/argparse.py", line 132, in create
return ArgParserLeaf(self._parser, obj, self._generate_short_flags)
File "/Users/nikita/Library/Caches/pypoetry/virtualenvs/keynote-highlight-P7sqe0O--py3.9/lib/python3.9/site-packages/typedparse/argparse.py", line 90, in __init__
kwargs.update(type=type_func or spec.get_class(tpe))
File "/Users/nikita/Library/Caches/pypoetry/virtualenvs/keynote-highlight-P7sqe0O--py3.9/lib/python3.9/site-packages/typedparse/spec.py", line 180, in get_class
m = getattr(m, comp)
AttributeError: module 'typing' has no attribute 'Optional[int]'
Process finished with exit code 1
The text was updated successfully, but these errors were encountered:
I get the following error when I'm trying to run your example code with python 3.9
Code:
Error:
The text was updated successfully, but these errors were encountered: