<div dir="ltr">You could have a worker thread or process that keeps the serial port open and listens for jobs on some kind of task queue.<div><br></div><div>However it's not clear to me how keeping the serial port open between requests provides assurance of data integrity.</div><div><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 11, 2018 at 9:27 AM Schoeni, Yann <<a href="mailto:Yann.Schoeni@moutier.ch" target="_blank">Yann.Schoeni@moutier.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="FR-CH" link="#0563C1" vlink="#954F72">
<div class="m_586988761496662626m_-6608087287779204246WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Hey there !
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">I’ve a web application which needs to send data to a serial port. The webserver uses ajax to send data to a python script.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">The Python script uses the serial module to open, send data, and close the serial port.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:red">Is there a way to keep the serial port open ?
<u></u><u></u></span></b></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Because for now, I open/close it between each transaction and I need to be 100% sure the data package will be send .. which is not the case with my actual python script.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#181818;background:#fffccf">Thank</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#242424;background:#fffeef"> </span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#181818;background:#fffccf">you</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#0c0c0c;background:#fffccf"> in</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:black;background:#fffbb8"> advance </span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#0c0c0c;background:#fffccf">for</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#181818;background:#fffccf"> yo</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#242424;background:#fffeef">ur
 an</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#303030;background:#fffeef">sw</span><span style="font-size:9.0pt;font-family:"Arial",sans-serif;color:#3c3c3c;background:white">er. </span><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">Best wishes</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif"><u></u> <u></u></span></b></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Yann Schoeni<u></u><u></u></span></b></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Municipalité de Moutier
<u></u><u></u></span></b></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Apprenti informaticien<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Tél. <a href="tel:+41%2032%20494%2011%2069" value="+41324941169" target="_blank">+41 (0)32 494 11 69</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">Mob. <a href="tel:+41%2079%20827%2030%2086" value="+41798273086" target="_blank">+41 (0)79 827 30 86</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif">E-mail
<a href="mailto:yann.schoeni@moutier.ch" target="_blank"><span style="color:blue">yann.schoeni@moutier.ch</span></a>
<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>

_______________________________________________<br>
python-win32 mailing list<br>
<a href="mailto:python-win32@python.org" target="_blank">python-win32@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-win32" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-win32</a><br>
</blockquote></div></div></div>