1

I have downloaded a fits file which is saved in the default downloads folder. But now I want to open it in python.I tried:

>>> from astropy.io import fits
>>> hdulist=fits.open('MOS_033.Tb.fits')

But that leads to an IOError:

IOError: [Errno 2] No such file or directory: 'MOS_033.Tb.fits'

What shall I do?

Rose
  • 25
  • 7

1 Answers1

0

Python looks into the script directory by default, not downloads folder. Try adding full path to the file name, such as

hdulist=fits.open('/usr/downloads/MOS_033.Tb.fits')
Selcuk
  • 57,004
  • 12
  • 102
  • 110