Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Str encode in a thread
import time
import threading
def to_latin_1(event, value):
print(time.time(), "Before encode")
value.encode('latin-1', 'ignore')
print(time.time(), "After encode")
event.set()
print(time.time(), "Event set")
event = threading.Event()
thread = threading.Thread(target=to_latin_1, args=(event, u'42'))
thread.start()
event.wait(10)
import str_encode_thread
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.