Project

General

Profile

Bug #24048

Python 3 Incompatible scripts

Added by Iker de Icaza Astiz 7 days ago. Updated 1 day ago.

Status:
Closed
Priority:
Normal
Start date:
02/12/2020
Due date:
% Done:

100%

Estimated time:
Duration:

Description

Running sbndcode v08_42_00 e19:prof on SL7 I came across this traceback exception when trying to use rootstat.py:

Traceback (most recent call last):
  File "/cvmfs/larsoft.opensciencegrid.org/products/larbatch/v01_52_00/bin/rootstat.py", line 32, in <module>
    import project_utilities
  File "/cvmfs/larsoft.opensciencegrid.org/products/larbatch/v01_52_00/python/project_utilities.py", line 32, in <module>
    import larbatch_posix
  File "/cvmfs/larsoft.opensciencegrid.org/products/larbatch/v01_52_00/python/larbatch_posix.py", line 134, in <module>
    import larbatch_utilities
  File "/cvmfs/larsoft.opensciencegrid.org/products/larbatch/v01_52_00/python/larbatch_utilities.py", line 1214, in <module>
    from experiment_utilities import *
  File "/sbnd/data/users/icaza/work/sbndcode/flashmatch/localProducts_larsoft_v08_42_00_e19_prof/sbndutil/v08_42_00/python/experiment_utilities.py", line 53
    raise RuntimeError, 'Missing or invalid metadata for file %s.' % filename
                      ^
SyntaxError: invalid syntax

I have pushed branch feature/icaza_Py2ToPy3 which has changes to python/experiment_utilities.py and python/extractor_dict.py to enable them to run with Python 3. I used the python script 2to3-3.7 to make these changes.

Unfortunately I still haven't managed to get it to run all the way, now is getting stuck on rootstat.py. Look at:
https://github.com/LArSoft/larbatch/issues/7

I'll try and test if the changes on the branch I pushed work ok with Python2 and SL6 sometime next week.

I'll follow up with larbatch too.

History

#1 Updated by Iker de Icaza Astiz 2 days ago

  • % Done changed from 0 to 100
  • Status changed from New to Feedback

I confirm that my changes work with:

sbndcode          v08_43_00       -f Linux64bit+3.10-2.17 -q e19:prof

running on SL7

and

sbndcode          v08_43_00       -f Linux64bit+2.6-2.12  -q e19:prof:py2

running SL6.

So yeah, they're backwards compatible and working with Python3.

I've also formatted the script to use 4 spaces indentation and follow pep8 guidelines.

#2 Updated by Iker de Icaza Astiz 1 day ago

  • Status changed from Feedback to Closed

I've merged and to push to develop.

Also the issue with rootstat.py upstream has been solved on larbatch v01_52_02
https://github.com/LArSoft/larbatch/commit/aebfae0de5083d8a09252e8f05a57d2eeb4b249f



Also available in: Atom PDF