Try something like this:

import subprocess
cmd = [your, command, here]
opts = dict(stderr=subprocess.PIPE, stdout=subprocess.PIPE)
stdout, stderr = subprocess.Popen(cmd, **opts).communicate()

As an added bonus, you get separated stdout and stderr.  It's win all over.

Cheers,

hoaf

On Tue, Feb 8, 2011 at 6:18 PM, Aditya Naik <[email protected]> wrote:

> I did try giving it the full path and also using subprocess but its the
> same result. works in 09 but not 11
>
> import os
> import subprocess
> command = '/usr/bin/ksnapshot'
> #os.system(command)
> subprocess.call([command])
>
> On Tue, Feb 8, 2011 at 3:11 PM, Geoff Harvey <[email protected]> wrote:
>
>> Don't use os.system!
>>
>> Use the subprocess module -- it's safer and more controllable.
>>
>> http://docs.python.org/library/subprocess.html
>>
>> And, well, give the full path.  :^)
>>
>> hpaf
>>
>>
>> On Tue, Feb 8, 2011 at 5:55 PM, damon shelton <[email protected]>wrote:
>>
>>> try inputting the entire path to ksnapshot
>>>
>>> if that works then ksnaphshot may not be registered properly on the
>>> system
>>
>>
>>  --
>> http://groups.google.com/group/python_inside_maya
>>
>
>  --
> http://groups.google.com/group/python_inside_maya
>

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to