Results 1 to 5 of 5

Thread: need help for QProcess under windows

  1. #1
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default need help for QProcess under windows

    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

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: need help for QProcess under windows

    You can try

    Qt Code:
    1. QProcess pyscript;
    2. pyscript.start("C:/Python24/python", QStringList() << "complete/path/to/myscript.py");
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Posts
    46
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: need help for QProcess under windows

    Quote Originally Posted by munna
    You can try

    Qt Code:
    1. QProcess pyscript;
    2. pyscript.start("C:/Python24/python", QStringList() << "complete/path/to/myscript.py");
    To copy to clipboard, switch view to plain text mode 
    sure that works great, but what I wanted to do was more something like this:
    Qt Code:
    1. QProcess pyscript;
    2. pyscript.start("complete/path/to/myscript.py");
    To copy to clipboard, switch view to plain text mode 

    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"); ?

  4. #4
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: need help for QProcess under windows

    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 :

    Qt Code:
    1. QString str1 = QDir::homeDirPath();
    2. str1 = str1.left(3);//c:\ or d:\...
    3. str1 += "WINDOWS/system32/rundll32.exe";
    4. p.addArgument(str1);
    5. p.addArgument("I am not sure about this argument");
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to munna for this useful post:

    patcito (26th May 2006)

  6. #5
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: need help for QProcess under windows

    If Your python path result on..

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

    python & ruby & php like moore...

    Qt Code:
    1. system("start /max /wait http://www.blogistan.co.uk/qt/");
    2. system("python c:/fulldir/file.py"); /* not python.exe */
    3. system("php c:/fulldir/file.wphp");
    4. /* Only java compliled is better on qprocess exe url, browser but not interpret language*/
    To copy to clipboard, switch view to plain text mode 

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

  7. The following user says thank you to patrik08 for this useful post:

    patcito (27th May 2006)

Similar Threads

  1. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 11:47
  2. Application plugin on windows
    By Eyee in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2006, 17:36
  3. Mulitple openGL windows
    By tcsvw5 in forum Qt Programming
    Replies: 19
    Last Post: 3rd March 2006, 16:57
  4. Installing Qt 4.1 (open source) on Windows XP
    By katrina in forum Installation and Deployment
    Replies: 8
    Last Post: 19th February 2006, 12:26
  5. Replies: 4
    Last Post: 12th January 2006, 04:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.