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
Report if cwd does not exist and raise exception in BaseIPythonApplication

Catch the exception in the starting scripts, report the exception
and exit gracefully. Do not directly exit in BaseIPythonApplication so
that external applications can also catch the exception instead of exiting.
Use @catch_config_error to catch exception from getcwdu in nonexisting directory
Merge pull request #3142 from tomspur/cwd_not_there

Better error message when CWD doesn't exist on startup

Still fails, but presents a smaller, more sensible traceback.
Merge remote branch 'upstream/master'