Reset to default
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
Try add an extra parameter
shell=True to the
Just a note.
shell=True was likely the correct solution to the o.p., since they did not make the following mistake, but you can also get the “No such file or directory” error if you do not split up your executable from its arguments.
import subprocess as sp, shlex sp.Popen(['echo 1']) # FAILS with "No such file or directory" sp.Popen(['echo', '1']) # SUCCEEDS sp.Popen(['echo 1'], shell=True) # SUCCEEDS, but extra overhead sp.Popen(shlex.split('echo 1')) # SUCCEEDS, equivalent to #2
shell=True, Popen expects the executable to be the first element of args, which is why it fails, there is no “echo 1” executable. Adding
shell=True invokes your system shell and passes the first element of
args to the shell. i.e. for linux,
Popen(['echo 1'], shell=True) is equivalent to
Popen('/bin/sh', '-c', 'echo 1') which is more overhead than you may need. See Popen() documentation for cases when
shell=True is actually useful.
You have to give the full path to your program
deactivate and then it the subprocess module should be able to find it.
I’m spawning subprocesses like that:
SHUTDOWN_CMD = os.path.sep.join(["c:", "windows", "system32", "shutdown.exe"]) def abortShutdown(): os.spawnv(os.P_NOWAIT, SHUTDOWN_CMD, [SHUTDOWN_CMD, '/A']) time.sleep(3)
I’m not using subprocess since Python 2.5 does not support it. I had to use use the FULL path to have it working and I guess you also have to use the full path to your custom commands.