Unhelpful error message from parse_area_file if file not found
Open
Nobody has claimed this yet.
bug
documentation
- Dominant language
- Python
- Stars
- 385
- Forks
- 102
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 9
Description
Code Sample, a minimal, complete, and verifiable piece of code
from pyresample.area_config import parse_area_file
parse_area_file("filenotfound")
Problem description
This fails with an AttributeError. This wasted me some time as I thought that the problem was with the contents of the yaml-file or elsewhere.
Expected Output
I'd like to see this raise a FileNotFoundError.
Actual Result, Traceback if applicable
Traceback (most recent call last):
File "mwe6.py", line 2, in <module>
parse_area_file("filenotfound")
File "/media/nas/x21324/miniconda3/envs/py37e/lib/python3.7/site-packages/pyresample/area_config.py", line 104, in parse_area_file
return _parse_yaml_area_file(area_file_name, *regions)
File "/media/nas/x21324/miniconda3/envs/py37e/lib/python3.7/site-packages/pyresample/area_config.py", line 139, in _parse_yaml_area_file
area_dict = _read_yaml_area_file_content(area_file_name)
File "/media/nas/x21324/miniconda3/envs/py37e/lib/python3.7/site-packages/pyresample/area_config.py", line 123, in _read_yaml_area_file_content
area_dict = recursive_dict_update(area_dict, tmp_dict)
File "/media/nas/x21324/miniconda3/envs/py37e/lib/python3.7/site-packages/pyresample/utils/__init__.py", line 231, in recursive_dict_update
for k, v in u.items():
AttributeError: 'str' object has no attribute 'items'
Versions of Python, package at hand and relevant dependencies
Python 3.7.3, pyresample 1.13.2.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pyresample/area_config.py at parse_area_file, then follow _parse_yaml_area_file to _read_yaml_area_file_content and the recursive_dict_update call. Reproduce the missing-file example from the issue and verify that parse_area_file raises FileNotFoundError instead of the reported AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100