quast icon indicating copy to clipboard operation
quast copied to clipboard

Python syntax warnings and errors (python version 3.12)

Open meekrob opened this issue 9 months ago • 0 comments

I am installing from source (python setup.py install --prefix=$HOME) and seeing a lot of this kind of thing:

Extracting quast-5.3.0-py3.12.egg to /nfs/home/.../lib/python3.12/site-packages
/nfs/home/.../lib/python3.12/site-packages/quast-5.3.0-py3.12.egg/quast_libs/qutils.py:224: SyntaxWarning: invalid escape sequence '\w'
  value = convert_to_unicode(re.sub('[^\w\s-]', '-', value).strip())

All of these string literals need to be raw strings in my version of python, example:

value = convert_to_unicode(re.sub(r'[^\w\s-]', '-', value).strip())
# instead of 
value = convert_to_unicode(re.sub('[^\w\s-]', '-', value).strip())

I am also surprised to see python2 style print errors:

  File "/nfs/home/.../lib/python3.12/site-packages/quast-5.3.0-py3.12.egg/quast_libs/site_packages/joblib2/format_stack.py", line 205
    print "\nJoblib's exception reporting continues...\n"
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

  File "/nfs/home/.../lib/python3.12/site-packages/quast-5.3.0-py3.12.egg/quast_libs/site_packages/joblib2/memory.py", line 180
    print max(0, (80 - len(msg))) * '_' + msg
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

  File "/nfs/home/.../lib/python3.12/site-packages/quast-5.3.0-py3.12.egg/quast_libs/site_packages/joblib2/numpy_pickle.py", line 243
    print 'Failed to save %s to .npy file:\n%s' % (
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

And this error:

  File "/nfs/home/dking/lib/python3.12/site-packages/quast-5.3.0-py3.12.egg/quast_libs/site_packages/joblib2/disk.py", line 55
    except OSError, e:
           ^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized

I assume it is my version of python, but I chatGPT says that the issue with the escape sequences changed in version 3.6. Your installation instructions indicate using python version 3.8+, so I don't think that's true.

Is there a maximum python version that should be listed?

meekrob avatar Mar 26 '25 04:03 meekrob