Grokbase Groups Python tutor May 2005
FAQ

In my first example, clamdscan should return 1 when the EICAR string is
found -- process.wait() gets 256 instead. In the second, clamdscan
returns 2 if an error occurs, such as trying to scan a non-existent
file, but 512 is returned.

No doubt there is a reason why the exit code is getting multiplied by
256... ??? My search has not enlightened me, however.

The return value of wait() packs a few values in a single integer, so you
may need to do some bit manipulation. The popen2 documentation talks
about this:

"""
wait()
Waits for and returns the status code of the child process. The status
code encodes both the return code of the process and information about
whether it exited using the exit() system call or died due to a signal.
Functions to help interpret the status code are defined in the os module;
see section 6.1.5 for the W*() family of functions.
"""

http://www.python.org/doc/lib/popen3-objects.html


You can take a look near the bottom of:

http://www.python.org/doc/lib/os-process.html#os-process

for functions like os.WEXITSTATUS(), which should help you get the values
that you're expecting.


This is all definitely "not obvious" stuff, so please feel free to
continue to ask questions. Best of wishes!

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
grouptutor @
categoriespython
postedMay 12, '05 at 5:56p
activeMay 12, '05 at 11:10p
posts5
users2
websitepython.org

2 users in discussion

Danny Yoo: 3 posts Jeffrey Rice: 2 posts

People

Translate

site design / logo © 2022 Grokbase