Thread is somehow interfering with a while loop called after the thread is started

Irmen de Jong irmen.NOSPAM at xs4all.nl
Sun Jul 28 07:17:36 EDT 2013


On 28-7-2013 4:29, dan.h.mcinerney at gmail.com wrote:
> I have a simple scapy + nfqueue dns spoofing script that I want to turn into a thread within a larger program:
> 
> http://www.bpaste.net/show/HrlfvmUBDA3rjPQdLmdp/
> 
> Below is my attempt to thread the program above. Somehow, the only way the while loop actually prints "running" is if the callback function is called consistently. If the callback function isn't started, the script will never print "running". How can that be if the while loop is AFTER the thread was started? Shouldn't the while loop and the thread operate independantly?
> 
> http://bpaste.net/show/0aCxSsSW7yHcQ7EBLctI/
> 

Try adding sys.stdout.flush() after your print statements, I think you're seeing a
stdout buffering issue.


Irmen




More information about the Python-list mailing list