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

Fix confusing error in abi_l1b reader when file fails to open #615

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Feb 13, 2019

Sometimes there are cases where the ABI L1B reader can't open a file and it never creates self.nc. In these cases the __del__ method was trying to access self.nc.close() and failing with an AttributeError. This AttributeError was getting through to the user and making the overall issue with their use of the reader confusing. This PR catches the AttributeError and stops it from being shown to the user. The rest of the reader should still properly report what went wrong with opening the file (not found, etc).

  • Closes #xxxx
  • Tests added
  • Tests passed
  • Passes git diff origin/master -- "*py" | flake8 --diff
  • Fully documented

@djhoese
Copy link
Member Author

djhoese commented Feb 13, 2019

For reference the message was something like:

Traceback (most recent call last):
  File "/home/graemem/workspace/g2g_1_0_0/geo2grid_v_1_0_0/lib/python3.6/site-packages/satpy/readers/abi_l1b.py", line 220, in __del__
    self.nc.close()
AttributeError: 'NC_ABI_L1B' object has no attribute 'nc'

@codecov
Copy link

codecov bot commented Feb 13, 2019

Codecov Report

Merging #615 into master will not change coverage.
The diff coverage is 50%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #615   +/-   ##
=======================================
  Coverage   78.33%   78.33%           
=======================================
  Files         136      136           
  Lines       19714    19714           
=======================================
  Hits        15442    15442           
  Misses       4272     4272
Impacted Files Coverage Δ
satpy/readers/abi_l1b.py 96.63% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57c7d21...2c16c2e. Read the comment docs.

@djhoese djhoese merged commit f55d08a into pytroll:master Feb 13, 2019
@djhoese djhoese deleted the bugfix-abi-l1b-bad-file branch February 13, 2019 19:05
@coveralls
Copy link

Coverage Status

Coverage remained the same at 78.33% when pulling 2c16c2e on djhoese:bugfix-abi-l1b-bad-file into 57c7d21 on pytroll:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants