[Twisted-Python] Writing a plug-in for an online game that uses UDP
Ibrahim Mubarak
ibmub80 at yahoo.com
Mon Jul 26 14:01:36 EDT 2004
--- Jp Calderone <exarkun at divmod.com> wrote:
> Ibrahim Mubarak wrote:
> > self.iiwuservice.logUser(user, pswd, host,
> port).addCallback(self.sendingOutput(self,
> > host, port))
>
> The above line is a problem. I believe you want it to read:
You are 100% right. I can't believe I made that mistake as I was reading the docs when writing
this, hehe. But now I have another problem. This time is with the callback function never being
called.
Here is a small script that I worte and executed it with "...$ python deferredExample.py" :
////////CODE START\\\\\\\\
from twisted.enterprise import adbapi
dbpool = adbapi.ConnectionPool("MySQLdb", 'iiwu_database', 'login', 'password')
def getUserData(user):
return dbpool.runQuery("SELECT name, pswd, ip, port FROM users WHERE name = ?", user)
def printResult(l):
if l:
print l[0][0]
else:
print "No such user"
def printError(failure):
import sys
sys.stderr.write(str(failure))
getUserData("ib").addCallback(printResult).addErrback(printError)
print "\nEND OF FILE\n"
\\\\\\\\CODE END////////
I do see the "END OF FILE" printed, but that's it. Do you have any idea what is going on?
Thanks,
ib
_______________________________
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.
http://messenger.yahoo.com
More information about the Twisted-Python
mailing list