| Reply | « Previous Thread | Next Thread » |
|
Hi all!
Sorry I very bad speek english (i am from russia). I have problem. Please help my. I try use thead in my script, but when i use Keyboard class my script and smart... hm... droop... i don't know how it is in english ) hm... say smart don't work. before restart. Keyboard class i get from ball. Done. I have solution.
Last edited by Cyxapeff : 2006-06-15 at 15:17.
|
|
I have problem again.
I write irc client. Code part: Code:
def connect(self): #this work
thread.start_new_thread(self.connect_bg,())
self.run=True
while self.run==True:
self.print_text()
e32.ao_sleep(0.1)
def connect_bg(self): #this work to!
self.read=1
self.hello=0
self.users_run=0
self.pref_run=0
self.run=1
self.F.write(u"!!!Connect \n")
self.read=1
appuifw.app.menu = [(u"Выход", self.exit)]
i=0
self.echo("open socket...","system")
print u"open socket.."
self.s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
self.echo("try connect...","system")
print u"try connect"
addr=(self.config['host'],self.config['port'])
self.s.connect(addr)
self.echo("connected.","system")
[skip connect command to server]
self.echo("OK! Server (please wait...):","system")
appuifw.app.menu = [(u"Отправить", self.send_msg), (u"Юзеры", self.users), (u"Скриншот", self.save_screen), (u"Выход", self.exit)]
self.listen=1
thread.start_new_thread(self.keys,())
self.echo("start listen","system")
self.chat()
def chat(self): #this NOT work (((
self.read=1
self.hello=0
self.users_run=0
self.pref_run=0
while self.run==True:
data = self.readline(self.s)
part=re.split(":",data)
part1=re.split(" ",part[1])
self.F.write(">"+data+"\n")
if part[0]=="PING ":
print u"< pong"
#self.text.append("< PONG :"+part[1]+"\n")
self.s.send("PONG :"+part[1]+"\n")
#self.F.write(u"< pong"+part[1]+"\n")
elif part1[1]=="353":
self.users=re.split(" ", part[2])
elif part1[1]=="PRIVMSG" and part1[2]==self.config['chanal']:
nick=re.split("~",part[1])
print u"> "+unicode(nick[0], self.config['encoding'])+": "+unicode(part[2], self.config['encoding'])
self.echo("> "+nick[0]+": "+part[2],"chat")
elif part1[1]=="PRIVMSG" and part1[2]==self.config['nick']:
nick=re.split("~",part[1])
print u"> "+unicode(nick[0], self.config['encoding'])+": "+unicode(part[2], self.config['encoding'])
self.echo("> "+nick[0]+": "+part[2],"in_privat")
else:
print u"> "+unicode(data, self.config['encoding'])
self.echo("> "+data,"system")
def readline(self,z):
s=[]
while 1:
c=z.recv(1)
s.append(c)
if c=='\n':
break
return ''.join(s)[:-2]
P.S May be I should publish other functions? Say me what you need. P.P.S Sorry for my english again...
Last edited by Cyxapeff : 2006-06-15 at 17:24.
|
|
Few things:
- you cannot use many pys60 objects between different threads. For example, you can only access UI stuff from the main thread. - implement proper logging module, and pin-point the problem. more detailed problem description is needed - please, try to improve your english! Try to add more print statements to your code. If you start another thread, use this kind of code to catch errors from it: Code:
def other_thread(): try: <code> except: import traceback traceback.print_exc() http://discussion.forum.nokia.com/fo...10&postcount=3 |
| simo.salminen |
| View Public Profile |
| Find all posts by simo.salminen |
|
Quote:
Quote:
Quote:
Quote:
|
|
Heh! I comment print and write log functions and script is work!
mla.... Now don't work send function ((. Must think....
Last edited by Cyxapeff : 2006-06-15 at 23:21.
|
|
Quote:
|
| simo.salminen |
| View Public Profile |
| Find all posts by simo.salminen |
|
Quote:
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| keypress thead priority | qqsg2004 | Mobile Java General | 0 | 2004-08-25 04:27 |