I want to ask the user to provide a file location from stdin.
How can I allow the user to navigate through the directory structure while typing? Things like tab for completing directory names...
raw_input
is unaware of the environment.
There is nothing I'm aware of in python that can out of the box accomplish what you seek. But you could fairly easily write such a thing using python's cmd module -- http://docs.python.org/2/library/cmd.html#module-cmd
It supports tab completion -- which gives you the option to write code that gets executed each time someone presses a key (or presses the tab key).
The python cmd module is basically a wrapper around the lower level gnu readline system (http://docs.python.org/2/library/readline.html#module-readline), so you could probably write what you want using just that system -- but the cmd modules has quite a bit of functionality that makes what you are trying to accomplish simpler.