GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
go4init.py
Go to the documentation of this file.
1 
2 """
3 Add PyROOT-bound go4 object to builtins
4 this allows it to be accessed inside imported modules, cf. go4py.go4.go4Wrapper
5 """
6 
7 
8 try:
9  go4
10 except NameError as e:
11  msg = "Are you importing go4init outside of Go4?"
12  a = list(e.args)
13  a[0] += "\n" + " " * len("NameError: ") + msg
14  e.args = tuple(a)
15  raise
16 
17 try:
18  import __builtin__
19 except ImportError:
20  import builtins as __builtin__ # name change in p3
21 
22 __builtin__.go4 = go4