* On 13 Oct 2015, [email protected] wrote:
> Hello all,
>
> I am currently using mutt 1.5.18 within a python script for reporting some
> activities about an embedded linux system.
> I do not get any problem when launching the mutt command within a terminal
> but I get troubles when launching from my python script.
>
> The command I use is pretty simple :
> echo "body of the mail" | mutt -s "mail's subject" [email protected]
>
> That command is called in the python script by:
> retvalue = os.system(command)
>
> I check the retvalue returned (which seems to me equivalent to the use of $?
> env variable) and I found out that retvalue is sometimes equal to 256...
Hi Mathieu -
The return from python's os.system is not the same as the exit status.
You need os.WEXITSTATUS(os.system(command)), which should be 0, or
success.
256 is not a valid exit code - these are 8-bit quantities. :)
For more details, see:
* pydoc os
* man 2 wait
--
David Champion • [email protected]