pythonpyqt5pyinstallerremote-debugging

Python PyQt5 Add Remote Debugging To Compiled Application


In my project I create an application which I then compile with pyinstaller.

The application allows the end-user to add HTML5 files into a folder which the python script then runs as a web app using PyQt5. As described in the documentation here to get remote debugging running I start the app by executing the following command line:

python main.py --remote-debugging-port=8080

Since this is a command line parameter, once I've compiled the project using pyinstaller this option is gone and the remote debugging tools are no longer available for the end-user.

What I need is to add the parameters inside the code like this:

if __name__ == "__main__":

    # Example Sudo Code:
    # startAppWithArguments("--remote-debugging-port=8080")

    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    app.exec_()

I've looked into Argparse but this does not seem to be what I'm looking for. Also I've sort of read that I could maybe pass the parameter into sys.argv but I failed make sense of it.

How can I add the remote debuigging parameter --remote-debugging-port=8080 to my application inside the code without needing the CLI to run it?


Solution

  • I found out that my approach was completely wrong.

    The acceped answer here is the actual soluttion. In short, after compiling the app, you make a shortcut of the exe and add the remote debugging option in the target field.