Okay. So I'm trying to make 2 threads to run and increment a value so it knows when to stop. I'm kind of lost, because I'm new to Python, and everything looks right to me..
import threading;
import socket;
import time;
count = 0;
class inp(threading.Thread):
def run(self):
while count < 11:
time.sleep(0.5);
print("Thread 1!");
count += 1;
class recv_oup(threading.Thread):
def run(self):
while count < 31:
time.sleep(0.5);
print("Thread 2!");
count += 1;
inp().start();
recv_oup().start();
And the error is quite long...
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "core.py", line 9, in run
while count < 11:
UnboundLocalError: local variable 'count' referenced before assignment
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "core.py", line 16, in run
while count < 31:
UnboundLocalError: local variable 'count' referenced before assignment
I have no clue what's happening. As I said, new to Python, so this is all gibberish to me. Any help is greatly appreciated