Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

xmlstream.py AttributeError #106

Open
giampaolo opened this Issue Oct 4, 2011 · 5 comments

Comments

Projects
None yet
3 participants

I get this after upgrading to latest version of sleek:

Traceback (most recent call last):
File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
File "/usr/lib64/python2.6/threading.py", line 484, in run
File "/home/arka/arka.env/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1320, in _send_thread
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'

Collaborator

legastero commented Oct 4, 2011

Is this occurring as you're shutting down Sleek?

No, during startup.

Collaborator

legastero commented Oct 4, 2011

I'm having difficulty reproducing this. I see you're using Python 2.6, but with RC2 or the develop branch? And are you just running one of the examples, or some custom code?

I'm using custom code, an actual (quite complex) app, so it's not easy to provide a snippet which reproduces the problem.
I'll try to narrow down the issue and provide a piece of code which reproduces the problem.

I kind of have the same problem (AttributeError in xmlstream) when closing a component connection using signals.

The code is the following:

import sys
import logging
import signal
import sleekxmpp
from sleekxmpp.componentxmpp import ComponentXMPP

if sys.version_info < (3, 0):
    from sleekxmpp.util.misc_ops import setdefaultencoding
    setdefaultencoding('utf8')
else:
    raw_input = input

def stop_call(signum, frame):
    xmpp.disconnect()

logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s %(levelname)-8s %(message)s")

signal.signal(signal.SIGINT, stop_call)
global xmpp
jid = "myjid"
password = "mypass"
server = "localhost"
port = 8894
xmpp = ComponentXMPP(jid, password, server, port)
if xmpp.connect():
    xmpp.process(block=True)

And the console output:

2016-09-07 18:14:55,334 DEBUG    Event triggered: session_bind
2016-09-07 18:14:55,335 DEBUG    Event triggered: session_start

^C2016-09-07 18:14:59,371 DEBUG    Event triggered: session_end
2016-09-07 18:14:59,372 DEBUG    SEND (IMMED): </stream:stream>
2016-09-07 18:14:59,372 INFO     Waiting for </stream:stream> from server
2016-09-07 18:15:03,372 DEBUG    Stopped event runner thread. 2 threads remain.
2016-09-07 18:15:03,373 DEBUG    Stopped send thread. 1 threads remain.
2016-09-07 18:15:03,373 DEBUG    Waiting for 1 threads to exit.
2016-09-07 18:15:04,341 DEBUG    Quitting Scheduler thread
2016-09-07 18:15:04,341 DEBUG    Stopped scheduler thread. 0 threads remain.
2016-09-07 18:15:04,389 DEBUG    Event triggered: disconnected
2016-09-07 18:15:04,389 DEBUG     ==== TRANSITION connected -> disconnected
2016-09-07 18:15:04,389 ERROR    'NoneType' object has no attribute 'recv'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1481, in _process
    if not self.__read_xml():
  File "/usr/lib/python2.7/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 1523, in __read_xml
    for event, xml in ET.iterparse(self.filesocket, (b'end', b'start')):
  File "<string>", line 100, in next
  File "/usr/lib/python2.7/site-packages/sleekxmpp/xmlstream/filesocket.py", line 35, in read
    data = self._sock.recv(size)
AttributeError: 'NoneType' object has no attribute 'recv'

I have sleekxmpp version 1.3.1.
Am I doing something wrong which causes this exception?
Is it safe to ignore the exception since BaseXMPP.exception only logs it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment