"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
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:
>
>
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):
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
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
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!"