[SciPy-user] subprocess
Nils Wagner
nwagner at iam.uni-stuttgart.de
Tue Jun 23 13:29:48 EDT 2009
On Tue, 23 Jun 2009 11:20:45 -0600
Jim Vickroy <Jim.Vickroy at noaa.gov> wrote:
> Nils Wagner wrote:
>> On Tue, 23 Jun 2009 10:52:13 -0600
>> Jim Vickroy <Jim.Vickroy at noaa.gov> wrote:
>>
>>> Nils Wagner wrote:
>>>
>>>> Hi all,
>>>>
>>>> Sorry if the subject is off-topic.
>>>>
>>>> How can I run gimp from python using subprocess ?
>>>>
>>>> I would like to use several arguments, e.g.
>>>>
>>>> gimp --batch-interpreter=plug-in-script-fu-eval -i -d -b
>>>> '(script-autocrop "a.png")' -b '(gimp-quit 0)'
>>>>
>>>>
>>>> Thanks in advance.
>>>>
>>>> Nils
>>>> _______________________________________________
>>>> SciPy-user mailing list
>>>> SciPy-user at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>>
>>>>
>>> ... don't know what Python version you are using but
>>> recent releases (version 2.4 and later) include the
>>> *subprocess* module.
>>>
>>> Questions of this sort are best posted to
>>> *comp.lang.python*.
>>>
>>
>> Thank you for your response.
>> I know how to import subprocess, but how do I deal with
>> all the quotes in the argument list
>> of my gimp command ?
>>
>> Nils
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
> It is usually a good idea to (at a minimum) post:
>
> * a small script that demonstrates the error
> * the exact text of the error the script triggers
> * the version of Python you are using
> * the OS you are using
Sure, I am using openSuSe 11.1 on x86_64 GNU/Linux,
python2.6.
gimp --version
GNU Image Manipulation Program Version 2.6.2
The script script-autocrop.scm should be placed in in
~/.gimp2.6/scripts
python -i autocrop.py
(gimp:8196): Gimp-Core-CRITICAL **: gimp_image_opened:
assertion `GIMP_IS_GIMP (gimp)' failed
GIMP-Fehler: »/home/nwagner/)'« konnte nicht geöffnet
werden: Datei oder Verzeichnis nicht gefunden
batch command executed successfully
batch command executed successfully
^CTraceback (most recent call last):
File "autocrop.py", line 6, in <module>
assert subprocess.call(cmd)==0, 'Error in cmd: %s' %
cmd # Returncode should be zero
gimp: terminated: Unterbrechung
File "/usr/lib64/python2.6/subprocess.py", line 444, in
call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib64/python2.6/subprocess.py", line 1137,
in wait
pid, sts = os.waitpid(self.pid, 0)
KeyboardInterrupt
/usr/lib64/gimp/2.0/plug-ins/script-fu terminated:
Unterbrechung
Datei oder Verzeichnis nicht gefunden means file or
directory missing
Nils
-------------- next part --------------
A non-text attachment was scrubbed...
Name: autocrop.py
Type: text/x-python
Size: 273 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090623/3363e724/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: script-autocrop.scm
Type: text/x-scheme
Size: 348 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090623/3363e724/attachment.bin>
More information about the SciPy-User
mailing list