<div dir="ltr">Thanks for the fast reply.<div>I don't yet understand your answer. I may have to dig more into Python.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 October 2013 13:45, Itamar Turner-Trauring <span dir="ltr"><<a href="mailto:itamar@itamarst.org" target="_blank">itamar@itamarst.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>On 10/21/2013 07:35 AM, Robert
Voigtländer wrote:<br>
</div>
<blockquote 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 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>
</div>
<br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br></div>