Besancon query regular expression matching failure
- Dominant language
- Python
- Stars
- 791
- Forks
- 451
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 4
Description
Hello,
I've been having some trouble with Besancon model queries lately. Queries that used to work for me now return a regular expression matching error when it looks for a file of some sort. This error seems to pop up for any galactic longitude/latitude pair that I choose. Below is an example of the failure that I'm seeing.
thanks,
Bryan
```
from astroquery.besancon import Besancon
coord1 = 112.3
coord2 = -21.8
area = 0.000326 # square degrees
model = Besancon.query(coord1, coord2, smallfield=True, area=area,
colors_limits={"J-H": (-99, 99), "J-K": (-99, 99),
"J-L": (-99, 99), "V-K": (-99, 99)},
retrieve_file=True, email=my_email)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/anaconda3/envs/mirage_osx/lib/python3.6/site-packages/astroquery/besancon/core.py in _parse_result(self, response, verbose, retrieve_file)
162 try:
--> 163 filename = self.result_re.search(text).group()
164 except AttributeError: # if there are no matches
AttributeError: 'NoneType' object has no attribute 'group'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
~/anaconda3/envs/mirage_osx/lib/python3.6/site-packages/astroquery/besancon/core.py in parse_errors(text)
351 """, re.X)
--> 352 text = errors.search(text).group()
353 except AttributeError:
AttributeError: 'NoneType' object has no attribute 'group'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
in
----> 1 model = Besancon.query(coord1, coord2, smallfield=True, area=area.value, colors_limits={"J-H": (-99, 99), "J-K": (-99, 99), "J-L": (-99, 99), "V-K": (-99, 99)}, retrieve_file=True, email='hilbert@stsci.edu')
~/anaconda3/envs/mirage_osx/lib/python3.6/site-packages/astroquery/utils/class_or_instance.py in f(*args, **kwds)
23 def f(*args, **kwds):
24 if obj is not None:
---> 25 return self.fn(obj, *args, **kwds)
26 else:
27 return self.fn(cls, *args, **kwds)
~/anaconda3/envs/mirage_osx/lib/python3.6/site-packages/astroquery/utils/process_asyncs.py in newmethod(self, *args, **kwargs)
27 if kwargs.get('get_query_payload') or kwargs.get('field_help'):
28 return response
---> 29 result = self._parse_result(response, verbose=verbose)
30 self.table = result
31 return result
~/anaconda3/envs/mirage_osx/lib/python3.6/site-packages/astroquery/besancon/core.py in _parse_result(self, response, verbose, retrieve_file)
163 filename = self.result_re.search(text).group()
164 except AttributeError: # if there are no matches
--> 165 errors = parse_errors(text)
166 raise ValueError("Errors: " + "\n".join(errors))
167
~/anaconda3/envs/mirage_osx/lib/python3.6/site-packages/astroquery/besancon/core.py in parse_errors(text)
352 text = errors.search(text).group()
353 except AttributeError:
--> 354 raise ValueError("Regular expression matching to error "
355 "message failed.")
356 text_items = re.split(r"
ValueError: Regular expression matching to error message failed.
```
Contributor guide
Research direction
Start in astroquery/besancon/core.py at _parse_result and parse_errors, then reproduce the Besancon.query example from the issue to inspect the response that lacks the expected match. Done means the response is handled with an appropriate parsed result or error rather than failing with the generic regular-expression matching ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100