{"action":"created","issue":{"url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/10","repository_url":"https://api.github.com/repos/linnarsson-lab/loompy","labels_url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/10/comments","events_url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/10/events","html_url":"https://github.com/linnarsson-lab/loompy/issues/10","id":270397550,"number":10,"title":"Better file open/closing in `create`","user":{"login":"olgabot","id":806256,"avatar_url":"https://avatars2.githubusercontent.com/u/806256?v=4","gravatar_id":"","url":"https://api.github.com/users/olgabot","html_url":"https://github.com/olgabot","followers_url":"https://api.github.com/users/olgabot/followers","following_url":"https://api.github.com/users/olgabot/following{/other_user}","gists_url":"https://api.github.com/users/olgabot/gists{/gist_id}","starred_url":"https://api.github.com/users/olgabot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olgabot/subscriptions","organizations_url":"https://api.github.com/users/olgabot/orgs","repos_url":"https://api.github.com/users/olgabot/repos","events_url":"https://api.github.com/users/olgabot/events{/privacy}","received_events_url":"https://api.github.com/users/olgabot/received_events","type":"User","site_admin":false},"labels":[{"id":571923247,"url":"https://api.github.com/repos/linnarsson-lab/loompy/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":30,"created_at":"2017-11-01T18:03:05Z","updated_at":"2018-03-20T17:13:15Z","closed_at":"2018-03-20T08:07:01Z","author_association":"NONE","body":"In testing `loompy` I've had to rerun several times because I made an error in the input, but when I rerun, I get `OSError` because the hdf5 file was opened and never closed. The file should get closed when errors happen during `create`\r\n\r\n``` \r\n---------------------------------------------------------------------------\r\nOSError                                   Traceback (most recent call last)\r\n<timed exec> in <module>()\r\n\r\n~/miniconda3/envs/loom-env/lib/python3.6/site-packages/loompy/loompy.py in create(filename, matrix, row_attrs, col_attrs, file_attrs, chunks, chunk_cache, dtype, compression_opts)\r\n   1022 \r\n   1023         # Create the file (empty).\r\n-> 1024         f = h5py.File(name=filename, mode='w')\r\n   1025         f.create_group('/layers')\r\n   1026         f.create_group('/row_attrs')\r\n\r\n~/miniconda3/envs/loom-env/lib/python3.6/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, **kwds)\r\n    267             with phil:\r\n    268                 fapl = make_fapl(driver, libver, **kwds)\r\n--> 269                 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)\r\n    270 \r\n    271                 if swmr_support:\r\n\r\n~/miniconda3/envs/loom-env/lib/python3.6/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)\r\n    103         fid = h5f.create(name, h5f.ACC_EXCL, fapl=fapl, fcpl=fcpl)\r\n    104     elif mode == 'w':\r\n--> 105         fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)\r\n    106     elif mode == 'a':\r\n    107         # Open in append mode (read/write).\r\n\r\nh5py/_objects.pyx in h5py._objects.with_phil.wrapper()\r\n\r\nh5py/_objects.pyx in h5py._objects.with_phil.wrapper()\r\n\r\nh5py/h5f.pyx in h5py.h5f.create()\r\n\r\nOSError: Unable to create file (unable to truncate a file which is already open)\r\n```"},"comment":{"url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/comments/374680706","html_url":"https://github.com/linnarsson-lab/loompy/issues/10#issuecomment-374680706","issue_url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/10","id":374680706,"user":{"login":"falexwolf","id":16916678,"avatar_url":"https://avatars1.githubusercontent.com/u/16916678?v=4","gravatar_id":"","url":"https://api.github.com/users/falexwolf","html_url":"https://github.com/falexwolf","followers_url":"https://api.github.com/users/falexwolf/followers","following_url":"https://api.github.com/users/falexwolf/following{/other_user}","gists_url":"https://api.github.com/users/falexwolf/gists{/gist_id}","starred_url":"https://api.github.com/users/falexwolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falexwolf/subscriptions","organizations_url":"https://api.github.com/users/falexwolf/orgs","repos_url":"https://api.github.com/users/falexwolf/repos","events_url":"https://api.github.com/users/falexwolf/events{/privacy}","received_events_url":"https://api.github.com/users/falexwolf/received_events","type":"User","site_admin":false},"created_at":"2018-03-20T17:13:15Z","updated_at":"2018-03-20T17:13:15Z","author_association":"NONE","body":"One should update the documentation, which states exactly the opposite behavior. This is why I never even thought that `create` would **not** truncate an existing file."}}
{"actor":{"display_login":"falexwolf"}}