Hi all, I'm a complete Twisted newcomer, so still getting to grips with the ways thing work..
What I'm trying to do is submit a POST request when I receive email into my SMTP server. At the moment, I've basically modified emailserver.tac from the examples ( http://twistedmatrix.com/projects/mail/documentation/examples/emailserver.tac ) My eomReceived message has this code added to it: ... client = getPage(url='http://localhost:8080/message_event_notify', method='POST', postdata=urlencode(postdata), headers={ 'Content-Type': 'application/x-www-form-urlencoded' } ) client.addCallback(self.success) client.addErrback(self.failure) reactor.run() ... The POST request is received and processed as expected, and the success method is invoked, but then the server stacktraces and halts, while the SMTP sender client never completes. The server stacktrace: 2007/12/08 23:50 +0100 [SMTP,0,127.0.0.1] (Port 2500 Closed) 2007/12/08 23:50 +0100 [SMTP,0,127.0.0.1] Stopping factory <__builtin__.Smtp2HttpFactory instance at 0x13a4e68> 2007/12/08 23:50 +0100 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8080/message_event_notify> 2007/12/08 23:50 +0100 [SMTP,0,127.0.0.1] Main loop terminated. 2007/12/08 23:50 +0100 [SMTP,0,127.0.0.1] Unhandled Error Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/application/app.py", line 113, in runReactorWithLogging reactor.run() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 220, in run self.mainLoop() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 231, in mainLoop self.doIteration(t) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/internet/selectreactor.py", line 133, in doSelect _logrun(selectable, _drdw, selectable, method, dict) --- <exception caught here> --- File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/python/log.py", line 48, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/python/log.py", line 33, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/python/context.py", line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/python/context.py", line 37, in callWithContext return func(*args,**kw) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/internet/selectreactor.py", line 149, in _doReadOrWrite self._disconnectSelectable(selectable, why, method=="doRead") File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 258, in _disconnectSelectable selectable.connectionLost(failure.Failure(why)) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/internet/tcp.py", line 411, in connectionLost self._closeSocket() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/twisted/internet/tcp.py", line 100, in _closeSocket skt = self.socket exceptions.AttributeError: 'Server' object has no attribute 'socket' 2007/12/08 23:50 +0100 [-] Main loop terminated. 2007/12/08 23:50 +0100 [-] Server Shut Down. Does anyone have any suggestions? Thanks, James
_______________________________________________ Twisted-web mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
