Results 1 to 6 of 6

Thread: doubt in by executing script file in qt

  1. #1
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default doubt in by executing script file in qt

    i want to execute the script file in qt,i used Qprocess to execute my script file.i getting error "premission denied",so i used chmod methos to execute my script file in qt,after that i execute my qt,,again i getting same error,please help me to recover thsi problem
    Thanks in advance
    my code below:
    Qt Code:
    1. int Widget::call()
    2. {
    3. if(directory1.exists(folder))
    4. {
    5. qDebug()<<"directory exist";
    6. directory1.cd(folder);
    7. QProcess opendir;
    8. QStringList arguments;
    9. QString program = folder;// "/home/digital"
    10. arguments <<"./samp.sh"; //"textfile"
    11. opendir.start(program, arguments);
    12. opendir.setProcessChannelMode(QProcess::ForwardedChannels);
    13. status = opendir.waitForFinished();
    14. if (!status)
    15. {
    16. qDebug()<< opendir.errorString()<<"error";
    17. return FAIL;
    18. }
    19. else
    20. {
    21. return SUCCESS;
    22. }
    23. }
    24. else
    25. {
    26. qDebug()<<"diretory not exist";
    27. }
    28.  
    29. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: doubt in by executing script file in qt

    What access rights does your script have? Who is the owner of the script?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2014
    Location
    Chennai
    Posts
    160
    Thanks
    65
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: doubt in by executing script file in qt

    i changed my mode chmod oug+rwx samp.sh
    Qt Code:
    1. -rwxrwxrwx 1 digital_images digital_images 98 Jun 15 05:26 samp.sh
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: doubt in by executing script file in qt

    Does it work now?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: doubt in by executing script file in qt

    Is /home/digital really the name of your program and you are passing an argument of samp.sh? Your error is because you can't execute a directory. Change your program variable to be the actual program you want to execute (i.e. /bin/sh or /bin/bash, etc).

  6. The following user says thank you to jefftee for this useful post:

    iswaryasenthilkumar (16th June 2015)

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: doubt in by executing script file in qt

    Quote Originally Posted by jefftee View Post
    Change your program variable to be the actual program you want to execute (i.e. /bin/sh or /bin/bash, etc).
    Or the script itself.
    Why execute something else if you want to execute samp.sh

    Cheers,
    _

Similar Threads

  1. executing script from c++ code
    By oogolov in forum Qt Programming
    Replies: 2
    Last Post: 14th January 2013, 10:34
  2. Error while executing the exe release file
    By harmodrew in forum Newbie
    Replies: 7
    Last Post: 21st September 2010, 10:21
  3. Problems with executing the *.exe file
    By iksarp in forum Newbie
    Replies: 14
    Last Post: 28th February 2010, 05:49
  4. Doubt in Ui file
    By phillip_Qt in forum Qt Programming
    Replies: 5
    Last Post: 12th March 2008, 11:26
  5. Executing SQL scripts from a file
    By William Wilson in forum Qt Programming
    Replies: 2
    Last Post: 30th August 2007, 19:28

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.