PDA

View Full Version : need help for QProcess under windows



patcito
26th May 2006, 15:08
I have a python script let's call it myscript.py.
When I start "myscript.py" from Qt4.3 Command Prompt it works alright and I can also do "C:/Python24/python.exe myscript.py". Now when I use QProcess only the latter works, is there a way to do a simple process.start("myscript.py")? maybe there is an exec() function on windows I'm unaware of?

thanx in advance

Pat

munna
26th May 2006, 15:29
You can try




QProcess pyscript;
pyscript.start("C:/Python24/python", QStringList() << "complete/path/to/myscript.py");

patcito
26th May 2006, 15:42
You can try




QProcess pyscript;
pyscript.start("C:/Python24/python", QStringList() << "complete/path/to/myscript.py");


sure that works great, but what I wanted to do was more something like this:



QProcess pyscript;
pyscript.start("complete/path/to/myscript.py");



cause when I do "complete/path/to/myscript.py" with cmd it works so that means C:/Python24/python is in the PATH right? and if it's in the path why can't I just do a pyscript.start("complete/path/to/myscript.py"); ?

munna
26th May 2006, 15:58
QProcess is not equivalent of cmd.

Which means that if you want to directly just give the .py file then you have first open cmd and then type the path to your .py file.

I think u need to use rundll32.exe for this.

I think it will be something like :




QString str1 = QDir::homeDirPath();
str1 = str1.left(3);//c:\ or d:\...
str1 += "WINDOWS/system32/rundll32.exe";
p.addArgument(str1);
p.addArgument("I am not sure about this argument");

patrik08
26th May 2006, 19:54
If Your python path result on..

cmd # echo %PATH%
(Python install process or installer make this!)

python & ruby & php like moore...



system("start /max /wait http://www.blogistan.co.uk/qt/");
system("python c:/fulldir/file.py"); /* not python.exe */
system("php c:/fulldir/file.wphp");
/* Only java compliled is better on qprocess exe url, browser but not interpret language*/


Why? i don know... maybe Qprocess grab procedure.... faster if compiled sources...