This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PPK cancelling 'start logging'

Hi. Great that you have added logging capability to the PPK desktop app. This was exactly what I needed.

I noticed one minor issue with the logging: When starting logging, it asks for a file to save the log to. If you cancel this dialog, it will still start logging and tries to save to a file with a blank name. This results in a flush of error messages to the terminal.

  • Hi, good to hear it is coming to good use, and thank you for the bug report!

    If you want it fixed right now, replace startLog() with this

    def startLog(self):
        self.stopLog()
        self.stopLogAction.setDisabled(False)
        filename = QtGui.QFileDialog.getSaveFileName(None, 'Dialog Title')
        if(len(filename[0]) is 0):
            print("No log file selected")
        else:
            try:
                self.plot_window.logfile_name = filename[0]
                self.plot_window.enable_log = True
                self.plot_window.log_stopped = False
                print("Started logging to %s" % filename[0])
                self.loggingAction.setDisabled(True)
                ret = QtGui.QMessageBox.information(None,
                                                    "Logging started!",
                                                    "Logging average data to %s started" % filename[0],
                                                    QtGui.QMessageBox.NoButton)
            except Exception as e:
                print(str(e))
                if ("Errno 13" in str(e)):
                    print(("Unable to write to logfile '" + filename[0] + "', write protected?"))
                    ret = QtGui.QMessageBox.warning(None,
                                                    "Unable to write to logfile!",
                                                    "Seems like %s is write protected.\
                                                    \r\nMS Excel does this, but notepad++ does not, so make sure \
                                                    \r\nto close any program that may have locked the file." % filename[0],
                                                    QtGui.QMessageBox.Ok,
                                                    QtGui.QMessageBox.NoButton)
    
Related