subprocess problem
Wildman
best_lay at yahoo.com
Thu Feb 9 12:59:34 EST 2017
On Thu, 09 Feb 2017 11:16:18 -0600, Andreas Paeffgen wrote:
> I guess which does not return an error code. If it does not find
> anything, the return is just blank. If it finds something, the path is
> returned.
>
> So the change of code did not help, because there is just no error message.
> Could there be a $path problem in the subprocess started inside the binary?
Here is a method I frequently use to replace the which
command. (air code)
import os
pathlist = os.environ["PATH"].split(":")
def which(target)
for p in pathlist:
fullpath = p + "/" + target
if os.path.isfile(fullpath):
return fullpath, True
return "", False
target, found = which("pandoc")
if found:
target will contain the full path to pandoc
else:
pandoc was not found
--
<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!
More information about the Python-list
mailing list