I've got a daemon.py with a callback. How should I make the handler function execute a OS command?
A:
when i learned Python some time ago, I used:
import os
os.system('ls -lt')
but it seems like in Python 3.x, the recommended use is commands or os.popen()
動靜能量
2009-06-03 12:40:34
don't use os.system. It's recommended to use subprocess.Popen instead.
nosklo
2009-06-03 15:29:00