Results 1 to 9 of 9

Thread: "Process failed to start: " and qprocess generic errors

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default "Process failed to start: " and qprocess generic errors

    Afternoon --

    I can't seem to find a simple problem I'm having addressed anywhere in the forum or google, so I'm hoping someone can point me in the right direction...I'm sure it's something small...

    I am trying to call a simple cmd application that takes 2 parameters, an input file and output file with QProcess -- it looks like it should be a very easy thing to do but I'm getting errors that really don't help me much...if I use "proc->start(...)" the error I get is, "Process failed to start: ", and if I use proc->execute (...), I get "Unknown error"...It might be something in my pathnames, but I need another set of eyes at this point...

    From the command line, this is how I call the application and it works perfectly:
    C:\Users\Scott\Desktop\Star\Genriser\src\genriser test.input test.output

    mainwindow.h
    Qt Code:
    1. .
    2. .
    3. .
    4. private:
    5. Ui::MainWindow *ui;
    6. QProcess *genriser_proc;
    To copy to clipboard, switch view to plain text mode 

    mainwindow.cpp
    Qt Code:
    1. QString genriser_dir;
    2. QStringList arguments;
    3.  
    4. genriser_proc = new QProcess;
    5.  
    6. genriser_dir = "C:\\Users\\Scott\\Desktop\\Star\\Genriser\\src";
    7. QDir::setCurrent(genriser_dir);
    8.  
    9. arguments << "test.input";
    10. arguments << "test.output";
    11.  
    12. genriser_proc->start(program, arguments);
    To copy to clipboard, switch view to plain text mode 

    I have tried not setting a working directory and putting the full pathname of the executable and the files in the string, I've tried the overloaded versions of QProcess::start and execute, but to no avail.


    Any ideas? I'm sure it'll be something embarrassing...

    scott

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: "Process failed to start: " and qprocess generic errors

    Have you tried:
    Qt Code:
    1. genriser_dir = "C:\\Users\\Scott\\Desktop\\Star\\Genriser\\src";
    2. //QDir::setCurrent(genriser_dir);
    3. genriser_proc->setWorkingDirectory(genriser_dir);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: "Process failed to start: " and qprocess generic errors

    That's actually what I tried first but was getting a can't find directory or file error, so searching found me this:

    http://www.qtforum.org/article/15350...y-problem.html

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: "Process failed to start: " and qprocess generic errors

    Where is 'program' set and what is its value?

  5. #5
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: "Process failed to start: " and qprocess generic errors

    Oops, that would help to have shown the whole piece of code -- cut and paste issues...

    mainwindow.cpp
    Qt Code:
    1. QString input_file;
    2. QString output_file;
    3. QString program;
    4. QString genriser_dir;
    5. QStringList arguments;
    6.  
    7. input_file = "C:\\Users\\Scott\\Desktop\\Starmark\\Genriser\\src\\test.input";
    8. output_file = "C:\\Users\\Scott\\Desktop\\Starmark\\Genriser\\src\\test.output";
    9. program = "C:\\Users\\Scott\\Desktop\\Starmark\\Genriser\\src\\genriser";
    10. genriser_dir = "C:\\Users\\Scott\\Desktop\\Starmark\\Genriser\\src";
    11.  
    12. genriser_proc = new QProcess;
    13.  
    14. QDir::setCurrent(genriser_dir);
    15.  
    16. arguments << input_file;
    17. arguments << output_output;
    18.  
    19. genriser_proc->start(program, arguments);
    To copy to clipboard, switch view to plain text mode 

    If I fully qualify the pathnames in my variables, I get the "Process failed to start" error...However, if I remove the pathnames and just rely on the setCurrent command to define the directory, I get "Process crashed"...

    When I did a qDebug() on "arguments", it shows the string encased in parentheses, and I'm wondering if that's where my problem is originating because my command line needs to look like this, "...\src\genriser test.input test.output"...Does the QStringlist append parenthesis or is that something that's just appearing with the debug?

    I've also tried, "genriser_proc->start("genriser test.input test.output)" and that didn't work either...


    scott


    ed. calling my main application, which has no parameters, works -- so does run qtcreator if I point all my variables to it's directory, so that narrows it down to something to do with the arguments...
    Last edited by scott_hollen; 21st November 2011 at 18:05.

  6. #6
    Join Date
    Jan 2011
    Location
    Richmond, VA
    Posts
    94
    Thanks
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: "Process failed to start: " and qprocess generic errors

    I'm about to throw my Mac against the wall...Every application I invoke with QProcess works except for the one I need to have work...I even modified the external app to not need parameters but it still bombs...Running that app from the cmd line works; double clicking on it in File Manager works...Calling it from my Qt app generates a "Process crashed" error and I'm at a loss as to how to debug that...I didn't want to have to fold this app into my Qt app, but I'm almost to the point of having to do that...

    scott

  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: "Process failed to start: " and qprocess generic errors

    If it is complaining that the process crashed then it must have found the file.

    Are you sure the genriser program runs on its own without crashing?
    Can you start a non-Qt command prompt (whatever it's called on a Mac), cd to the directory, and run the command yourself?
    Is the environment that your sub-process inherits correct? Can the program find all its dynamically loaded dependencies (Qt libs etc.)?

    When you say a "simple cmd application" do mean a simple executable or a shell script?

Similar Threads

  1. Replies: 7
    Last Post: 8th November 2012, 11:26
  2. Qt Creator Qt SDK, Remote Compiler "Build Failed: Errors in build"
    By strahlex in forum Qt Tools
    Replies: 0
    Last Post: 10th August 2011, 16:59
  3. The Gdb process failed to start.
    By been_1990 in forum Qt Tools
    Replies: 3
    Last Post: 29th April 2009, 17:29
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. Replies: 2
    Last Post: 20th November 2007, 20:00

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.