Re: [Tutor] oserror [errno 20]

2006-04-03 Thread Alan Gauld
"k r fry" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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

Re: [Tutor] oserror [errno 20]

2006-04-03 Thread Ewald Ertl
Hi, k r fry wrote: > 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: > >

[Tutor] oserror [errno 20]

2006-04-03 Thread k r fry
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):

Re: [Tutor] OSError

2006-03-15 Thread Kent Johnson
Christopher Spears wrote: > I am trying to write a function that takes a directory > name and describes the contents of the directory (file > name and size) recursively. Here is what I have > written so far: > > import os, os.path > > def describeDirectory(directory): > if os.listdir(directo

Re: [Tutor] OSError

2006-03-15 Thread Ewald Ertl
Hi Chris, I think I've found the problem. os.listdir() gives you all entries of the directory, but your not changing to that directory. The os.path.getsize() just does not find the file in the directory "testFiles" under your current directory. See my short example below. >>> import o

[Tutor] OSError

2006-03-14 Thread Christopher Spears
I am trying to write a function that takes a directory name and describes the contents of the directory (file name and size) recursively. Here is what I have written so far: import os, os.path def describeDirectory(directory): if os.listdir(directory) == []: print "Empty directory!"