File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 42
42
43
43
# When the TFile.Close method is called, the current directory is automatically
44
44
# set again to ROOT.gROOT. Objects that were attached to the file inside the
45
- # context are automatically deleted and made 'None' when the file is closed.
45
+ # context are automatically deleted, so they can't be accessed anymore after
46
+ # the file is closed.
46
47
print ("Status after the first TFile context manager:" )
47
48
print (" Current directory: '{}'." .format (ROOT .gDirectory .GetName ()))
48
- print (" Accessing 'histo_2' gives: '{}'. \n " . format ( histo_2 ))
49
+ # print(histo_2) # the object is deleted at this point, so don't use it anymore!
49
50
50
51
# Also reading data from a TFile can be done in a context manager. Information
51
52
# stored in the objects of the file can be queried and used inside the context.
You can’t perform that action at this time.
0 commit comments