Oh, good to know! Neat. :)
On Tue, Sep 18, 2012 at 2:20 AM, Xavier Lapointe <xl.mailingl...@gmail.com> wrote: > Hmm, but this can have nasty side effects (recently experienced it). Someone > pointed out to me that you can actually pass the env keyword argument in the > subprocess call and pass a copy of the current environment instead (with > necessary modifications). > > > On Fri, Sep 14, 2012 at 12:33 AM, Alan Fregtman <alan.fregt...@gmail.com> > wrote: >> >> Hey X, >> >> About the 3rd item, you just need to make sure the system libraries are >> loaded before XSI's own by putting them first in the LD_LIBRARY_PATH >> environment variable. >> >> Here's a workaround sample code to start subprocesses in Linux that worked >> for me last time: >> >> import os >> import subprocess >> >> inLinux = Application.Platform.startswith("Linux") >> if inLinux: >> exe = XSIUtils.BuildPath( pDir, executable) >> ldEnv = "LD_LIBRARY_PATH" >> sysLibDir = r"/usr/lib64" >> ld_oldVal = os.environ[ldEnv] >> os.environ[ldEnv] = sysLibDir+":"+os.environ[ldEnv] >> >> command = r'/path/to/awesome/tool blablabla arguments here' >> proc = subprocess.Popen( command.split(), stdout=subprocess.PIPE, >> stderr=subprocess.PIPE ) >> out, err = proc.communicate() >> print "stdout: %s" % out >> print "return code: %s" % err >> >> if inLinux: >> # Reset to old values like the good samaritan coder we are. :p >> os.environ[ldEnv] = ld_oldVal >> >> >> As a matter of fact, it was thanks to you that I figured this one out at >> the time. :p >> >> Cheers, >> >> -- Alan >> >> >> On Tue, Sep 11, 2012 at 8:19 PM, Xavier Lapointe >> <xl.mailingl...@gmail.com> wrote: >>> >>> You might have to import __future__ in order to have access to some >>> statement like with >>> The @property decorator does not work >>> Keep in mind that if you use a newer version of linux that the one >>> supported, you might have trouble starting subprocesses, since the libc >>> version coming with soft will override the one on the system (but it's still >>> possible). >>> For plugins it should be too bad, but for libs, I would consider running >>> some unittest if I were you >>> >>> >>> Cheers >>> >>> >> > > > > -- > Xavier