Need help running external program

Tim Jarman tmj at SPAMLESSjarmania.com
Wed Mar 2 22:54:33 CET 2005


Rigga wrote:

> Brian van den Broek wrote:
> 
>> Rigga said unto the world upon 2005-02-27 15:04:

(snip stuff about raw strings)

> Thanks for all your help with this it is appreciated, one further question
> though, how do I pass a variable to the external program while using the
> r"""
> 
> Thanks
> 
> RiGGa

I'm not sure I understand the question. Say you have:

parameter = r"my \funky \text"

then surely you just pass it to your external program using whichever method
you like, e.g.

import os
os.execl("your_external_prog", parameter) # replaces the current process

or some variant of:

return_code = os.spawnl(os.P_WAIT, "your_external_prog", parameter) 

or you can build a command line:

command = "your_external_prog %s" % parameter
return_code = os.system(command)

(see docs on the os module for more variations on this theme than you can
shack a stick at)

It's just a string, after all.



-- 
Website: www DOT jarmania FULLSTOP com



More information about the Python-list mailing list