git » pygen » commit 1010165

Adjust isinstance(..., file) to Python 3

author Alberto Bertogli
2023-08-23 16:21:04 UTC
committer Alberto Bertogli
2023-08-23 16:21:04 UTC
parent f2a618158a91dc9bc28159c4f979c7c1f2afd5f9

Adjust isinstance(..., file) to Python 3

pygen +3 -2

diff --git a/pygen b/pygen
index 5dfeca6..56ab158 100755
--- a/pygen
+++ b/pygen
@@ -2,6 +2,7 @@
 
 import sys
 import os
+import io
 import shutil
 from optparse import OptionParser
 
@@ -31,10 +32,10 @@ def gen_from(src, dst, environ=None, incpath=None):
 
     # open files if necessary
     opened_src = opened_dst = False
-    if not isinstance(src, file):
+    if not isinstance(src, io.IOBase):
         src = open(src)
         opened_src = True
-    if not isinstance(dst, file):
+    if not isinstance(dst, io.IOBase):
         dst = open(dst, "w")
         opened_dst = True