Running python3 in batch mode (no windows)

Dear python helpers.
A nice feature that we had in python2 was the “-b” to request python not to open any window while being run. I am a user of python and ROOT framework (CERN) and I need to create several hundreds of plots, each one is a window that would open separately in order to save it. With option “-b” my code would just printout the name of the file being saved but now “-b” (from help() ), is
-b : issue warnings about str(bytes_instance), str(bytearray_instance)
and comparing bytes/bytearray with str. (-bb: issue errors)
Is there any way to retrieve the no-window option again in python3?
If not, would it be possible for it to be re-implemented?

Thanks in advance for the feedback.

Best regards
Mário Sousa

1 Like

I actually found a possible workaround for ROOT itself:
import ROOT
ROOT.gROOT.SetBatch( True )

But still to have the same option for python would be useful.

I don’t know what option you’re referring to, or what version of Python had it. The last few versions of Python 2 had the -b we have today.

If you’re on Windows and don’t want the Python process to open a command-line window, run pythonw.exe instead of python.exe. If you don’t want your code to open matplotlib windows or similar, then that’s your code’s prerogative, not the interpreter’s.

I don’t think that is correct.

In Python 2.4 and 2.5, there is no -b option:

[steve@ando ~]$ python2.4 -b 

Unknown option: -b

and the same for 2.5.

In 2.6 and 2.7, the -b option is gives a warning when comparing str with


Can you check your environment and version? Perhaps you were running

ipython or something else?