Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PYQT5 QThread: Destroyed while thread is still running
Forum Updated to NodeBB v4.3 + New Features

PYQT5 QThread: Destroyed while thread is still running

Scheduled Pinned Locked Moved Solved Qt for Python
22 Posts 3 Posters 7.5k Views 1 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
    25 Jul 2020, 13:26

    Rather than hard coding such a path, you might want to consider modifying the PATH environment variable using QProcessEnvironment so that you don't rely on where it could be exactly and also provide the option for your users to change the path where that application can be found.

    Y Offline
    Y Offline
    Yok0
    wrote on 25 Jul 2020, 13:37 last edited by Yok0
    #11

    @SGaist sure QProcessEnvironment is a better way.
    Also, I thought I could find the path programmatically like using shutil.which("app") but when the program is bundled and launched from the myApp.app. shutil.which() can't find program in /usr/local... it only find os based executable like ls.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Jul 2020, 18:46 last edited by
      #12

      How are you bundling it ?
      Is it a compiled executable ?

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

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        Yok0
        wrote on 25 Jul 2020, 18:59 last edited by
        #13

        I use fbs to package it for macos, it gives me an executable myApp.app

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 25 Jul 2020, 20:21 last edited by
          #14

          I meant the application you execute with QProcess.

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

          1 Reply Last reply
          0
          • Y Offline
            Y Offline
            Yok0
            wrote on 25 Jul 2020, 22:37 last edited by
            #15

            Oh it's youtube-dl and it's work fine like I said if I specify the absolute path of the executable in this case it's /usr/local/bin/...
            Sorry it's not related to QProcess but in some situations youtube-dl needs ffmpeg so I would check if it's installed on the system. That's why I use shutil.which('ffmpeg').
            It works great in my virtualenv but after compiled the program, shutil can't find the path of ffmpeg. Somehow it can't find apps in /usr/local/bin even if it is in $PATH. However it will find os based app like "ls", "mkdir"...

            J 1 Reply Last reply 26 Jul 2020, 12:23
            0
            • Y Yok0
              25 Jul 2020, 22:37

              Oh it's youtube-dl and it's work fine like I said if I specify the absolute path of the executable in this case it's /usr/local/bin/...
              Sorry it's not related to QProcess but in some situations youtube-dl needs ffmpeg so I would check if it's installed on the system. That's why I use shutil.which('ffmpeg').
              It works great in my virtualenv but after compiled the program, shutil can't find the path of ffmpeg. Somehow it can't find apps in /usr/local/bin even if it is in $PATH. However it will find os based app like "ls", "mkdir"...

              J Offline
              J Offline
              JonB
              wrote on 26 Jul 2020, 12:23 last edited by
              #16

              @Yok0
              Are you certain /usr/local/bin is on your PATH, really? Things like ls/mkdir are in /bin and/or /usr/bin, which will be on $PATH, maybe /usr/local/bin is not.

              Y 1 Reply Last reply 26 Jul 2020, 13:27
              0
              • J JonB
                26 Jul 2020, 12:23

                @Yok0
                Are you certain /usr/local/bin is on your PATH, really? Things like ls/mkdir are in /bin and/or /usr/bin, which will be on $PATH, maybe /usr/local/bin is not.

                Y Offline
                Y Offline
                Yok0
                wrote on 26 Jul 2020, 13:27 last edited by
                #17

                @JonB Yep! I did checked it.
                In my app I tried to displayed my $PATH with os.environ.get('PATH'). When I run it in my virtualenv, it shows me to correct $PATH with /usr/bin, /usr/bin/local/, .cargo/bin so on and so forth BUT after bundling the project in an executable, that same command only returns /usr/bin:/bin:/usr/sbin:/sbin
                The weird thing is that the app is run by the same user in venv and as a executable. The $PATH is somehow overridden.

                J 1 Reply Last reply 26 Jul 2020, 14:16
                0
                • Y Yok0
                  26 Jul 2020, 13:27

                  @JonB Yep! I did checked it.
                  In my app I tried to displayed my $PATH with os.environ.get('PATH'). When I run it in my virtualenv, it shows me to correct $PATH with /usr/bin, /usr/bin/local/, .cargo/bin so on and so forth BUT after bundling the project in an executable, that same command only returns /usr/bin:/bin:/usr/sbin:/sbin
                  The weird thing is that the app is run by the same user in venv and as a executable. The $PATH is somehow overridden.

                  J Offline
                  J Offline
                  JonB
                  wrote on 26 Jul 2020, 14:16 last edited by
                  #18

                  @Yok0
                  Yes, virtualenv's job is to set your path. It is not surprising it is different from path outside venv.

                  So your problem is that the executable you wish to run lives in a directory which is not on your usual path.

                  Y 1 Reply Last reply 26 Jul 2020, 16:20
                  0
                  • J JonB
                    26 Jul 2020, 14:16

                    @Yok0
                    Yes, virtualenv's job is to set your path. It is not surprising it is different from path outside venv.

                    So your problem is that the executable you wish to run lives in a directory which is not on your usual path.

                    Y Offline
                    Y Offline
                    Yok0
                    wrote on 26 Jul 2020, 16:20 last edited by
                    #19

                    @JonB mhm indeed the working direcory of the executable become /
                    instead of /Users/foo .. obvious, thanks.

                    J 1 Reply Last reply 26 Jul 2020, 17:41
                    0
                    • Y Yok0
                      26 Jul 2020, 16:20

                      @JonB mhm indeed the working direcory of the executable become /
                      instead of /Users/foo .. obvious, thanks.

                      J Offline
                      J Offline
                      JonB
                      wrote on 26 Jul 2020, 17:41 last edited by
                      #20

                      @Yok0
                      You're not executing this as root/su on the installed system, are you?

                      Y 1 Reply Last reply 26 Jul 2020, 19:56
                      0
                      • J JonB
                        26 Jul 2020, 17:41

                        @Yok0
                        You're not executing this as root/su on the installed system, are you?

                        Y Offline
                        Y Offline
                        Yok0
                        wrote on 26 Jul 2020, 19:56 last edited by
                        #21

                        @JonB nop regular user

                        J 1 Reply Last reply 27 Jul 2020, 08:17
                        0
                        • Y Yok0
                          26 Jul 2020, 19:56

                          @JonB nop regular user

                          J Offline
                          J Offline
                          JonB
                          wrote on 27 Jul 2020, 08:17 last edited by
                          #22

                          @Yok0
                          Then there's something "odd" about / being the working directory! The whole thing might make sense as root, as he may not have /usr/local/bin on his PATH.

                          1 Reply Last reply
                          0

                          20/22

                          26 Jul 2020, 17:41

                          • Login

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