You're calling the function findprogram before defining it.... if you simply rearrange your code so that the
def findprogram(program): block is first, you'll solve the problem. You'll then find that you forgot to
import sys
And then you'll find that you're trying to use some variable called program_path when instead you might have wanted fullpath
A good way to avoid this is to not ever let your code hang out in the ether like that... commonplace is to place your code all into functions, and have a main() function to call them... Here's a pretty commonly used method:
#!/usr/bin/python
import #whatever needs imported
def # Define some functions
def main():
# Do anything that needs done here
# Call functions, etc...
if __name__ == '__main__':
main()
Last edited by jlm699; Nov 26th, 2008 at 3:32 pm.