Is there there a way in micropython do do something similar to os.popen or subprocess.popen. I need to call a system command and push it through sed and awk and pull the result back into micropython
Thanks
Calling an OS system command
Re: Calling an OS system command
On Micropython there is no OS. What do you expect?
Re: Calling an OS system command
That depends on the port, the non-microcontroller ones do run on top of an OS. Since the OP asks about sed/awk/... this is likely the unix port.
Calling system commands (e.g. subprocess module) isn't currently implemented. You could achieve this using ffi calls though.
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: Calling an OS system command
os.system() and os.fork() are implemented in micropython-lib for the unix port. See some simple examples here: https://github.com/micropython/micropyt ... /master/os
Re: Calling an OS system command
ah, good find, I was looking at the subprocess module only but that's just a stub
-
- Posts: 11
- Joined: Fri Mar 04, 2022 9:47 am
Re: Calling an OS system command
os.system() and os.fork() don't support standard output redirect unfortunately unlike subprocess.Popen