[Scons-dev] no more print statements in SConscripts?

Tim Jenness tjenness at lsst.org
Wed May 25 14:19:47 EDT 2016


> On May 25, 2016, at 11:16 , Bill Deegan <bill at baddogconsulting.com> wrote:
> 
> I think this is a python global flag isn't it?
> I don't think you can turn it on and off selectively?
> 

It’s per file. If you add

from __future__ import print_function

at the top of your file that file will have print(). Without it the print will be a statement. What you can’t do is change print from a statement to a function or vice versa in the middle of a file (so that __future__ import must be at the top of the file).

I don’t really know how SConstruct files are imported so it may be that there is something about the importing that inherits the print_function state of the code doing the reading of the file (are they read and then evaled?). If they are read and then the string evaluated that might explain the problem. If they are imported with importlib then I’m confused.

— 
Tim Jenness


More information about the Scons-dev mailing list