How to spawn a program and assign its stdout to a string variable?

Alan Kennedy alanmk at hotmail.com
Sat Nov 9 08:54:05 EST 2002


"Christopher R. Culver" wrote:

> I'm working on a pdf2ps frontend script that will use the *nix utility
> "file" to determine a file's type without blindly trying to work on it. 
> I assume the best way to do this is to spawn "file", capture its stdout
> to a string variable.........

Or you could check this thread which discusses a python implementation
of the unix "file" command:-

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=9c3f2e9c.0201150943.5e4de1fb%40posting.google.com&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3D9c3f2e9c.0201150943.5e4de1fb%2540posting.google.com

regards,

-- 
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan:              http://xhaus.com/mailto/alan



More information about the Python-list mailing list