Why don't isdir() and isfile() work for me?
Ray Parrish
crp at cmc.net
Wed Mar 10 02:19:33 UTC 2010
Hello,
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
--
Linux dpkg Software Report script set..
http://www.rayslinks.com/LinuxdpkgSoftwareReport.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com
More information about the ubuntu-users
mailing list