[AstroPy] Fwd: Help with encoding error

Leticia Rodriguez iafe.leticia at gmail.com
Wed Oct 2 10:19:27 EDT 2013


Hi,

I want to use the "ñ" character in a fit header. The verify in astropy is
giving me an error.

WARNING: VerifyWarning:         Card 'OBSERVER' is not FITS standard
(invalid value string: 'Maria Rosa Mu�oz ').  Fixed 'OBSERVER' card to meet
the FITS standard. [astropy.io.fits.verify]
ERROR: UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position
1946: ordinal not in range(128) [astropy.io.fits.header]
Traceback (most recent call last):
  File "./fixfitheader.py", line 30, in <module>
    hdulist.writeto(sys.argv[2]+'/'+filename, output_verify='fix')
  File
"/usr/local/lib/python2.6/dist-packages/astropy/io/fits/hdu/hdulist.py",
line 675, in writeto
    hdu._writeto(hdulist.__file)
  File
"/usr/local/lib/python2.6/dist-packages/astropy/io/fits/hdu/base.py", line
497, in _writeto
    self._writeheader(fileobj)
  File
"/usr/local/lib/python2.6/dist-packages/astropy/io/fits/hdu/base.py", line
428, in _writeheader
    self._header.tofile(fileobj)
  File "/usr/local/lib/python2.6/dist-packages/astropy/io/fits/header.py",
line 625, in tofile
    fileobj.write(blocks.encode('ascii'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 1946:
ordinal not in range(128)

Is there a solution for this issue?

Thanks.
BR
Leticia.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20131002/a6ca029e/attachment.html>


More information about the AstroPy mailing list