Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h5py writing files python3.7 #5

Open
hagabbar opened this issue Jul 30, 2020 · 1 comment
Open

h5py writing files python3.7 #5

hagabbar opened this issue Jul 30, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@hagabbar
Copy link
Owner

Describe the bug
h5py doesn't have permission to write files in python3.7.

To Reproduce
So I ran the gen_train() command and it certainly does try to generate 1000 signals but I get this error at the end.

Made waveform 999/1000
Generated: ./training_sets_3det_9par_256Hz/tset_tot-1000_split-1000/data_1000-1000.h5py ...
Traceback (most recent call last):
File "", line 1, in
File "/home/chrism/vitamin_b/vitamin_b/run_vitamin.py", line 461, in gen_train
hf = h5py.File('%s/data_%d-%d.h5py' % (params['train_set_dir'],(i+params['tset_split']),params['tot_dataset_size']), 'w')
File "/home/chrism/vitamin_b/myenv/lib/python3.7/site-packages/h5py/_hl/files.py", line 394, in init
swmr=swmr)
File "/home/chrism/vitamin_b/myenv/lib/python3.7/site-packages/h5py/_hl/files.py", line 176, in make_fid
fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 105, in h5py.h5f.create
OSError: Unable to create file (unable to lock file, errno = 5, error message = 'Input/output error’)

Something hard coded won’t allow a general user to run this.

@hagabbar hagabbar added the bug Something isn't working label Jul 30, 2020
@hagabbar hagabbar changed the title h5py writing files h5py writing files python3.7 Aug 5, 2020
@MarlinSchaefer
Copy link

I think this bug could also be due to a not properly closed file. Not sure if it is still around once the machine is restarted. To avoid issues like these one can write to HDF5 files using the with statements. It always closes the file properly, even in the event that the code errors out during the writing process.

with h5py.File(file_path, 'w') as hf:
    #Write to file like before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants