AdmiralenOla / Scoary

Pan-genome wide association studies
GNU General Public License v3.0
147 stars 35 forks source link

fix ValueError: invalid mode: 'rU' with python3.11 #106

Open emollier opened 1 year ago

emollier commented 1 year ago

Since python3, the universal newline mode 'U' has no effects. Since python3.11, that mode is obsolete and its use raises:

Command: scoary.py -g scoary/exampledata/Gene_presence_absence.csv -t scoary/exa
mpledata/Tetracycline_resistance.csv -o Test1 --no-time
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/scoary.py", line 25, in <module>
    methods.main()
  File "/<<PKGBUILDDIR>>/scoary/methods.py", line 184, in main
    with open(args.genes, "rU") as genes, \
         ^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid mode: 'rU'

Note this patch suppresses various references to the 'U' mode in calls to the "open" function, which most likely breaks compatibility of Scoary with python2. Given that this interpreter version is out of maintenance since 2020, it should not be too problematic.

dr-joe-wirth commented 1 year ago

Thanks for this. Hopefully this will be merged in the next release.