0

I am trying to launch a patching dll for The Lord of The Rings Online with QProcess and get the output, but it only works on Linux (where I am doing it through wine with QProcess).

I have tried a lot without success, and have come to the conclusion that the issue may be rundll32 launching the patcher as a separate process that is not tracked by QProcess. This doesn't even really hold up though, because the patching at least in my testing (others say it has worked sometimes) has not happened.

from qtpy import QtCore, QtWidgets
import sys

class PatchWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        self.setFixedSize(720, 400)

        self.txtLog = QtWidgets.QTextBrowser(self)
        self.txtLog.setGeometry(5,5,710,351)

        self.process = QtCore.QProcess()
        self.process.readyReadStandardOutput.connect(self.readOutput)
        self.process.readyReadStandardError.connect(self.readErrors)
        self.process.finished.connect(self.processFinished)

        self.process.setWorkingDirectory("C:/LOTRO/")

        self.show()

        self.startProcess()

    def readOutput(self):
        line = self.process.readAllStandardOutput()
        line = str(line, encoding="utf8", errors="replace")
        self.txtLog.append(line)

    def readErrors(self):
        line = self.process.readAllStandardError()
        line = str(line, encoding="utf8", errors="replace")
        self.txtLog.append(line)

    def processFinished(self, exitCode, exitStatus):
        self.txtLog.append("Process Finished")

    def startProcess(self):
        self.process.start("rundll32 patchclient.dll,Patch patch.lotro.com:6015 --language DE --productcode LOTRO --highres")
        self.txtLog.append("Process Started")

app = QtWidgets.QApplication(sys.argv)
PatchWindow = PatchWindow()

sys.exit(app.exec_())

There should be output similar to

Connecting to patch.lotro.com:6015

Checking files...
files to patch: 0 bytes to download: 0
Patching files:

File patching complete

, but there is nothing. The actual code for this is here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • Do not use waitForFinished if you are going to use signals since it is blocking, besides where are you QxxxApplication?.1) remove `self.process.waitForFinished()` 2) add `app = QtCore.QCoreApplication([])` before `example = example()` and `app.exec_()` after `example.startProcess()` – eyllanesc Jul 03 '19 at 03:13
  • This is supposed to be a minimal example. The actual code is linked at the end of the post if you want to look at it. Back to the example, Is it possible to set up the qt application like that without setting up a ui though? I can't seem to get it to work. –  Jul 05 '19 at 17:41
  • 1) We ask you for an [MRE], which is a minimum code but at the same time it is reproducible, and the one that has more weight is that of reproducible. 2) External links are only backup, you can break or modify the code and then your question does not make sense. So if you want help provide an MRE, if you do not, then your question is off-topic. – eyllanesc Jul 05 '19 at 22:46
  • I was trying to ask for help on making my example better, but I still appreciate that you are responding even if a bit rudely. I have edited my example quite a bit, so hopefully it meets your standards. I went ahead and made it a little actual ui where the text output is inside it and it is initiated in as proper a way as I know how. I don't know of any way to reproduce this unless the code runner also has LOTRO, but I think it would be the same issue with any dll. I just don't know of any standard dlls that could be used as an example. Hope this helps! I have been quite stumped by it. –  Jul 05 '19 at 23:34
  • In what part of my comment have I been rude? I think I have not been, remember that comments do not help much to express everything, they are very limited. On the other hand they are not my requirements, they are from the community, I recommend you read [ask] and pass the [tour] so that you understand me. – eyllanesc Jul 05 '19 at 23:38
  • I have already read through everything. I am just not very good at it. Anyways, I got an air of rudeness mostly from the last part of your comment since I had already mentioned that I had tried to make a minimal example. I never got offended or anything though and I hope you didn't either. Feel free to further critique if there is something unclear about my question still. –  Jul 05 '19 at 23:45

1 Answers1

0

The issue was that rundll32 doesn't provide any output for the dll on Windows. I was testing through WINE which does provide output. The couple reports of the patching working and more reports of it not working was a separate issue with PyInstaller. Not having a setup for testing on actual Windows made this much more difficult than it should have been.