IngoMeyer441/simple-term-menu

Syntax error at python 3.5

ostanislaw opened this issue · 5 comments

Version 0.11.0 works fine

$ python3 --version
Python 3.5.2

Any version since 1.0.0 till latest 1.4.0 seems to be incompatible with python 3.5, but currently at pypi the required python version is specified as python=~3.5

./test.py 
Traceback (most recent call last):
  File "./test.py", line 3, in <module>
    from simple_term_menu import TerminalMenu
  File "/home/developer/.local/lib/python3.5/site-packages/simple_term_menu.py", line 566
    ):
    ^
SyntaxError: invalid syntax

test file, simply try to import:

$ cat test.py 
#!/usr/bin/env python3

from simple_term_menu import TerminalMenu

Could it be the trailing comma in the line before?

title: Optional[Union[str, Iterable[str]]] = None,
):

Could it be the trailing comma in the line before?

title: Optional[Union[str, Iterable[str]]] = None,
):

I don't think so. The trailing comma was there before at v0.11.0 (which was compatible with python 3.5):
v0.11.0...v1.0.0

I would suspect line 501 *, whatever it is

Thanks at @ostanislaw and @GPMueller for pointing me to this problem. The trailing comma is indeed the problem. Before v1.0.0, no arguments were keyword-only arguments (started by *,) and a trailing comma was allowed in Python 3.5 in such parameter lists. With keyword-only arguments, a trailing comma is only allowed in Python >= 3.6 (for whatever reason, since keyword-only arguments are part of the language since Python 3.0). I removed the trailing comma, added a CI check for Python 3.5 compatibility and published a new release (v1.4.1) which should now work with Python 3.5.

Thanks for the quick fix :)

Confirmed, version 1.4.1 is fixed. Thanks, that was really quick.