Yeah, good catch - I'd just pasted from the function above (or below). I think I should just do a bare except, so that realpath is left as None is there is any problem trying to get a real path.