]> granicus.if.org Git - file/commitdiff
Open file in binary mode for portability to Windows and Python 3.
authorReuben Thomas <rrt@sc3d.org>
Thu, 6 Jan 2011 21:34:45 +0000 (21:34 +0000)
committerReuben Thomas <rrt@sc3d.org>
Thu, 6 Jan 2011 21:34:45 +0000 (21:34 +0000)
python/example.py

index d78f15a8fcc6281a162a88b8157dd152014e2136..18965a1f27697ad27e5096525d575a9130dab829 100644 (file)
@@ -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()