os,access argument problem

Matthew Dixon Cowles matt at mondoinfo.com
Sun Aug 20 15:22:40 EDT 2000


On Sun, 20 Aug 2000 12:09:22 -0700, Bob van der Poel
<bvdpoel at uniserve.com> wrote:
>
>
>I want to test for the existance of a file, so I:
>
>	 if os.access(newfile, 'F_OK'):
>
>However, I get the error message:
>
>	TypeError: illegal argument type for built-in operation
>
>Something wrong with the 'F_OK' I presume. Can't figure out what to
>change it to....

The symbols listed in the documentation aren't meant to be strings,
they're constants exported by the module. You want:

os.access("foo",os.F_OK)

Regards,
Matt



More information about the Python-list mailing list