From ab6f9f97a38afe7fc928a475925a450479c6eb32 Mon Sep 17 00:00:00 2001 From: Hamel Husain Date: Wed, 16 Dec 2020 12:36:13 -0800 Subject: [PATCH] File needs to be in read mode --- docs/source/syntax.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/syntax.rst b/docs/source/syntax.rst index e0ea0355..823d345c 100644 --- a/docs/source/syntax.rst +++ b/docs/source/syntax.rst @@ -9,7 +9,7 @@ To syntax highlight code, construct a :class:`~rich.syntax.Syntax` object and pr from rich.syntax import Syntax console = Console() - with open("syntax.py", "wt") as code_file: + with open("syntax.py", "rt") as code_file: syntax = Syntax(code_file.read(), "python") console.print(syntax)