<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 10/21/2013 07:35 AM, Robert
Voigtländer wrote:<br>
</div>
<blockquote
cite="mid:CAH7aJjL6HpfS9AvAxUugaSHU6BqYOphc1w6i51Yct-TOL0E2LQ@mail.gmail.com"
type="cite">
<div dir="ltr"><span
style="font-family:arial,sans-serif;font-size:13px"></span>
<div dir="ltr"
style="font-family:arial,sans-serif;font-size:13px">
<div>
<div>
<div>def SerialInit():</div>
...</div>
</div>
</div>
</div>
</blockquote>
<blockquote
cite="mid:CAH7aJjL6HpfS9AvAxUugaSHU6BqYOphc1w6i51Yct-TOL0E2LQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div dir="ltr"
style="font-family:arial,sans-serif;font-size:13px">
<div>
<div> reactor.run()
<div><br>
</div>
<div><br>
</div>
<div>thread.start_new_thread(SerialInit())</div>
<div><br>
</div>
<div>if __name__ == '__main__':</div>
<div> print("-----")</div>
<div> s.write('123456789')</div>
<div> #s.write("\n")</div>
</div>
</div>
</div>
</div>
<br>
</blockquote>
1. Twisted is not thread-safe, so you can't call methods on the
protocol from another thread.<br>
<br>
2. As a result, you're probably best off not using threads at all.<br>
<br>
3. A reasonable place for the write() might be in your Protocol's
connectionMade method.<br>
<br>
</body>
</html>