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

Alan Gauld alan.gauld at blueyonder.co.uk
Wed Jan 28 12:10:18 EST 2004

>  >>> result = os.system('cat new2text.py')

> 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

You are not trying to read it you are trying to execute it, but...

>  >>> result = os.system('ls -l new2text.py')
> -rw-r--r--    1 prime_dev prime_dev       93 Jan 26 11:09

IT doesn't have execute permission.


>>> f = os.popen('cat import2.py').read()

You need to run the command as if it were os.system() and
then read() the output into your variable.


Alan G.

More information about the Tutor mailing list