I am trying to use finviz package (written for python 3) in my codes in Python 2. When importing I get SyntaxError:
values = f'tickers: {tuple(self._tickers)}\n' \
^
SyntaxError: invalid syntax
The code in question looks like this in the library:
def __repr__(self):
""" Returns a string representation of the parameter's values. """
values = f'tickers: {tuple(self._tickers)}\n' \
f'filters: {tuple(self._filters)}\n' \
f'rows: {self._rows}\n' \
f'order: {self._order}\n' \
f'signal: {self._signal}\n' \
f'table: {self._table}\n' \
f'table: {self._custom}'
return values
finviz's API is here and this part is in screener.py
3to2is a thing, but a package designed purely for Python 3 is unlikely to backport to Python 2 without some manual intervention. Point is, even if we solved this specific problem for you, the code is likely littered with other Python 3-only things (some of which won't be so obvious as to triggerSyntaxErrors, they might just silently misbehave).3to2with no success.SyntaxErrors are obvious; subtleties in library usage, exception hierarchies, text/binary mismatches, etc. may not be caught at all, and spending your effort backporting to Python 2 rather than porting forward to Python 3 is a waste of limited resources. Either port to Python 3, or don't usefinvizuntil you do.