Return value from os.system() call

C

Calder Coalson

I was searching for ways to get the return value from os.system()
calls, when I came across this from 6 years ago. I tried what was
suggested in this thread, but
output = os.popen("/tmp/other").read()
returns
sh: line 1: /tmp/other: Permission denied

I'm relatively new to Python, hardly ever use the shell and am
currently running Python 2.5.5 on Mac OS 10.4.10

Cameron Laird said:
> In article <98795o$kq8$0 at 216.39.151.169>, Donn Cave <donn at
> Guys, guys; you are making it too hard on Mr. Menscher. My guess
> is that he'd appreciate being told that, if he creates /tmp/other
> with contents
> #!/bin/sh
> echo "This is a string from an external process."
> he can then have fun with
> import os
> print os.popen("/tmp/other").read()

Thank you much -- this solves my problem. I'm sure I'll have more
questions in the near future, though....

Damian Menscher
 
W

Wildemar Wildenburger

Calder said:
I was searching for ways to get the return value from os.system() calls,
when I came across this from 6 years ago. I tried what was suggested in
this thread, but
output = os.popen("/tmp/other").read()
returns
sh: line 1: /tmp/other: Permission denied

I would assume that this is an OS problem more than a python problem. Do
you have write access to /tmp/other?
I'm fairly sure its a permission thing.

/W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top