title: SendKeys failing after 2 runs in thread
body: <h1>Python and SendKeys</h1>
  <pre><code>import SendKeys, threading, pyHook, pythoncom
  class Auto(threading.Thread):
      def run(self):
          SendKeys.SendKeys(&quot;{ENTER}&quot;,pause=0.1);
          print('Sent');
          exit();
  def OnKeyboardEvent(event):
      if event.Ascii == 22:
          Auto().start();
      return True
          
  hm = pyHook.HookManager()
  hm.KeyDown = OnKeyboardEvent
  hm.HookKeyboard()
  pythoncom.PumpMessages()
  </code></pre>
  <p>For some reason this program fails after running it exactly two times, I have no idea what the cause for this is. When you comment out the SendKeys part the program runs fine, so it has to be a problem with send keys.</p>
  <p>[edit] Also,  to clarify, running SendKeys.SendKeys(...) in a for i in range(0,100) works, so I assume it's something to do with the thread. I've never programmed threads before. Also this is just a mockup example to replicate the problem.</p>
  <p>I'm running on windows 7, python2.6</p>
  <p>[edit]Also, the program doesn't 'fail' it simply freezes (the function isn't run at all, it just sits there)</p>