[Tutor] oserror [errno 20]

k r fry k.r.fry at durham.ac.uk
Mon Apr 3 13:36:12 CEST 2006


Hi, I am new to this list, and also to Python.
I am trying to get Python to loop through the directory DATADIR which 
contains the data I want to read.  I get an error:  "oserror [errno 20] 
: Not a directory: "Katiescint.py"

The section of code is shown below:

for subdir in os.listdir(DATADIR):              #loop through list of 
strings

     file=FITS.Read(DATADIR+'/'+subdir+'/flux.fits')     #opens 
flux.fits file and reads

     summation=open(DATADIR+'/'+subdir+'/flux.dat','w')  #opens the 
summation results file for writing to

     spotbyspot=open(DATADIR+'/'+subdir+'/spotflux.dat','w') #opens the 
spot-by-spot file for writing to

     output=''
     print'\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'+sys.argv[1]+' 
'+subdir+'\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'

I would be very grateful if anyone could help me.  Thanks!


More information about the Tutor mailing list