Project

General

Profile

Bug #24003

Python2 Print Syntax in project.py

Added by Ryan Lazur 2 months ago. Updated about 2 months ago.

Status:
Resolved
Priority:
High
Start date:
02/04/2020
Due date:
% Done:

0%

Estimated time:
1.00 h
Duration:

Description

I just built icaruscode v08_41_00 and I can no longer use project.py to launch grid jobs. The errors are related to the print statements in project.py that have the ancient python2 syntax (no parenthesis). I have tried importing future.print_function and that didn't help. I also tried using the usual python updating software like futurize and 2to3, neither worked for me.

History

#1 Updated by Lynn Garren 2 months ago

In most cases, editing by hand works.

See this from Chris Green.
With the possible exception of automatic handling of the change to use the Python 3-style print function, I concur. Personally, I use six where appropriate to allow my Python code to work with Python 2.6 all the way through Python 3.7, which is what contributions to Spack must support.

#2 Updated by Ryan Lazur 2 months ago

I tried fixing it by hand but there are > 200 print statements. Also when I try to run with Python2.7 I get an error related to not being able to find the 'os' library. Also I do not get this issue when I am on the SBND gpvms running sbndcode. Am I doing something incorrectly when setting up new icaruscode?

#3 Updated by Lynn Garren 2 months ago

From Herb:

I'm working on updating larbatch.  If you want to try updating your 
checked out version, try running the following command.

$ cd $MRB_SOURCE/larbatch
$ find . -name \*.py -exec 2to3 -w {} \;

Note that there are many issues besides just print statements.

#4 Updated by Herbert Greenlee 2 months ago

Updates for python 3 have been merged to master branch. Now, project.py and other python utilities in larbatch are supposed to be compatible with either python 2 or python 3.

#5 Updated by Marc Mengel about 2 months ago

Updated by Ryan Lazur 5 days ago

Thank you, Herb! That's great.

I pulled the newest branch and am no longer having issues with the code in project.py, but I am running into another (similar) issue:

File "/cvmfs/icarus.opensciencegrid.org/products/icarus/icarusutil/v08_41_00/python/experiment_utilities.py", line 51
raise RuntimeError, 'Missing or invalid metadata for file %s.' % filename

I can run your helpful updating script on the files in icarusutil, but this should probably be fixed upstream.

#6 Updated by Lynn Garren about 2 months ago

  • Assignee set to Herbert Greenlee
  • Status changed from New to Resolved

Ryan, see Herb's talk at the LArSoft Coordination meeting this morning for more information.

I am resolving this issue.



Also available in: Atom PDF