Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. problem with System()
Forum Updated to NodeBB v4.3 + New Features

problem with System()

Scheduled Pinned Locked Moved Unsolved General and Desktop
system commandsystem
37 Posts 5 Posters 14.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S SGaist
    24 Jun 2016, 07:50

    You call it with a path relative to where you main application is started.

    ./home/princi is equivalent to $PWD/home/princi/ which is likely not what you want, is it ?

    A Offline
    A Offline
    AlvaroS
    wrote on 24 Jun 2016, 07:58 last edited by
    #11

    @SGaist Now I do this and nothing as well..

        QString program = "princi";
        QStringList arguments;
    
        arguments << "0" << QString::number(wps.front().x()) << QString::number(wps.front().y()) << "0" << QString::number(wps.back().x()) << QString::number(wps.back().y()) << "prueba_princi.bmp" << "0 0 +" ;
    
        QString folder = "/home/";
    
        QProcess *myProcess = new QProcess(this);
    
        myProcess->setWorkingDirectory(folder);
    
        myProcess->start(program,arguments);
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 24 Jun 2016, 07:59 last edited by
      #12

      What is the full path to princi ? And what is the full path to your application ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply 24 Jun 2016, 08:01
      0
      • S SGaist
        24 Jun 2016, 07:59

        What is the full path to princi ? And what is the full path to your application ?

        A Offline
        A Offline
        AlvaroS
        wrote on 24 Jun 2016, 08:01 last edited by
        #13

        @SGaist Full path of princi (which is the executable) is /home/
        and full path of my QT aplication is /home/workspace

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 24 Jun 2016, 08:09 last edited by
          #14

          /home is not the full path to your application except it is called home and is located in the root directory.
          So, you can start the program in a shell with /home/princi?
          Did you try it?
          This is quite strange path: in /home you usually have a directory for each user and /home is not writable by normal user.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          A 1 Reply Last reply 24 Jun 2016, 08:23
          2
          • J jsulm
            24 Jun 2016, 08:09

            /home is not the full path to your application except it is called home and is located in the root directory.
            So, you can start the program in a shell with /home/princi?
            Did you try it?
            This is quite strange path: in /home you usually have a directory for each user and /home is not writable by normal user.

            A Offline
            A Offline
            AlvaroS
            wrote on 24 Jun 2016, 08:23 last edited by
            #15

            @jsulm sorry yes, it is in /home/user1/ but it does not run as well...

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 24 Jun 2016, 08:25 last edited by
              #16

              @AlvaroS said:

              QString program = "princi";

              should be

              QString program = "/home/user1/princi";

              ?

              A 1 Reply Last reply 24 Jun 2016, 08:28
              1
              • M mrjj
                24 Jun 2016, 08:25

                @AlvaroS said:

                QString program = "princi";

                should be

                QString program = "/home/user1/princi";

                ?

                A Offline
                A Offline
                AlvaroS
                wrote on 24 Jun 2016, 08:28 last edited by
                #17

                @mrjj It works in the same way... :(

                J M 2 Replies Last reply 24 Jun 2016, 08:29
                0
                • A AlvaroS
                  24 Jun 2016, 08:28

                  @mrjj It works in the same way... :(

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 24 Jun 2016, 08:29 last edited by
                  #18

                  @AlvaroS So, if you enter /home/user1/princi in a terminal window and press enter it does not start? What happens? Any error message?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  A 1 Reply Last reply 24 Jun 2016, 08:31
                  1
                  • A AlvaroS
                    24 Jun 2016, 08:28

                    @mrjj It works in the same way... :(

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 24 Jun 2016, 08:30 last edited by
                    #19

                    @AlvaroS

                    Ok, you must debug then
                    try to use
                    http://doc.qt.io/qt-5/qprocess.html#error
                    to see what it thinks.

                    A 1 Reply Last reply 24 Jun 2016, 08:38
                    2
                    • J jsulm
                      24 Jun 2016, 08:29

                      @AlvaroS So, if you enter /home/user1/princi in a terminal window and press enter it does not start? What happens? Any error message?

                      A Offline
                      A Offline
                      AlvaroS
                      wrote on 24 Jun 2016, 08:31 last edited by
                      #20

                      @jsulm In a terminal if I write

                      ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
                      

                      in /home/user1/ directory it runs good

                      J A 2 Replies Last reply 24 Jun 2016, 08:33
                      0
                      • A AlvaroS
                        24 Jun 2016, 08:31

                        @jsulm In a terminal if I write

                        ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
                        

                        in /home/user1/ directory it runs good

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 24 Jun 2016, 08:33 last edited by jsulm
                        #21

                        @AlvaroS Then try what @mrjj suggested

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • M mrjj
                          24 Jun 2016, 08:30

                          @AlvaroS

                          Ok, you must debug then
                          try to use
                          http://doc.qt.io/qt-5/qprocess.html#error
                          to see what it thinks.

                          A Offline
                          A Offline
                          AlvaroS
                          wrote on 24 Jun 2016, 08:38 last edited by
                          #22
                          This post is deleted!
                          M 1 Reply Last reply 24 Jun 2016, 08:40
                          0
                          • A AlvaroS
                            24 Jun 2016, 08:31

                            @jsulm In a terminal if I write

                            ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
                            

                            in /home/user1/ directory it runs good

                            A Offline
                            A Offline
                            AlvaroS
                            wrote on 24 Jun 2016, 08:39 last edited by AlvaroS
                            #23

                            @AlvaroS said:

                            @jsulm In a terminal if I write

                            ./princi 0 747.37 427.68 0 844.37 42.54 prueba_princi.bmp 0 0 +
                            

                            in /home/user1/ directory it runs good

                            @jsulm said:

                            @AlvaroS Then try what @mrjj suggested

                            okey, it gives me UnknowError.... http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum

                            1 Reply Last reply
                            0
                            • A AlvaroS
                              24 Jun 2016, 08:38

                              This post is deleted!

                              M Offline
                              M Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on 24 Jun 2016, 08:40 last edited by
                              #24

                              @AlvaroS

                              well you can use
                              qDebug() "qproc: " << myProcess->error();

                              and check the code in
                              http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum

                              A 1 Reply Last reply 24 Jun 2016, 08:42
                              1
                              • M mrjj
                                24 Jun 2016, 08:40

                                @AlvaroS

                                well you can use
                                qDebug() "qproc: " << myProcess->error();

                                and check the code in
                                http://doc.qt.io/qt-5/qprocess.html#ProcessError-enum

                                A Offline
                                A Offline
                                AlvaroS
                                wrote on 24 Jun 2016, 08:42 last edited by
                                #25

                                @mrjj Yes thanks!! See my last post. Thanks again. It gives me Unknow error...

                                M 1 Reply Last reply 24 Jun 2016, 08:43
                                0
                                • A AlvaroS
                                  24 Jun 2016, 08:42

                                  @mrjj Yes thanks!! See my last post. Thanks again. It gives me Unknow error...

                                  M Offline
                                  M Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on 24 Jun 2016, 08:43 last edited by
                                  #26

                                  @AlvaroS

                                  " This is the default return value of error()."

                                  You do call it AFTER u call
                                  myProcess->start(program,arguments); ?

                                  A 1 Reply Last reply 24 Jun 2016, 08:44
                                  1
                                  • M mrjj
                                    24 Jun 2016, 08:43

                                    @AlvaroS

                                    " This is the default return value of error()."

                                    You do call it AFTER u call
                                    myProcess->start(program,arguments); ?

                                    A Offline
                                    A Offline
                                    AlvaroS
                                    wrote on 24 Jun 2016, 08:44 last edited by
                                    #27

                                    @mrjj Yes:

                                        myProcess->start(program, arguments);
                                    
                                        QProcess::ProcessError error = myProcess->error();
                                    
                                    M 1 Reply Last reply 24 Jun 2016, 08:46
                                    0
                                    • A AlvaroS
                                      24 Jun 2016, 08:44

                                      @mrjj Yes:

                                          myProcess->start(program, arguments);
                                      
                                          QProcess::ProcessError error = myProcess->error();
                                      
                                      M Offline
                                      M Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 24 Jun 2016, 08:46 last edited by
                                      #28

                                      @AlvaroS
                                      hmm really odd then
                                      it should say FailedToStart

                                      Just to be 100% clear.

                                      princi is never run ?

                                      A 1 Reply Last reply 24 Jun 2016, 08:48
                                      1
                                      • M mrjj
                                        24 Jun 2016, 08:46

                                        @AlvaroS
                                        hmm really odd then
                                        it should say FailedToStart

                                        Just to be 100% clear.

                                        princi is never run ?

                                        A Offline
                                        A Offline
                                        AlvaroS
                                        wrote on 24 Jun 2016, 08:48 last edited by
                                        #29

                                        @mrjj said:

                                        @AlvaroS
                                        hmm really odd then
                                        it should say FailedToStart

                                        Just to be 100% clear.

                                        princi is never run ?

                                        okey look.
                                        if I write:

                                            myProcess->start(program, arguments);
                                        
                                            myProcess->waitForFinished(3000);
                                        
                                            QProcess::ProcessError error = myProcess->error();
                                        
                                        

                                        Now error says:
                                        QProcess::Crashed The process crashed some time after starting successfully.

                                        1 Reply Last reply
                                        0
                                        • M Offline
                                          M Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on 24 Jun 2016, 08:49 last edited by mrjj
                                          #30

                                          so it sounds like your princi do run but it crashes?

                                          oh. sorry my bad. start is async so calling error right after was
                                          not correct.

                                          waitForFinished fixed that.

                                          A 1 Reply Last reply 24 Jun 2016, 08:54
                                          0

                                          20/37

                                          24 Jun 2016, 08:31

                                          • Login

                                          • Login or register to search.
                                          20 out of 37
                                          • First post
                                            20/37
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved