I'm pretty sure one would do this using the os.plock(op) function, but I have no idea how. Also, if there's a better way, I'd be grateful to find out. Code snippets are very welcome.
Python – How to share data between a parent and forked child process in Python
forkpythonshare
Related Question
- Python – Getting the class name of an instance
- Python – Convert bytes to a string
- Python – How to leave/exit/deactivate a Python virtualenv
- Python – Proper way to declare custom exceptions in modern Python
- Python – Why is reading lines from stdin much slower in C++ than Python
- Pythonic way to create a long multi-line string
- Python – Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3
Best Solution
Subprocess replaces os.popen, os.system, os.spawn, popen2 and commands. A simple example for piping would be:
You could also use a memory mapped file with the flag=MAP_SHARED for shared memory between processes.
multiprocessing abstracts both pipes and shared memory and provides a higher level interface. Taken from the Processing documentation: