Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import importlib
- uproot = importlib.import_module("uproot")
- t = uproot.open("test.root")["hvar"]
- for i in range(0, 400):
- with open('/home/reik/HEP/uproot-dev/uproot/uproot/write/objects/TH.py', 'r') as file:
- # read a list of lines into data
- data = file.readlines()
- # now change the 2nd line, note that you have to add a newline
- data[229] = ' self.start = {}\n'.format(i)
- # and write everything back
- with open('/home/reik/HEP/uproot-dev/uproot/uproot/write/objects/TH.py', 'w') as file:
- file.writelines(data)
- try:
- print(i)
- uproot = importlib.reload("uproot")
- print("Hi")
- with uproot.recreate("example.root") as f:
- f["test"] = t
- f = uproot.open("example.root")["test"]
- except:
- continue
- break
Advertisement
Add Comment
Please, Sign In to add comment