diff --git a/python/ycm/tests/vimsupport_test.py b/python/ycm/tests/vimsupport_test.py index 120cb662..7e888e8a 100644 --- a/python/ycm/tests/vimsupport_test.py +++ b/python/ycm/tests/vimsupport_test.py @@ -1153,7 +1153,7 @@ def CheckFilename_test(): calling( vimsupport.CheckFilename ).with_args( 'nonexistent_file' ), raises( RuntimeError, "filename 'nonexistent_file' cannot be opened. " - "\[Errno 2\] No such file or directory: 'nonexistent_file'" ) + "No such file or directory." ) ) assert_that( vimsupport.CheckFilename( __file__ ), none() ) diff --git a/python/ycm/vimsupport.py b/python/ycm/vimsupport.py index a3d8425a..28ab8e4b 100644 --- a/python/ycm/vimsupport.py +++ b/python/ycm/vimsupport.py @@ -849,7 +849,8 @@ def CheckFilename( filename ): raise RuntimeError( "'{0}' is not a valid filename".format( filename ) ) except IOError as error: raise RuntimeError( - "filename '{0}' cannot be opened. {1}".format( filename, error ) ) + "filename '{0}' cannot be opened. {1}.".format( filename, + error.strerror ) ) def BufferIsVisibleForFilename( filename ):