xmpppy/xmpppy

AttributeError: 'TCPsocket' object has no attribute '_sock'

aslmx opened this issue · 4 comments

aslmx commented

Hi,

installed xmpppy via pip3.

# python3 -m pip install xmpppy
Collecting xmpppy
  Downloading https://www.piwheels.org/simple/xmpppy/xmpppy-0.7.1-py3-none-any.whl (77kB)
    100% |████████████████████████████████| 81kB 1.3MB/s 

Put my xmpp credentials in ~/.xsend as described in the README.md

cat ~/.xsend 
JID=bot@mydomain.tld
PASSWORD=supersecurepassword123

And then try to send myself a message

# xmpp-message --receiver myuser@mydomain.tld --message "hello world"
Traceback (most recent call last):
  File "/usr/local/bin/xmpp-message", line 10, in <module>
    sys.exit(simple_message())
  File "/usr/local/lib/python3.7/dist-packages/xmpp/cli.py", line 74, in simple_message
    send_message(options.jabberid, options.password, options.receiver, options.message, debug=options.debug)
  File "/usr/local/lib/python3.7/dist-packages/xmpp/cli.py", line 26, in send_message
    connection.connect()
  File "/usr/local/lib/python3.7/dist-packages/xmpp/client.py", line 203, in connect
    if not CommonClient.connect(self,server,proxy,secure,use_srv,transport) or secure!=None and not secure: return self.connected
  File "/usr/local/lib/python3.7/dist-packages/xmpp/client.py", line 175, in connect
    sock.PlugOut()
  File "/usr/local/lib/python3.7/dist-packages/xmpp/client.py", line 79, in PlugOut
    if 'plugout' in self.__class__.__dict__: ret = self.plugout()
  File "/usr/local/lib/python3.7/dist-packages/xmpp/transports.py", line 178, in plugout
    self._sock.close()
AttributeError: 'TCPsocket' object has no attribute '_sock'

This happens on my Raspberry Pi4 running DietPi (Debian).

On my Linux Mint 21.1 laptop it works fine though.

Any dependency missing? Can't get it working 🤔

Thanks!

gdt commented

python3.7 is ancient. I suggest upgrading to a non-EOL version, and today, would say 3.11 but 3.10 is ok.

It might be a bug that the requirements code in setup do not fail on 3.7.

amotl commented

Dear @aslmx,

can you spot any difference, or hint for a problem, when adding the --debug option to the command, and analyzing the output? If you can't, please share the output here.

With kind regards,
Andreas.

amotl commented

Running it on my workstation, the client connects successfully. However, it still complains about missing dnspython or pydns libraries, visible when using that --debug option. Maybe that could be a reason why the connection to the server does not succeed on one of your machines? Personally, I did not bother to install those packages, because everything worked well on my machine ;].

DEBUG: socket       warn  Could not load one of the supported DNS libraries (dnspython or pydns). SRV records will not be queried and you may need to set custom hostname/port for some servers to be accessible.\n
DEBUG: socket       start Successfully connected to remote host ('jabber.ccc.de', 5222)
aslmx commented

omg. Thanks. Now I feel stupid 🤦‍♂️ Could have thought about the --debug myself...

Yes, it was indeed missing both dnspython and `pydns.

While i could not easily install pydns, i could install dnspython and now it works just fine...

I was trusting too much on dependencies being installed automatically or if they were missing some obvious error messages. Maybe this can be added?

@gdt

python3.7 is ancient. I suggest upgrading to a non-EOL version, and today, would say 3.11 but 3.10 is ok.

Good to know. This is some "critical infrastructure". I will consider some upgrade soonish. Thanks for the hint!