Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The function being called by threads:
Python
def Spawn(asdas,asdasdasd):
    print asdasdas+' : '+asdasd
    s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.connect(('asdasd.tv',66442))
    s.send('PASS '+asdasd+'\r\n')
    s.send('NICK '+asdasdas+'\r\n')
    s.send('JOIN #adasd\r\n')
    while True:
        print(s.recv(5345345))


Were the threads start going up:
Python
lines=tuple(open('data.txt', 'r'))
for line in lines:
    data=line.split(' ',1)
    t=threading.Thread(target=Spawn,args=(data[0].replace('\n',''),data[1].replace('\n','')))
    t.start()



What I need to be able to do is
Python
while True:
    cmd=raw_input('>> ')
    if(cmd.split(' ')[0]=="test"):
        print 'This is a test command'
    s.send('PRIVMSG #asdasd test\r\n')
    else:
        print 'Invalid command'</pre>

which doesn't work because it doesn't exist in this context
Posted
Updated 25-Oct-15 1:46am
v2
Comments
Richard MacCutchan 25-Oct-15 8:34am    
Probably has something to do with your rather silly variable names, and the fact that you mis-spell them inside the Spawn function.
Member 12085287 25-Oct-15 8:39am    
Not the issue
Richard MacCutchan 25-Oct-15 9:58am    
Really? I suggest you look more closely at what you have posted.
Member 12085287 25-Oct-15 10:35am    
That is not the actual code
Richard MacCutchan 25-Oct-15 11:11am    
Then the question makes no sense.

1 solution

C#
threading and raw input do not work together unless have something nowait/non blocking.

I advise to take a look at Gevent module.
Next time also unscramble your code, so we can see what your trying to do.
You can always leave the "security" parts out so long you put some pseudo example...or we can not help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900