Skip to content

wrap_angle attribute does not pickle properly with Longitude instance #1942

Closed

Description

@scottransom

Hi All,

So the wrap_angle attribute for a Longitude instance is used several times in the angle class, yet it does not pickle properly. See below for a simple example.

Scott

In [1]: from astropy.coordinates import Longitude, Latitude

In [2]: import cPickle

In [3]: a = Longitude(1.23, "radian", wrap_angle='180d')

In [4]: a.wrap_angle
Out[4]: <Angle 180.0 deg>

In [5]: cPickle.dump(a, open("xxx", "wb"))

In [6]: b = cPickle.load(open("xxx"))

In [7]: a
Out[7]: <Longitude 1.2300000000000004 rad>

In [8]: b
Out[8]: <Longitude 1.2300000000000004 rad>

In [9]: b.wrap_angle
ERROR: AttributeError: Longitude instance has no attribute 'wrap_angle' [astropy.units.quantity]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-c854be2560b1> in <module>()
----> 1 b.wrap_angle

/home/sransom/src/astropy_dev/astropy/units/quantity.pyc in __getattr__(self, attr)
    574             raise AttributeError(
    575                 "{0} instance has no attribute '{1}'".format(
--> 576                     self.__class__.__name__, attr))
    577         else:
    578             return value

AttributeError: Longitude instance has no attribute 'wrap_angle'

Activity

  1. added a commit that references this issue on Jan 14, 2014
  2. added a commit that references this issue on Jan 21, 2014
  3. mhvk commented on Jan 21, 2014

    @mhvk
    Contributor

    Closed by #1961

  4. added 3 commits that reference this issue on Feb 12, 2014
  5. added a commit that references this issue on Oct 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions