title: 'bool' object is not iterable, Gray Hat Python example
body: <pre><code>import my_debugger
  from my_debugger_defines import *
  
  debugger = my_debugger.debugger()
  
  pid = raw_input("Enter the PID of the process to attach to: ")
  
  debugger.attach(int(pid))
  
  list = debugger.enumerate_threads()
  
  for thread in list:
  
      thread_context = debugger.get_thread_context(thread)
  
      print "[*] Dumping registers for thread ID: 0x%08x" % thread
      print "[**] EIP: 0x%08x" % thread_context.Eip
      print "[**] ESP: 0x%08x" % thread_context.Esp
      print "[**] EBP: 0x%08x" % thread_context.Ebp
      print "[**] EAX: 0x%08x" % thread_context.Eax
      print "[**] EBX: 0x%08x" % thread_context.Ebx
      print "[**] ECX: 0x%08x" % thread_context.Ecx
      print "[**] EDX: 0x%08x" % thread_context.Edx
      print "[*] END DUMP"
  
  debugger.detach()
  </code></pre>
  
  <p>Above is my test program and it produces the 'bool' object not iterable error and references line 12:  </p>
  
  <pre><code>for thread in list:
  </code></pre>
  
  <p>I did some research on iterable objects and basically found that it must be able to reiterate itself with different values (please correct me if I am wrong I have a very weak programming knowledge). I don't know how to fix the code to make this work. I have done a lot of googling and I am not experienced enough to reference a similar issue and apply it to my own code. This is code straight out of the book so I am just wondering if I have made a simple mistake or if it is more complicated. </p>
  
  <p>Also here is the defined function for enumerate threads</p>
  
  <pre><code>def enumerate_threads(self):
  
      thread_entry = THREADENTRY32()
      thread_list = []
      snapshot = kernel32.CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, self.pid)
  
      if snapshot is not None:
          thread_entry.dwSize = sizeof(thread_entry)
          success = kernel32.Thread32First(snapshot, byref(thread_entry))
  
      while success:
  
          if thread_entry.th32OwnerProcessID == self.pid:
              thread_list.append(thread_entry.th32ThreadID)
              success = kernel32.Thread32Next(snapshot, byref(thread_entry))
  
              kernel32.CloseHandle(snapshot)
              return thread_list
  
          else:
              return False
  </code></pre>
  
  <p>Please let me know if you need more info. I appreciate any help. Thanks in advance.</p>