In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] wrote:
...
> I call it from python like that:
> -- begin ---
> import commands
> commands.getstatusoutput('. toto.env')
> -- end ---
> 
> but it always return an error saying:
> sh: TOTO_ENV=/home/home: is not an identifier
> 
> doesn anyone know why ?

...


> and what about this sh primpt in the error message, can't I use ksh
> script ?

Yes and no.  You can expect system(), popen() et al. to
invoke the standard UNIX shell, "sh", so you must supply
an expression that will be correctly executed by that shell.
That expression can execute a program written in another
language - for example, 'ksh toto.env' or just './toto.env'
if you have made it executable and it starts with #!/bin/ksh.
That's really the best way to invoke a script.

Meanwhile, it might be worthwhile to reconsider the use
of ksh here, if you have any choice in the matter.  Ksh
is fine for interactive use, but has some unfortunate
flaws as a programming shell, and due to proprietary issues
one commonly encounters an alternative implementation that's
even worse.  On most modern platforms, sh will have a pretty
good programming feature set, and will be more reliable
(especially if it isn't just ksh by another name.)

   Donn Cave, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to