{"action":"created","issue":{"url":"https://api.github.com/repos/pydata/pandas/issues/9734","labels_url":"https://api.github.com/repos/pydata/pandas/issues/9734/labels{/name}","comments_url":"https://api.github.com/repos/pydata/pandas/issues/9734/comments","events_url":"https://api.github.com/repos/pydata/pandas/issues/9734/events","html_url":"https://github.com/pydata/pandas/issues/9734","id":64542211,"number":9734,"title":"HDFStore: AttributeError: __exit__ in with statement","user":{"login":"cachitas","id":2321514,"avatar_url":"https://avatars.githubusercontent.com/u/2321514?v=3","gravatar_id":"","url":"https://api.github.com/users/cachitas","html_url":"https://github.com/cachitas","followers_url":"https://api.github.com/users/cachitas/followers","following_url":"https://api.github.com/users/cachitas/following{/other_user}","gists_url":"https://api.github.com/users/cachitas/gists{/gist_id}","starred_url":"https://api.github.com/users/cachitas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cachitas/subscriptions","organizations_url":"https://api.github.com/users/cachitas/orgs","repos_url":"https://api.github.com/users/cachitas/repos","events_url":"https://api.github.com/users/cachitas/events{/privacy}","received_events_url":"https://api.github.com/users/cachitas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pydata/pandas/labels/HDF5","name":"HDF5","color":"5319e7"},{"url":"https://api.github.com/repos/pydata/pandas/labels/Usage%20Question","name":"Usage Question","color":"0052cc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-26T14:37:00Z","updated_at":"2015-03-27T13:57:41Z","closed_at":"2015-03-27T13:57:41Z","body":"I have this method in a class:\r\n\r\n    def save(self, filename, key='/'):\r\n        \"\"\"Saves to an HDF5 store.\"\"\"\r\n        with pd.HDFStore(filename) as store:\r\n            for g in self.GENDERS:\r\n                df = getattr(self, g)\r\n                store.put(key+g, df,\r\n                          data_columns=df.columns,\r\n                          format='table',\r\n                          encoding='utf-8',\r\n                          dropna=False)\r\n\r\nand in my Unittest:\r\n\r\n    def test_save_to_hdf(self):\r\n        td = TrackData()\r\n        with tempfile.NamedTemporaryFile(suffix='.h5') as temp:\r\n            td.save(temp.name)\r\n\r\nWhen I run nosetests I get this:\r\n\r\n    ERROR: test_save_to_hdf (courtana.tracker.tests.test_trackdata.TestTrackData)\r\n    ----------------------------------------------------------------------\r\n    Traceback (most recent call last):\r\n      File \"/home/hugo/projects/courtana/courtana/tracker/tests/test_trackdata.py\", line 34, in test_save_to_hdf\r\n        td.save(temp.name)\r\n      File \"/home/hugo/projects/courtana/courtana/tracker/trackdata.py\", line 54, in save\r\n        with pd.HDFStore(filename) as store:\r\n    AttributeError: __exit__\r\n\r\nWhy did this suddenly stop working?\r\n"},"comment":{"url":"https://api.github.com/repos/pydata/pandas/issues/comments/86946979","html_url":"https://github.com/pydata/pandas/issues/9734#issuecomment-86946979","issue_url":"https://api.github.com/repos/pydata/pandas/issues/9734","id":86946979,"user":{"login":"cachitas","id":2321514,"avatar_url":"https://avatars.githubusercontent.com/u/2321514?v=3","gravatar_id":"","url":"https://api.github.com/users/cachitas","html_url":"https://github.com/cachitas","followers_url":"https://api.github.com/users/cachitas/followers","following_url":"https://api.github.com/users/cachitas/following{/other_user}","gists_url":"https://api.github.com/users/cachitas/gists{/gist_id}","starred_url":"https://api.github.com/users/cachitas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cachitas/subscriptions","organizations_url":"https://api.github.com/users/cachitas/orgs","repos_url":"https://api.github.com/users/cachitas/repos","events_url":"https://api.github.com/users/cachitas/events{/privacy}","received_events_url":"https://api.github.com/users/cachitas/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T13:57:41Z","updated_at":"2015-03-27T13:57:41Z","body":"I figured it out. For some reason I had version 0.16.0 in my virtualenv but when `nosetests` ran it was reporting 0.14... I reactivated it and it was solved. Looks like this was only a version issue from my side."}}