[Twisted-Python] inlinecallbacks, unhandled error....where?
steven meier
commercials24 at yahoo.de
Tue Jun 7 04:50:57 MDT 2016
hi,
ive got these two functions:
@inlineCallbacks
def getUserList():
reload_interval = yield getReloadInterval()
print "222", reload_interval
target_url = host + "/?ReloaderUserOnline"
body = urllib.urlencode({"reloadsequenz":reload_interval})
#body = '\r\n'
#headers = {'Content-Type': 'application/x-www-form-urlencoded'}
d = getPage(url = target_url, cookies=cookies, agent=useragent,
postdata=body,
method = 'POST',
headers=headers)
defer.returnValue(d)
i can see the output:
222 somenumber, so apparently getReloadInterval works. it returns some
magic number as expected
now i call getUserList from this function:
(response is 1, so d = getUserList gets evaluated)
but there i get:
222 5821
Unhandled error in Deferred (short version, complete error at the end)
Traceback (most recent call last):
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1184, in gotResult
def printLoginResult(response):
#we are in, login accepted
if response == ' 1':
print "we are in, get user list"
#printChat(response)
def printResult(result):
print repr(result)
d = getUserList()
d.addCallback(printResult)
d.addErrback(printResult)
why is printResult not run?
Unhandled error in Deferred:
Traceback (most recent call last):
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1184, in gotResult
_inlineCallbacks(r, g, deferred)
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1171, in _inlineCallbacks
deferred.callback(e.value)
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 393, in callback
self._startRunCallbacks(result)
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 501, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 588, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1184, in gotResult
_inlineCallbacks(r, g, deferred)
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1171, in _inlineCallbacks
deferred.callback(e.value)
File
"/home/julius/.local/lib/python2.7/site-packages/twisted/internet/defer.py", line 392, in callback
assert not isinstance(result, Deferred)
exceptions.AssertionError:
More information about the Twisted-Python
mailing list