3

I try to get real time log in batch file with python, then show it to QGIS Plugin real time. ( .bat file have run -jar file )

I success logging but not real time log in QGIS because QGIS is stopped by .bat file ( it is not completed )

try:
    process = subprocess.Popen(
        'C:/val/start.bat',
        shell=False,
        stdout=subprocess.PIPE,
        #close_fds=True,
        #creationflags=DETACHED_PROCESS
    )


    while True:
        line = process.stdout.readline().decode('utf-8')
        self.dockwidget.plainTextEdit.appendPlainText(line)
        QgsMessageLog.logMessage(line, tag="Validating", level=QgsMessageLog.INFO)
        if not line : break

    self.iface.messageBar().pushMessage("Validating", "Validating is completed")

except:
    self.dockwidget.plainTextEdit.appendPlainText("##############Error##############")

I want not pause QGIS on running .bat file and logging at QGIS Plugin by real time.

How can I do that?? Is it possible??

  • That's an interesting question, for me too. I din't try, but may be this helps: endpoint.com/blog/2015/01/28/… At least, your question is not GIS related, so i would ask this in stackoverflow, for example. You will surely get more attention there. – Andreas Müller Sep 11 '18 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.