checking for when a file or folder exists, typing problems?
Brian
desertgarden at netscape.com
Sun Jun 12 11:44:35 EDT 2005
Hi Bryan,
Here's a potential idea. Try converting the variable to a string by
using the following syntax:
thePath = str(thePathArg)
This will convert the current variable type to a string, which follows
the data type syntax that you have specified at the beginning of your
message.
Hope this helps,
Brian :-)
---
Bryan Rasmussen wrote:
> Hi
> I have a little program that is importing from os.path import exists, join,
> isdir, normpath, isfile
> at one point in my program I check if a file exists using
> if exists("c:\projects"):
>
> and that works fine.
>
> If I change it to be
> if exists(thepath):
> where thepath is a commandline argument it does not work fine.
>
> Note that the commandline is c:\projects and when I print thepath to check what
> is going on it prints
> c:\projects
>
> The only thing I can assume is that there is some sort of typing problem going
> on here, but then it should go ahead and give an error then if it's getting
> something unexpected obviously.
>
> Any help on what this error is?
>
> Thanks
>
>
More information about the Python-list
mailing list