#!/usr/bin/env python3.7

# Copyright (C) 2019 Andrew Hamilton. All rights reserved.
# Licensed under the Artistic License 2.0.


import pydoc
import sys

import eris.termstr


class TermDoc(pydoc.TextDoc):

    def bold(self, text):
        return str(eris.termstr.TermStr(text).bold())


def main():
    path = sys.argv[1]
    try:
        print(pydoc.render_doc(pydoc.importfile(path), renderer=TermDoc()))
    except pydoc.ErrorDuringImport as e:
        print(e)
        return 1


if __name__ == "__main__":
    main()

#!/usr/bin/env python3.7

# Copyright (C) 2019 Andrew Hamilton. All rights reserved.
# Licensed under the Artistic License 2.0.


import pydoc
import sys

import eris.termstr


class TermDoc(pydoc.TextDoc):

    def bold(self, text):
        return str(eris.termstr.TermStr(text).bold())


def main():
    path = sys.argv[1]
    print(pydoc.render_doc(pydoc.importfile(path), renderer=TermDoc()))


if __name__ == "__main__":
    main()

--- 
+++ 
@@ -18,7 +18,11 @@
 
 def main():
     path = sys.argv[1]
-    print(pydoc.render_doc(pydoc.importfile(path), renderer=TermDoc()))
+    try:
+        print(pydoc.render_doc(pydoc.importfile(path), renderer=TermDoc()))
+    except pydoc.ErrorDuringImport as e:
+        print(e)
+        return 1
 
 
 if __name__ == "__main__":
tools: Make pydoc quieter on error.
