[AstroPy] PyFITS warning not supplying "line" argument

Johannes Bauer dfnsonfsduifb at gmx.de
Wed Jun 3 09:25:57 EDT 2009


Hello group,

after updating my system to Ubuntu Jaunty, my code now throws an
exception of which the source I believe resides within pyfits. The code
the exception is throw is however in gtk code:

pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height)
pb_pixels = pb.get_pixels_array()

and the result in the application:

./guiclient.py:294: DeprecationWarning: functions overriding
warnings.showwarning() must support the 'line' argument
  pb_pixels = pb.get_pixels_array()
Traceback (most recent call last):
  File "./guiclient.py", line 359, in on_Result
    self.__updateimage()
  File "./guiclient.py", line 294, in __updateimage
    pb_pixels = pb.get_pixels_array()
  File "/var/lib/python-support/python2.6/pyfits/NP_pyfits.py", line 76,
in showwarning
    _showwarning(message, category, filename, lineno, file)
  File "/usr/lib/python2.6/warnings.py", line 30, in _show_warning
    file.write(formatwarning(message, category, filename, lineno, line))
TypeError: formatwarning() takes exactly 4 arguments (5 given)

Now when I insert into "/usr/lib/python2.6/warnings.py" at line 29

print(message, category, filename, lineno, line)

I get:

(DeprecationWarning('PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.',), <type 'exceptions.DeprecationWarning'>,
'./guiclient.py', 294, None)

Now why I think that it's pyfits has the following reason: Consider this
code:

#!/usr/bin/python
import gtk
gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 123,
123).get_pixels_array()

when executed, it says:

./x:3: DeprecationWarning: PyArray_FromDimsAndDataAndDescr: use
PyArray_NewFromDescr.
  gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 123,
123).get_pixels_array()

Now consider this changed piece of code

./x:4: DeprecationWarning: functions overriding warnings.showwarning()
must support the 'line' argument
  gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 123,
123).get_pixels_array()
Traceback (most recent call last):
  File "./x", line 4, in <module>
    gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, 123,
123).get_pixels_array()
  File "/var/lib/python-support/python2.6/pyfits/NP_pyfits.py", line 76,
in showwarning
    _showwarning(message, category, filename, lineno, file)
  File "/usr/lib/python2.6/warnings.py", line 29, in _show_warning
    file.write(formatwarning(message, category, filename, lineno, line))
TypeError: formatwarning() takes exactly 4 arguments (5 given)

Is there anything I can do about the exception being thrown? Does it
really originate from pyfits or is it from pygtk?

Kind regards,
Johannes



More information about the AstroPy mailing list