From: Reuben Thomas Date: Thu, 6 Jan 2011 21:34:45 +0000 (+0000) Subject: Open file in binary mode for portability to Windows and Python 3. X-Git-Tag: FILE5_07~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55a2e87c3420bbb3e7489de88778679aeb14236b;p=file Open file in binary mode for portability to Windows and Python 3. --- diff --git a/python/example.py b/python/example.py index d78f15a8..18965a1f 100644 --- a/python/example.py +++ b/python/example.py @@ -4,10 +4,10 @@ import magic ms = magic.open(magic.MAGIC_NONE) ms.load() -tp = ms.file("/bin/ls") +tp = ms.file("/bin/ls") print (tp) -f = open("/bin/ls", "r") +f = open("/bin/ls", "rb") buffer = f.read(4096) f.close()