diff --git a/nltk/draw/util.py b/nltk/draw/util.py index 8242edbff8..2f153e5971 100644 --- a/nltk/draw/util.py +++ b/nltk/draw/util.py @@ -1719,7 +1719,7 @@ def print_to_file(self, filename=None): pagex=0, pagey=0) # workaround for bug in Tk font handling postscript = postscript.replace(' 0 scalefont ', ' 9 scalefont ') - with open(filename, 'w') as f: + with open(filename, 'wb') as f: f.write(postscript.encode('utf8')) def scrollregion(self):