The return code

D

devi thapa

Hi,

I am running one service in the python script eg like
"service httpd status".
If I execute this command in normal shell kernel, the return code is
3. But in the python script its return code is different, ie not 3, I
mean to say that return codes are differing.
But I want the return code 3 , not the other one. So, how can I achieve this?

Regards,
Devi.
 
A

Aaron Brady

Hi,

          I am running one service in the python script eg like
"service httpd status".
If I execute this command in normal shell kernel, the return code is
3. But in the python script its return code is different, ie not 3, I
mean to say that return codes are differing.
But I want the return code  3 , not the other one. So, how can I achieve this?

Regards,
Devi.

Are you looking for sys.exit( 3 )?
 
J

Jeff McNeil

Are you looking for sys.exit( 3 )?

Or, are you executing "service httpd status" from within a Python
script and not getting the exit code you're expecting from the command
you've spawned? If this is the case, ensure the command is actually
executing.

Can you post the actual code?
 
S

Sion Arrowsmith

Jeff McNeil said:
[ ... ] are you executing "service httpd status" from within a Python
script and not getting the exit code you're expecting from the command
you've spawned? If this is the case, ensure the command is actually
executing.

Or possibly whatever they're using to get the exit code is using the
os.wait()-style value, such as

sts = os.system("service httpd status")

in which case the required value is sts >> 8 .

See http://docs.python.org/library/os.html#os.system .
 

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,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top