Schoeni, Yann wrote:
>  
>
> « is the Python script persistent (is it running continuously in the
> background) or launched for each transaction? »
>
>  
>
> -       Currently, the script is launched for each transaction. As I
> understand your proposition, when the web page is open,
>
>        an ajax request should call a python script which open a thread
> between the machine and the serial peripheral, right ?
>

I'm still not clear what problems you are seeing with the
open/send/close paradigm.  What leads you to make a change?  The
open/send/close model is usually easier to handle, because the process
starts with a clean slate every time.  Once you go to a long-running
process, you have more things to keep track of.

Dennis is not necessarily proposing a new thread.  Consider, for
example, a server application using one of the frameworks, like Flask or
CherryPy or Django.  Such an application gets launched once, and sits
idle waiting for to send it things to do.  When it gets a request
(either from a socket or routed from Apache), it reads input, takes
action, sends output, then waits for more things to do.

Dennis' proposal is the same.  Have a Python script running
continuously.  When an Ajax request comes in (either from a socket or
from Apache), you communicate with the serial port and send your
response.  The serial port can remain open, because the application does
not close.

But I'm not convinced that complexity is needed.  The open/send/close
model should work just fine.


> -       Even if I find a way to open a thread with the serial port or
> to keep it open with a loop, is it possible to send it orders ?

Why wouldn't it?

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to