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

Exception AttributeError: "'File' object has no attribute '_closed'" in <object repr() failed> ignore #21

Closed
laliberte opened this issue Aug 7, 2016 · 0 comments

Comments

@laliberte
Copy link
Contributor

A h5netcdf.File object that failed to open in read-only mode is not properly garbage collected in python 2.7.

import h5netcdf
try:
    h5netcdf.File('testfile.nc','r')
except IOError:
    pass

Exception AttributeError: "'File' object has no attribute '_closed'" in <object repr() failed> ignored
shoyer pushed a commit that referenced this issue Aug 8, 2016
* A few fixes. 1) both groups and variables can be lazily evaluated and 2) no h5py object is stored in subsequent classes. This feature was causing segmentation faults when reading arrays with str datatype.

* Private classes are important for compatibility with legacyapi

* Fixed a typo

* creation and lazy loading are tricky. Added method set for creation.

* Fixed typo

* Added __len__ to lazy objects

* A few fixes. 1) both groups and variables can be lazily evaluated and 2) no h5py object is stored in subsequent classes. This feature was causing segmentation faults when reading arrays with str datatype.

* Private classes are important for compatibility with legacyapi

* Fixed a typo

* creation and lazy loading are tricky. Added method set for creation.

* Fixed typo

* Added __len__ to lazy objects

* Rebase changes

* compare array elements

* Made lazy by default. Modifed the tests accordingly.

* changed tests for string array

* Mimicking netCDF4 API

* Excluded testing char arrays when a pure h5py call would fail. I do not expect h5netcdf to succeed where h5py fails.

* Added a description for the new lazy feature

* made lazy_objects a Mapping type. Removed the redundant keys method

* Removed several redundancies with the use of an add method in lazy_objects

* raise KeyError when missing to allow for inclusion testing

* Removed OrderedDict because it is not used anymore

* Removed blank returns

* Converted list to set for performance

* Converted set to __setitem__

* Make raise consistent with Python mappings

* Performance

* Made the _object_names with two constructor for clarity

* use add instead of append on sets

* Removed white spaces

* Change _object_names to _LazyObjectLookup

* Changed to OrderedDict

* Typo

* Typo

* Whitespace

* Change != to is not and object to obj to avoid shadowing

* Created new function _join_h5paths

* Fixed a bug where deleting a h5netcdf.File object that failed to open a h5py.File in reading mode leads to an exception. Added a test case.

* Added a test to check that opening a nonexistent file for reading does not lead to an AttributeError on quit

* Force garbage collection in test

* Force closing of h5netcdf.File object raises AttributeError

* Fixed whitespaces and remove former changelog

* whitespace and more robust garbage collection check

* Style adjustsments

* Robust checking of garbage collection

* Make it clearer and specifically catch all exceptions

* Streamlined the fail at read-only test
@shoyer shoyer closed this as completed Sep 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants