[PyQt] subprocess in PyQt

Mads Ipsen mpi at comxnet.dk
Sat Mar 14 07:48:55 GMT 2009


>
> Hello guys;
>
> i have a function that suppose to do something and from terminal it has
> this
> syntax to be executed;
>
> waseem at home:~/Desktop/Project2/GUI$ python myexif.py -q "pathfile" >
> test.csv
>
> so far on using subprocess i came up with this;
>
> from subprocess import *
> x=Popen(['python','myexif','-q','sys.argv[1]'], stdout=PIPE)
> y=Popen(['>','Exif.csv'], stdin=x.stdout)
>
> but i keep getting this error
>
> waseem at home:~/Desktop/Project2/GUI$ python wrapphotodb.py
> Traceback (most recent call last):
> File "wrapphotodb.py", line 37, in _addphotoClicked
> y=Popen(['>','Exif.csv'], stdin=x.stdout)
> File "/usr/lib/python2.5/subprocess.py", line 594, in __init__
> errread, errwrite)
> File "/usr/lib/python2.5/subprocess.py", line 1153, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
>
> Any idea? is my syntax correct?
> --
> View this message in context:
> http://www.nabble.com/subprocess-in-PyQt-tp22510022p22510022.html
> Sent from the PyQt mailing list archive at Nabble.com.
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>


Why don't you try to use a QProcess from spawning external processes? I
have a good success ratio with that approach.

Mads


More information about the PyQt mailing list