Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

uproot.update #530

Description

@atasattari

Hi,
I followed the uproot documentation to update a root file by adding more trees, but I'm getting "compression" error. Here is my script:

`with uproot.update("Test_files/"+"%s.root"%'test') as f:
#making 2 trees
for i in range(2):
seriesnumber=random.randint(1010,1011-1)
dic={}
#making 5 branches
for i in range(5):
dic['zip'+str(i)]="bool"
events=(np.random.rand(10)*10**5).astype(int)

    f[str(seriesnumber)]=uproot.newtree(dic)
    
    p=np.random.rand()
    #50 entries in each branch
    for tree_name in list(dic.keys()):

            cGoodEv = np.random.choice(a=[True, False], size=(50), p=[p, 1-p])
            f[str(seriesnumber)][tree_name].newbasket(cGoodEv)` 

The error:
TypeError: _openfile() missing 1 required positional argument: 'compression'
Including a compression method I get the error below:
__init__() got an unexpected keyword argument 'compression'

Also, I noticed uproot might raise "NotImplementedError" error :
~/anaconda3/lib/python3.7/site-packages/uproot/write/TFile.py in __init__(self, path) 27 class TFileUpdate(object): 28 def __init__(self, path): ---> 29 self._openfile(path) 30 raise NotImplementedError

So i'm a bit confused. I'm wondering if this feature is implemented, and if so why my script is not working?

Thanks,
Ata @bloer @mdiamon @pibion (CDMS collaboration)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions