Variable passing to external program - How??

Alex Martelli aleaxit at yahoo.com
Sat Oct 11 06:57:13 EDT 2003


Rigga wrote:

> Hi,
> 
> Ok first please bear with me as I am a total Python n00b..

OK, but: the post's subject bears no relation to your code; and
neither does your text -- you keep talking about an os.system
call that just isn't there.  So, "noob" or not, I'm nonplussed.

> Can anyone explain why this does not like me using % FileLoc in the
> os.system call???

There is no os.system call in the following code.

> #!/usr/bin/python
> import sys
> import os
> # Check that the folder is accessible and writeable
> FileLoc = os.path.exists('/home/rigga')
> if (FileLoc):
>         print "File location exists:"
>         AccFlag = os.access('% FileLoc',os.R_OK | os.X_OK | os.W_OK)

You're checking for a file called '% FileLoc', which does not exist.  The
variable FileLoc at this point is worth True, so you can't possibly want
to "pass it to an external program" as per subject, either.

> I have full access to the folder I am checking however it always returns
> no files found (FileLoc = 0) however if I specify the folder I want to
> test in the os.system call it works fine...

There is no os.system call anywhere in the above.


Alex





More information about the Python-list mailing list