"clobber" fails when writing files

Bug #432459 reported by Ole Streicher
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pyfits (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Won't Fix
Undecided
Unassigned

Bug Description

TEST CASE:
the following code fails for me if the output file already exists:
   >>> import pyfits
   >>> pyfits.PrimaryHDU().writeto('Map.fits', clobber='True')
   >>> pyfits.PrimaryHDU().writeto('Map.fits', clobber='True')

   /var/lib/python-support/python2.6/pyfits/NP_pyfits.py:4895:
   DeprecationWarning: functions overriding warnings.showwarning() must
   support the 'line' argument
     warnings.warn( "Overwrite existing file '%s'." % name)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/var/lib/python-support/python2.6/pyfits/NP_pyfits.py", line
   1483, in writeto
       classExtensions=classExtensions)
     File "/var/lib/python-support/python2.6/pyfits/NP_pyfits.py", line
   4895, in writeto
       warnings.warn( "Overwrite existing file '%s'." % name)
     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)

This happens on Ubuntu 10.04 with python 2.6.2 and pyfits 1.3-2.

REGRESSION POTENTIAL:
simple fix to the 2.6 api of the warnings module, should not break anything.

original report:

I contacted the pyfits author and go the answer that pyfits 1.3 is not compatible with python 2.6.

So, probably it would be the best to update the pyfits in the repository with a current version?

Fedora Linux had the same problem, see https://bugzilla.redhat.com/show_bug.cgi?id=509203
From there I got the following additional info:

This bug was fixed upstream in pyfits version 2.1. See the CHANGELOG here:

http://www.stsci.edu/resources/software_hardware/pyfits/release

See this scipy mailing list thread:

http://mail.scipy.org/pipermail/astropy/2009-June/000827.html

Ole Streicher (olebole)
description: updated
Revision history for this message
Mike Droettboom (mdboom) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pyfits (Ubuntu):
status: New → Confirmed
Julian Taylor (jtaylor)
Changed in pyfits (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Julian Taylor (jtaylor) wrote :

in case someone still cares, I uploaded a fix from bug 553496 to lucid-proposed

description: updated
description: updated
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Please test proposed package

Hello Ole, or anyone else affected,

Accepted pyfits into lucid-proposed. The package will build now and be available in a few hours. Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users. If this package fixes the bug for you please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case details of your testing will help us make a better decision. Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in pyfits (Ubuntu Lucid):
status: New → Fix Committed
tags: added: verification-needed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote : Verification Still Needed

The fix for the this bug has been awaiting testing feeback in the -proposed repository for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now the package will be removed from the -proposed repository.

tags: added: removal-candidate
Revision history for this message
Brian Murray (brian-murray) wrote :

The version of pyfits in lucid-proposed has been removed as this bug report was not verified in a timely fashion.

Changed in pyfits (Ubuntu Lucid):
status: Fix Committed → Triaged
tags: removed: verification-needed
tags: removed: removal-candidate
Revision history for this message
Rolf Leggewie (r0lf) wrote :

lucid has seen the end of its life and is no longer receiving any updates. Marking the lucid task for this ticket as "Won't Fix".

Changed in pyfits (Ubuntu Lucid):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.