Bug #24003

Python2 Print Syntax in

Added by Ryan Lazur 12 months ago. Updated 11 months ago.

Start date:
Due date:
% Done:


Estimated time:
1.00 h


I just built icaruscode v08_41_00 and I can no longer use to launch grid jobs. The errors are related to the print statements in 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.


#1 Updated by Lynn Garren 12 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 12 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 12 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 12 months ago

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

#5 Updated by Marc Mengel 11 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, but I am running into another (similar) issue:

File "/cvmfs/", 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 11 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