> 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! _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor