Getting output from executed command that is not STDIN
P at draigBrady.com
P at draigBrady.com
Thu Aug 7 06:45:43 EDT 2003
Sami Viitanen wrote:
> Hello,
>
> I'm using os.popen and read for reading command input to string but the
> string doesn't contain the same output that running the command manually or
> with os.system contains.
>
> with os.system:
> cvs server: Diffing //Project1
> File //Project1/testiware.txt is new; current revision 3.13
> File //Project1/what_is_version_control.txt is new; current revision 3.3
> cvs server: Diffing //Project1/Dir1
> File //Project1/Dir1/seltest.c is new; current revision 1.4
> File //Project1/Dir1/testi.c is new; current revision 1.2
>
> with os.popen and read:
> File //Project1/testiware.txt is new; current revision 3.13
> File //Project1/what_is_version_control.txt is new; current revision 3.3
> File //Project1/Dir1/seltest.c is new; current revision 1.4
> File //Project1/Dir1/testi.c is new; current revision 1.2
>
> ---
> Script doesn't read those "cvs server: Diffing" lines
> ---
They go to stderr. The handiest way around this is
to put 2>&1 at the end of your command line
Pádraig,
More information about the Python-list
mailing list