This library has stopped working on python 2.7
himanshu219 opened this issue · comments
Himanshu Pal commented
Reproduction steps
When running below code
print(f'''Error in converting timestamp {timestamp}''', exc_info=True)
on following environments
- Tested on Ubuntu 18.04 python 2.7
- Tested on Centos 7 python 2.7
you will see below error
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/centos/.local/lib/python2.7/site-packages/sumonetskopecollector/netskope.py", line 8, in <module>
from sumoappclient.sumoclient.base import BaseCollector
File "/usr/lib/python2.7/site-packages/sumoappclient/sumoclient/base.py", line 5, in <module>
from common.logger import get_logger
File "/usr/lib/python2.7/site-packages/sumoappclient/common/logger.py", line 4, in <module>
from common.utils import get_normalized_path
File "/usr/lib/python2.7/site-packages/sumoappclient/common/utils.py", line 52
print(f'''Error in converting timestamp {timestamp}''', exc_info=True)
^
SyntaxError: invalid syntax
I tried future-fstrings-show main.py but that also shows unconverted output
Anthony Sottile commented
Can you provide the following? I suspect you don't have it installed or you're missing the encoding cookie:
python2 -m pip freeze --all
head -n1 $(which future-fstrings-show)
head -n2 /usr/lib/python2.7/site-packages/sumoappclient/common/utils.py
If it is installed as expected I expect the following:
future-fstrings
to be contained in the first command- a path to a python2 executable to be contained in the second command
# -*- coding: future_fstrings -*-
to be contained in the third command
Anthony Sottile commented
@himanshu219 ping
Himanshu Pal commented
Thanks it was a false alarm. Apologize for raising it, the error was in exc_info=True and I got confused.