diff --git a/m2r.py b/m2r.py index a4e43c2..fad531a 100644 --- a/m2r.py +++ b/m2r.py @@ -10,8 +10,7 @@ from argparse import ArgumentParser, Namespace from docutils import statemachine, nodes, io, utils from docutils.parsers import rst -from docutils.core import ErrorString -from docutils.utils import SafeString, column_width +from docutils.utils import column_width import mistune if sys.version_info < (3, ): @@ -609,10 +608,10 @@ class MdInclude(rst.Directive): raise self.severe('Problems with "%s" directive path:\n' 'Cannot encode input file path "%s" ' '(wrong locale?).' % - (self.name, SafeString(path))) + (self.name, path)) except IOError as error: raise self.severe('Problems with "%s" directive path:\n%s.' % - (self.name, ErrorString(error))) + (self.name, io.error_string(error))) # read from the file startline = self.options.get('start-line', None) @@ -625,7 +624,7 @@ class MdInclude(rst.Directive): rawtext = include_file.read() except UnicodeError as error: raise self.severe('Problem with "%s" directive:\n%s' % - (self.name, ErrorString(error))) + (self.name, io.error_string(error))) config = self.state.document.settings.env.config converter = M2R(