Search for first existing directory, if cwd doesn't exist.

When starting an ipython application in a directory, that doens't exist,
search for first existing directory upwards instead of crashing.

See bug:
https://bugzilla.redhat.com/show_bug.cgi?id=593115