A way of serving a simple HTTP server in parallel while fetching data from a serial interface using Python. Topics, processes?

I need a Python script that starts an HTTP server along with a serial port reader.

I know how to implement both things separately, but I'm not sure how to put them on the side, because the server requires servername.serve_forever()

it and the code won't get past that.

I am thinking about using a thread for web browsing and another for the serial part. I searched around and people recommended not using Threads because the GIL makes it impossible for threads to actually execute in parallel. They recommend using processes, but I'm not sure how.

Can anyone provide perhaps a snippet with two functions (simple, like printing something specific) running in parallel using processes?

+3


source to share





All Articles