As it stands, a QThread worker class enables the external call of an *.exe with Popen. While this external process is running, a QProgressBar within the governing class needs to be periodically updated.

The sample below works for a few percentage increments, then it suddenly freezes until the process is complete.

Qt Code:
  1. class workerThread(QThread):
  2. progress = pyqtSignal(int)
  3.  
  4. def runProgram(self,directory):
  5. file = directory+'fileName.txt'
  6. program = sys.path[4] + "/Root/GIS_Pre_Processor.exe"
  7. runProgram = Popen([program,file],shell=True,cwd=directory)
  8. currentProgress = 45
  9. while runProgram.poll() is None:
  10. time.sleep(1.5) #<=== makes it through a couple of these loops
  11. currentProgress = currentProgress + 5
  12. self.progress.emit(currentProgress)
  13. self.progress.emit(100)
To copy to clipboard, switch view to plain text mode 

Does this suggest an improper implementation of QThread?