JoinMarket-Org / joinmarket-clientserver

Bitcoin CoinJoin implementation with incentive structure to convince people to take part
GNU General Public License v3.0
731 stars 179 forks source link

joinmarket-qt.sh: Failed to setup joinmarket: AttributeError("'NoneType'" object has no attribute 'write'") #1570

Open domohawk opened 1 year ago

domohawk commented 1 year ago

Fresh installs of 9.5, 9.10 and git head repro on first run after setting new joinmarket.cfg 's rpc info.

If I print the exception:

User data location: /home/user/.joinmarket/ Traceback (most recent call last): File "/home/user/bin/joinmarket-clientserver-git/scripts/joinmarket-qt.py", line 2393, in load_program_config(config_path=options.datadir) File "/home/user/bin/joinmarket-clientserver-git/src/jmclient/configure.py", line 767, in load_program_config global_singleton.bc_interface = get_blockchain_interface_instance( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/bin/joinmarket-clientserver-git/src/jmclient/configure.py", line 902, in get_blockchain_interface_instance bc_interface = BitcoinCoreInterface(rpc, network, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/bin/joinmarket-clientserver-git/src/jmclient/blockchaininterface.py", line 319, in init blockchainInfo = self._rpc("getblockchaininfo", []) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/bin/joinmarket-clientserver-git/src/jmclient/blockchaininterface.py", line 416, in _rpc log.debug('rpc: ' + method + " " + str(args)) File "/usr/lib/python3.11/logging/init.py", line 1477, in debug self._log(DEBUG, msg, args, **kwargs) File "/usr/lib/python3.11/logging/init.py", line 1634, in _log self.handle(record) File "/usr/lib/python3.11/logging/init.py", line 1644, in handle self.callHandlers(record) File "/usr/lib/python3.11/logging/init.py", line 1706, in callHandlers hdlr.handle(record) File "/usr/lib/python3.11/logging/init.py", line 978, in handle self.emit(record) File "/home/user/bin/joinmarket-clientserver-git/scripts/qtsupport.py", line 201, in emit if record: XStream.stdout().write('%s\n' % record) ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'write'

Seems like a Qt issue? wallet-tool.py and sendpayment.py seem to work.

I hadn't run joinmarket-qt.sh on my manjaro/arch system in a while. Since then it looks like it's updated from Qt 5.15.5 to 5.15.10.

Also despite the install.sh succeeding, run_tests.sh shows massive failures (log attached) though that looks unrelated (do I need to set bitcoin.conf or something to run tests?) run_tests_errors.txt

kristapsk commented 1 year ago

Yes, it's issue with Qt GUI only, command line tools should work. Reason could be both Python and Qt versions.

It wasn't working already with Python 3.10, see #1343 and #1447, no reason to think Python 3.11 would solve it somehow.

Proper solution is to migrate to PySide6, but nobody has done that.

Also despite the install.sh succeeding, run_tests.sh shows massive failures (log attached) though that looks unrelated (do I need to set bitcoin.conf or something to run tests?)

That's unrelated. Test suite tries to start bitcoind, but cannot find it.

E               FileNotFoundError: [Errno 2] No such file or directory: 'bitcoind'

/usr/lib/python3.11/subprocess.py:1950: FileNotFoundError
domohawk commented 1 year ago

So I remember hitting the setInterval() issue from those issues long back, makes sense to be around 12/2021 when arch upgraded to python3.10. However at the time I just hacked an int() cast at that one line to make it: self._timer.setInterval(int(timeout * 1000)) and I'd been running fine until now.

I just remembered I have a neglected mirrored arch laptop and booted it up. Sure enough it has a cast-hacked joinmarket-qt.sh 0.9.5 working with python 3.10.9.

So it seems the new error appears somewhere between the upgrades:

Not that it's the only new error, commenting out that log line yields:

Traceback (most recent call last): File "/home/user/bin/joinmarket-clientserver-git/scripts/joinmarket-qt.py", line 2454, in tabWidget.addTab(JMWalletTab(), "JM Wallet") ^^^^^^^^^^^^^ File "/home/user/bin/joinmarket-clientserver-git/scripts/joinmarket-qt.py", line 1459, in init self.initUI() File "/home/user/bin/joinmarket-clientserver-git/scripts/joinmarket-qt.py", line 1466, in initUI self.label1.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) TypeError: 'PySide2.QtCore.Qt.AlignmentFlag' object cannot be interpreted as an integer

domohawk commented 1 year ago

So arch has python39 and python310 packages in the AUR. I installed these then reinstalled JM with ./install.sh -p /usr/bin/python3.X.

So with python-pyqt 5.15.9 and qt5-base 5.15.10:

  1. python3.9 works
  2. python3.10 works with the int() casting hack I mentioned earlier

So it seems the problem is indeed the brittleness of the qt binding layer, from what seems to be increasing strictness and/or type behavior progressing from python 3.9 > 3.10 > 3.11

svpi11 commented 1 year ago

Sorry but I didn't get it, so what is the best option to be able to use joinmarket-qt now, on the last ubuntu/debian version ?

svpi11 commented 1 year ago

The only option is to downgrade to python 3.9? Is there an easy way to do that ?

domohawk commented 1 year ago

The only option is to downgrade to python 3.9? Is there an easy way to do that ?

Googling it for Ubuntu it looks like you can just add a PPA then install python3.9 .

espronceda commented 11 months ago

@domohawk

However at the time I just hacked an int() cast at that one line to make it: self._timer.setInterval(int(timeout * 1000)) and I'd been running fine until now.

I've searched for that line of code on all the scripts but i've been unable to find it. Could you please give me directions on what script/line should I insert the int() cast? I'm using the latest version (0.9.10). Thank you so much.

domohawk commented 11 months ago

@espronceda : jmvenv/lib64/python*/site-packages/qt5reactor/core.py:306

It's not in JM code, but in dependency code that's pulled in when you build. So build it then edit the line.

Honestly it's a better solution to install python3.9 alongside your main one so you don't have to worry about your distro updating beyond python 3.10