Getting AttributeError: 'int' object has no attribute 'start' when trying to run a basic thread program
<p>I'm new to threads and am executing a very basic thread example. The following is the program I'm trying to execute:</p>

<pre><code>import os
import thread
import threading

def main():
    t1=thread.start_new_thread(prints,(3,))
    t2=thread.start_new_thread(prints,(5,))
    t1.start()
    t2.start()
    #t1.join()
    #t2.join()

def prints(i):
    while(i&gt;0):
        print "i="+str(i)+"\n"
        i=i-1

if __name__=='__main__':
   main()
</code></pre>

<p>When I try and execute, I keep getting the following error (<strong>AttributeError: 'int' object has no attribute 'start'</strong>):</p>

<pre><code>Traceback (most recent call last):
i=3
  File "thread_1.py", line 19, in &lt;module&gt;

    i=2

i=1
main()

i=5

i=4

i=3

i=2

i=1

  File "thread_1.py", line 8, in main
    t1.start()
AttributeError: 'int' object has no attribute 'start'
</code></pre>

<p>As can be seen from the output, both are getting executed but not the way I was expecting it to (which is interleaved prints or something like that). It seems more sequential too. How can I modify/correct my program to get the expected output?</p>