`SkyCoord == str` raises an error, instead of returning `False`
See original GitHub issueDescription
When doing an equality check between a SkyCoord
and a str
, an error is raised.
Expected behavior
Returns False
.
Actual behavior
Raised an error.
Steps to Reproduce
from astropy import units as u
from astropy.coordinates import SkyCoord
c = SkyCoord(ra=10.625*u.degree, dec=41.2*u.degree, frame='icrs')
print(c == 'my_string')
Traceback (most recent call last):
File "/Users/dstansby/github/sunpy/test.py", line 4, in <module>
print(c == 'my_string')
File "/Users/dstansby/miniconda3/envs/dev/lib/python3.9/site-packages/astropy/coordinates/sky_coordinate.py", line 368, in __eq__
for attr in self._extra_frameattr_names | value._extra_frameattr_names:
AttributeError: 'str' object has no attribute '_extra_frameattr_names'
System Details
macOS-10.16-x86_64-i386-64bit Python 3.9.1 (default, Dec 11 2020, 06:28:49) [Clang 10.0.0 ] Numpy 1.19.3 astropy 4.2.1 Scipy 1.5.4 Matplotlib 3.4.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
SkyCoord — Astropy v5.2
Insert coordinate values before the given indices in the object and return a new Frame object. The values to be inserted must conform...
Read more >Error when creating a SkyCoord object. · Issue #3399
I haven't managed to track down the error explicitly, but the exception I get if I try passing a string (rather than byte)...
Read more >Source code for astropy.coordinates.sky_coordinate
_sky_coord_frame.has_data: raise ValueError('Cannot create a SkyCoord without data') @property def frame(self): return self._sky_coord_frame @property def ...
Read more >astropy.coordinates.baseframe — gala v0.1.2
We copy attributes instead of linking to make sure there's no ... return value, False def __get__(self, instance, frame_cls=None): out = None if...
Read more >galpy.orbit.Orbits — galpy v1.7.2 documentation
coordinates import SkyCoord except ImportError: SkyCoord = None _APY_COORD_LOADED= False if _APY_LOADED: from astropy import units # Separate like this, because ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👍
@dstansby , since it is your idea, do you want to open a PR implementing https://github.com/astropy/astropy/issues/11661#issuecomment-829366618? 😸