[AstroPy] Problems using tables

Robert Jedrzejewski rij@stsci....
Fri Nov 30 11:04:54 CST 2012


  And of course just after posting this I found Issue 341 on the github page that mentions this very problem :(

  https://github.com/astropy/astropy/issues/341

  Sorry to waste bandwidth...

  Robert J.

________________________________________
From: astropy-bounces@scipy.org [astropy-bounces@scipy.org] on behalf of Robert Jedrzejewski [rij@stsci.edu]
Sent: Friday, November 30, 2012 11:57 AM
To: astropy@scipy.org
Subject: [AstroPy] Problems using tables

  Hi folks,

  I've been playing the the tables module in astropy.  I followed the examples in the documentation (http://astropy.readthedocs.org/en/v0.1/table/index.html) to create a 3 column and 3 row table.  Everything seems to work OK until I try to print a single row of the table t:

>>> t[1]
ERROR: RuntimeError: maximum recursion depth exceeded while calling a Python object [astropy.table.table]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rij/py-lib/astropy/table/table.py", line 445, in __repr__
    self.index, self.data, self.dtype)
RuntimeError: maximum recursion depth exceeded while calling a Python object

  I can assign t[1] to a new variable, creating a Row object, and access all of its methods, but calling __repr__() gives this recursion error.

  Looking at the code, the offending function is

    def __repr__(self):
        return "<Row {0} of table\n values={1}\n dtype={2}>".format(
            self.index, self.data, self.dtype)

  The problem is the second argument; self.data is of type numpy.void and for some reason this doesn't format well using this kind of syntax.  Casting this to np.array type seems to fix this.

  Does this seem like the right way to fix this, or am I missing something obvious here?  (e.g. does the fact that row.data is of type numpy.void mean that something went wrong earlier?)  I don't usually delve too deeply into numpy or astropy because I usually don't have to, it usually works perfectly out of the box :)

  Thanks for any insight,

  Robert J.


_______________________________________________
AstroPy mailing list
AstroPy@scipy.org
http://mail.scipy.org/mailman/listinfo/astropy


More information about the AstroPy mailing list