Return value from thread

I suggest you instantiate a Queue.Queue before starting the thread, and pass it as one of the thread’s args: before the thread finishes, it .puts the result on the queue it received as an argument. The parent can .get or .get_nowait it at will.

Queues are generally the best way to arrange thread synchronization and communication in Python: they’re intrinsically thread-safe, message-passing vehicles — the best way to organize multitasking in general!-)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)