Kenny Meyer <knny.m...@gmail.com> wrote: > >I have to figure out if a string is callable on a Linux system. I'm >actually doing this: >... >Never mind the code, because this is not the original. >The side effect of subprocess.call() is that it *actually* executes >it, but I just need the return code. What are better ways of doing >this?
You can do what the "which" command does: split the PATH environment variable into individual components, and see if the string maps to a file in any directory in your PATH with the "execute" bit set. That won't catch shell macros, however. You might be able to use "type" to do that. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list