[Tutor] Have any idea why I do not have access to MY files?

Daniel Ehrenberg littledanehren at yahoo.com
Wed Jan 28 21:54:32 EST 2004


hcohen2 wrote:
> These are excution functions: system() and popen(). 
> For the same file 
> with the former I can see the contents:
> 
>  >>> result = os.system('cat new2text.py')
> y = 0
> print 'y is currently:', y
> while y < 8:
>     y += 1
>     print 'incrementing y to: ', y
>  
> whereas, if I try to read it - suddenly it does not
> belong to me!
> 
>  >>> f = os.popen('import2.py -a')
>  >>> sh: line 1: ./import2.py: Permission denied
> 
> But if I do this, its mine!
> 
>  >>> result = os.system('ls -l new2text.py')
> -rw-r--r--    1 prime_dev prime_dev       93 Jan 26
> 11:09 new2text.py
> 
> Adding a full path has no effect, with popen() still
> claims I have no 
> rights.
> 
> Thanks for any insights!

It's not that you can't read the file, it's that you
can't execute it. Give it executable privilages by
doing chmod +x import2.py. Then do ./import2.py -a.
Otherwise it will search in $PATH for import2.py.

Daniel Ehrenberg

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



More information about the Tutor mailing list