I am using Python Release 2.5.2, 21st February, 2008, and lookng at the
corresponding document, it says -
isfile(path)
Return True if path is an existing regular file. This follows
symbolic links, so both islink() and isfile() can be true for the same
path.
isdir(path)
Return True if path is an existing directory. This follows symbolic
links, so both islink() and isdir() can be true for the same path.
And I am getting -
>>> import os
>>> isdir("/home/ray/links")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'isdir' is not defined
>>> os.isdir("/home/ray/links")
>>> os.isdir("/home/ray/links")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'isdir'
>>> os.isfile("/home/ray/links")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'isfile'
>>> import os.path
>>> os.isfile("/home/ray/links")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'isfile'Could someone please explain to me why?
Thanks, Ray Parrish



Back to top








