informative error when trying to load directories

prior to this commit, the error message for trying to load a directory
looked like this:

    ValueError: '~' was not found in history, as a file, url, nor in the
    user namespace.

now, the error displayed is as follows:

    ValueError: '~' is a directory, not a regular file.