{"action":"created","issue":{"url":"https://api.github.com/repos/h5py/h5py/issues/619","labels_url":"https://api.github.com/repos/h5py/h5py/issues/619/labels{/name}","comments_url":"https://api.github.com/repos/h5py/h5py/issues/619/comments","events_url":"https://api.github.com/repos/h5py/h5py/issues/619/events","html_url":"https://github.com/h5py/h5py/issues/619","id":106087288,"number":619,"title":"h5py will not overwrite when file has user block","user":{"login":"dborncamp","id":5557758,"avatar_url":"https://avatars.githubusercontent.com/u/5557758?v=3","gravatar_id":"","url":"https://api.github.com/users/dborncamp","html_url":"https://github.com/dborncamp","followers_url":"https://api.github.com/users/dborncamp/followers","following_url":"https://api.github.com/users/dborncamp/following{/other_user}","gists_url":"https://api.github.com/users/dborncamp/gists{/gist_id}","starred_url":"https://api.github.com/users/dborncamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dborncamp/subscriptions","organizations_url":"https://api.github.com/users/dborncamp/orgs","repos_url":"https://api.github.com/users/dborncamp/repos","events_url":"https://api.github.com/users/dborncamp/events{/privacy}","received_events_url":"https://api.github.com/users/dborncamp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-09-11T20:23:08Z","updated_at":"2015-09-15T21:00:14Z","closed_at":null,"body":"Lets say I create a file in the following way, using h5py version 2.1.3:\r\n\r\n``` Python\r\nimport numpy as np \r\nimport h5py\r\n\r\ndef newfile(filename):\r\n    '''This is a test function for creating an HDF5 file.'''\r\n\r\n    # create dummy data for now\r\n    data = np.zeros(100)\r\n\r\n    # create the file and stick data in a dataset in the root group\r\n    with h5py.File(filename, mode=\"w\", userblock_size=512) as f:\r\n        f['dataset'] = data\r\n\r\n    # populate the user block with something after file has been closed\r\n    with open(filename, \"rb+\") as f:\r\n        f.write('This is a test of the user block, just a place to put ' +\r\n                'random data')\r\n```\r\nWhen this file does not exist, this function creates a new file as expected with data and the user block is populated. However, if I try to run the same function after the file is already created (ie. running it twice without removing the file) I receive:\r\n\r\n``` Python\r\nIOError: unable to create file (File accessibilty: Unable to open file)\r\n```\r\n\r\nThis was surprising to me. I expected that this file would be overwritten because I initially opened the file with mode=\"w\" which is supposed to overwrite.\r\n\r\nBut, if I remove the user block creation from the original file creation the file is successfully overwritten as expected. Did I do something wrong in creating the user block data or did I stumble onto an issue with HDF5 and user blocks that I am not correctly handling?\r\n\r\nI posted this on [stack overflow](http://stackoverflow.com/questions/32383132/h5py-will-not-overwrite-when-file-has-user-block), but got no answers so either no one cares or no one knows (I did receive a badge for no answers...)."},"comment":{"url":"https://api.github.com/repos/h5py/h5py/issues/comments/140538021","html_url":"https://github.com/h5py/h5py/issues/619#issuecomment-140538021","issue_url":"https://api.github.com/repos/h5py/h5py/issues/619","id":140538021,"user":{"login":"andrewcollette","id":3101370,"avatar_url":"https://avatars.githubusercontent.com/u/3101370?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewcollette","html_url":"https://github.com/andrewcollette","followers_url":"https://api.github.com/users/andrewcollette/followers","following_url":"https://api.github.com/users/andrewcollette/following{/other_user}","gists_url":"https://api.github.com/users/andrewcollette/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewcollette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewcollette/subscriptions","organizations_url":"https://api.github.com/users/andrewcollette/orgs","repos_url":"https://api.github.com/users/andrewcollette/repos","events_url":"https://api.github.com/users/andrewcollette/events{/privacy}","received_events_url":"https://api.github.com/users/andrewcollette/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T21:00:14Z","updated_at":"2015-09-15T21:00:14Z","body":"@dborncamp, it should be h5py.version.hdf5_version or similar.  But I have to warn you that 2.1.3 is very old and you might try with a more recent version if at all possible."}}