diff --git a/python/libgrass_interface_generator/ctypesgen/ctypedescs.py b/python/libgrass_interface_generator/ctypesgen/ctypedescs.py index c251e40af11..4b058504049 100755 --- a/python/libgrass_interface_generator/ctypesgen/ctypedescs.py +++ b/python/libgrass_interface_generator/ctypesgen/ctypedescs.py @@ -77,7 +77,7 @@ # This protocol is used for walking type trees. -class CtypesTypeVisitor: +class CtypesTypeVisitor(object): def visit_struct(self, struct): pass @@ -135,9 +135,9 @@ def remove_function_pointer(t): return t -class CtypesType: +class CtypesType(object): def __init__(self): - super().__init__() + super(CtypesType, self).__init__() self.errors = [] def __repr__(self): @@ -155,7 +155,7 @@ class CtypesSimple(CtypesType): """Represents a builtin type, like "char" or "int".""" def __init__(self, name, signed, longs): - super().__init__() + super(CtypesSimple, self).__init__() self.name = name self.signed = signed self.longs = longs @@ -166,7 +166,7 @@ def py_string(self, ignore_can_be_ctype=None): class CtypesSpecial(CtypesType): def __init__(self, name): - super().__init__() + super(CtypesSpecial, self).__init__() self.name = name def py_string(self, ignore_can_be_ctype=None): @@ -177,13 +177,13 @@ class CtypesTypedef(CtypesType): """Represents a type defined by a typedef.""" def __init__(self, name): - super().__init__() + super(CtypesTypedef, self).__init__() self.name = name def visit(self, visitor): if not self.errors: visitor.visit_typedef(self.name) - super().visit(visitor) + super(CtypesTypedef, self).visit(visitor) def py_string(self, ignore_can_be_ctype=None): return self.name @@ -191,13 +191,13 @@ def py_string(self, ignore_can_be_ctype=None): class CtypesBitfield(CtypesType): def __init__(self, base, bitfield): - super().__init__() + super(CtypesBitfield, self).__init__() self.base = base self.bitfield = bitfield def visit(self, visitor): self.base.visit(visitor) - super().visit(visitor) + super(CtypesBitfield, self).visit(visitor) def py_string(self, ignore_can_be_ctype=None): return self.base.py_string() @@ -205,14 +205,14 @@ def py_string(self, ignore_can_be_ctype=None): class CtypesPointer(CtypesType): def __init__(self, destination, qualifiers): - super().__init__() + super(CtypesPointer, self).__init__() self.destination = destination self.qualifiers = qualifiers def visit(self, visitor): if self.destination: self.destination.visit(visitor) - super().visit(visitor) + super(CtypesPointer, self).visit(visitor) def py_string(self, ignore_can_be_ctype=None): return "POINTER(%s)" % self.destination.py_string() @@ -220,7 +220,7 @@ def py_string(self, ignore_can_be_ctype=None): class CtypesArray(CtypesType): def __init__(self, base, count): - super().__init__() + super(CtypesArray, self).__init__() self.base = base self.count = count @@ -228,7 +228,7 @@ def visit(self, visitor): self.base.visit(visitor) if self.count: self.count.visit(visitor) - super().visit(visitor) + super(CtypesArray, self).visit(visitor) def py_string(self, ignore_can_be_ctype=None): if self.count is None: @@ -239,7 +239,7 @@ def py_string(self, ignore_can_be_ctype=None): return "%s * int(%s)" % (self.base.py_string(), self.count.py_string(False)) -class CtypesNoErrorCheck: +class CtypesNoErrorCheck(object): def py_string(self, ignore_can_be_ctype=None): return "None" @@ -249,7 +249,7 @@ def __bool__(self): __nonzero__ = __bool__ -class CtypesPointerCast: +class CtypesPointerCast(object): def __init__(self, target): self.target = target @@ -259,7 +259,7 @@ def py_string(self, ignore_can_be_ctype=None): class CtypesFunction(CtypesType): def __init__(self, restype, parameters, variadic, attrib=dict()): - super().__init__() + super(CtypesFunction, self).__init__() self.restype = restype self.errcheck = CtypesNoErrorCheck() @@ -291,7 +291,7 @@ def visit(self, visitor): self.restype.visit(visitor) for a in self.argtypes: a.visit(visitor) - super().visit(visitor) + super(CtypesFunction, self).visit(visitor) def py_string(self, ignore_can_be_ctype=None): return "CFUNCTYPE(UNCHECKED(%s), %s)" % ( @@ -319,7 +319,7 @@ def anonymous_struct_tag(): class CtypesStruct(CtypesType): def __init__(self, tag, attrib, variety, members, src=None): - super().__init__() + super(CtypesStruct, self).__init__() self.tag = tag self.attrib = attrib self.variety = variety # "struct" or "union" @@ -342,7 +342,7 @@ def __init__(self, tag, attrib, variety, members, src=None): self.src = src def get_required_types(self): - types = super().get_required_types() + types = super(CtypesStruct, self).get_required_types() types.add((self.variety, self.tag)) return types @@ -351,7 +351,7 @@ def visit(self, visitor): if not self.opaque: for name, ctype in self.members: ctype.visit(visitor) - super().visit(visitor) + super(CtypesStruct, self).visit(visitor) def get_subtypes(self): if self.opaque: @@ -374,7 +374,7 @@ def anonymous_enum_tag(): class CtypesEnum(CtypesType): def __init__(self, tag, enumerators, src=None): - super().__init__() + super(CtypesEnum, self).__init__() self.tag = tag self.enumerators = enumerators @@ -393,7 +393,7 @@ def __init__(self, tag, enumerators, src=None): def visit(self, visitor): visitor.visit_enum(self) - super().visit(visitor) + super(CtypesEnum, self).visit(visitor) def py_string(self, ignore_can_be_ctype=None): return "enum_%s" % self.tag diff --git a/python/libgrass_interface_generator/ctypesgen/descriptions.py b/python/libgrass_interface_generator/ctypesgen/descriptions.py index df91fc57eb9..aa9e6c2399f 100644 --- a/python/libgrass_interface_generator/ctypesgen/descriptions.py +++ b/python/libgrass_interface_generator/ctypesgen/descriptions.py @@ -7,7 +7,7 @@ """ -class DescriptionCollection: +class DescriptionCollection(object): """Represents a collection of Descriptions.""" def __init__( @@ -24,12 +24,12 @@ def __init__( self.output_order = output_order -class Description: +class Description(object): """Represents a constant, typedef, struct, function, variable, enum, or macro description. Description is an abstract base class.""" def __init__(self, src=None): - super().__init__() + super(Description, self).__init__() self.src = src # A tuple of (filename, lineno) # If object will be included in output file. Values are "yes", "never", @@ -82,7 +82,7 @@ class ConstantDescription(Description): """Simple class to contain information about a constant.""" def __init__(self, name, value, src=None): - super().__init__(src) + super(ConstantDescription, self).__init__(src) # Name of constant, a string self.name = name # Value of constant, as an ExpressionNode object @@ -102,7 +102,7 @@ class TypedefDescription(Description): """Simple container class for a type definition.""" def __init__(self, name, ctype, src=None): - super().__init__(src) + super(TypedefDescription, self).__init__(src) self.name = name # Name, a string self.ctype = ctype # The base type as a ctypedescs.CtypeType object @@ -120,7 +120,7 @@ class StructDescription(Description): """Simple container class for a structure or union definition.""" def __init__(self, tag, attrib, variety, members, opaque, ctype, src=None): - super().__init__(src) + super(StructDescription, self).__init__(src) # The name of the structure minus the "struct" or "union" self.tag = tag self.attrib = attrib @@ -147,7 +147,7 @@ class EnumDescription(Description): """Simple container class for an enum definition.""" def __init__(self, tag, members, ctype, src=None): - super().__init__(src) + super(EnumDescription, self).__init__(src) # The name of the enum, minus the "enum" self.tag = tag # A list of (name,value) pairs where value is a number @@ -169,7 +169,7 @@ class FunctionDescription(Description): """Simple container class for a C function.""" def __init__(self, name, restype, argtypes, errcheck, variadic, attrib, src): - super().__init__(src) + super(FunctionDescription, self).__init__(src) # Name, a string self.name = name # Name according to C - stored in case description is renamed @@ -199,7 +199,7 @@ class VariableDescription(Description): """Simple container class for a C variable declaration.""" def __init__(self, name, ctype, src=None): - super().__init__(src) + super(VariableDescription, self).__init__(src) # Name, a string self.name = name # Name according to C - stored in case description is renamed @@ -221,7 +221,7 @@ class MacroDescription(Description): """Simple container class for a C macro.""" def __init__(self, name, params, expr, src=None): - super().__init__(src) + super(MacroDescription, self).__init__(src) self.name = name self.params = params self.expr = expr # ExpressionNode for the macro's body @@ -240,7 +240,7 @@ class UndefDescription(Description): """Simple container class for a preprocessor #undef directive.""" def __init__(self, macro, src=None): - super().__init__(src) + super(UndefDescription, self).__init__(src) self.include_rule = "if_needed" self.macro = macro diff --git a/python/libgrass_interface_generator/ctypesgen/expressions.py b/python/libgrass_interface_generator/ctypesgen/expressions.py index d09227ede6f..07e0a1ed547 100644 --- a/python/libgrass_interface_generator/ctypesgen/expressions.py +++ b/python/libgrass_interface_generator/ctypesgen/expressions.py @@ -29,7 +29,7 @@ class is ExpressionNode. ExpressionNode's most useful method is py_string(), # On the other hand, this would be a challenge to write. -class EvaluationContext: +class EvaluationContext(object): """Interface for evaluating expression nodes.""" def evaluate_identifier(self, name): @@ -45,7 +45,7 @@ def evaluate_parameter(self, name): return 0 -class ExpressionNode: +class ExpressionNode(object): def __init__(self): self.errors = [] diff --git a/python/libgrass_interface_generator/ctypesgen/libraryloader.py b/python/libgrass_interface_generator/ctypesgen/libraryloader.py index ccb6b888b20..f54a036b3c0 100644 --- a/python/libgrass_interface_generator/ctypesgen/libraryloader.py +++ b/python/libgrass_interface_generator/ctypesgen/libraryloader.py @@ -66,7 +66,7 @@ class Lookup: mode = ctypes.DEFAULT_MODE def __init__(self, path): - super().__init__() + super(LibraryLoader.Lookup, self).__init__() self.access = dict(cdecl=ctypes.CDLL(path, self.mode)) def get(self, name, calling_convention="cdecl"): @@ -279,7 +279,7 @@ def _get_ld_so_conf_dirs(self, conf, dirs): else: for dir2 in glob.glob(match.group("pattern")): self._get_ld_so_conf_dirs(dir2, dirs) - except OSError: + except IOError: pass def _create_ld_so_cache(self): @@ -382,7 +382,7 @@ class Lookup(LibraryLoader.Lookup): """Lookup class for Windows libraries...""" def __init__(self, path): - super().__init__(path) + super(WindowsLibraryLoader.Lookup, self).__init__(path) self.access["stdcall"] = ctypes.windll.LoadLibrary(path) diff --git a/python/libgrass_interface_generator/ctypesgen/parser/cdeclarations.py b/python/libgrass_interface_generator/ctypesgen/parser/cdeclarations.py index 778d7388079..01cbe4be58c 100644 --- a/python/libgrass_interface_generator/ctypesgen/parser/cdeclarations.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/cdeclarations.py @@ -11,7 +11,7 @@ # -------------------------------------------------------------------------- -class Declaration: +class Declaration(object): def __init__(self): self.declarator = None self.type = Type() @@ -26,7 +26,7 @@ def __repr__(self): return "Declaration(%s)" % ", ".join(li) -class Declarator: +class Declarator(object): pointer = None def __init__(self): @@ -57,7 +57,7 @@ class Pointer(Declarator): pointer = None def __init__(self): - super().__init__() + super(Pointer, self).__init__() self.qualifiers = [] def __repr__(self): @@ -67,7 +67,7 @@ def __repr__(self): return "POINTER%s(%r)" % (q, self.pointer) + super(Pointer, self).__repr__() -class Array: +class Array(object): def __init__(self): self.size = None self.array = None @@ -83,7 +83,7 @@ def __repr__(self): return a -class Parameter: +class Parameter(object): def __init__(self): self.type = Type() self.storage = None @@ -100,7 +100,7 @@ def __repr__(self): return "Parameter(%s)" % ", ".join(li) -class Type: +class Type(object): def __init__(self): self.qualifiers = [] self.specifiers = [] @@ -122,7 +122,7 @@ def __repr__(self): return "TypeSpecifier({})".format(str(self)) -class StructTypeSpecifier: +class StructTypeSpecifier(object): def __init__(self, is_union, attrib, tag, declarations): self.is_union = is_union self.attrib = attrib @@ -152,7 +152,7 @@ def __repr__(self): return s -class EnumSpecifier: +class EnumSpecifier(object): def __init__(self, tag, enumerators, src=None): self.tag = tag self.enumerators = enumerators @@ -168,7 +168,7 @@ def __repr__(self): return s -class Enumerator: +class Enumerator(object): def __init__(self, name, expression): self.name = name self.expression = expression @@ -185,7 +185,7 @@ def __repr__(self): return "TypeQualifier({})".format(str(self)) -class PragmaPack: +class PragmaPack(object): DEFAULT = None def __init__(self): @@ -242,17 +242,17 @@ def pop(self, id=None): class Attrib(dict): def __init__(self, *a, **kw): if pragma_pack.current: - super().__init__(packed=True, aligned=[pragma_pack.current]) - super().update(*a, **kw) + super(Attrib, self).__init__(packed=True, aligned=[pragma_pack.current]) + super(Attrib, self).update(*a, **kw) else: - super().__init__(*a, **kw) + super(Attrib, self).__init__(*a, **kw) self._unalias() def __repr__(self): return "Attrib({})".format(dict(self)) def update(self, *a, **kw): - super().update(*a, **kw) + super(Attrib, self).update(*a, **kw) self._unalias() def _unalias(self): diff --git a/python/libgrass_interface_generator/ctypesgen/parser/cparser.py b/python/libgrass_interface_generator/ctypesgen/parser/cparser.py index 54745e417d8..b7dad2f4316 100755 --- a/python/libgrass_interface_generator/ctypesgen/parser/cparser.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/cparser.py @@ -17,7 +17,7 @@ # -------------------------------------------------------------------------- -class CLexer: +class CLexer(object): def __init__(self, cparser): self.cparser = cparser self.type_names = set() @@ -77,7 +77,7 @@ def token(self): # -------------------------------------------------------------------------- -class CParser: +class CParser(object): """Parse a C source file. Subclass and override the handle_* methods. Call `parse` with a string @@ -85,7 +85,7 @@ class CParser: """ def __init__(self, options): - super().__init__() + super(CParser, self).__init__() self.preprocessor_parser = preprocessor.PreprocessorParser(options, self) self.parser = yacc.yacc( method="LALR", diff --git a/python/libgrass_interface_generator/ctypesgen/parser/ctypesparser.py b/python/libgrass_interface_generator/ctypesgen/parser/ctypesparser.py index ea61a57ff62..f92ee080bd7 100644 --- a/python/libgrass_interface_generator/ctypesgen/parser/ctypesparser.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/ctypesparser.py @@ -82,7 +82,7 @@ class CtypesParser(CParser): """ def __init__(self, options): - super().__init__(options) + super(CtypesParser, self).__init__(options) self.type_map = ctypes_type_map if not options.no_python_types: self.type_map.update(ctypes_type_map_python_builtin) diff --git a/python/libgrass_interface_generator/ctypesgen/parser/datacollectingparser.py b/python/libgrass_interface_generator/ctypesgen/parser/datacollectingparser.py index 784e77cc173..207af66d106 100755 --- a/python/libgrass_interface_generator/ctypesgen/parser/datacollectingparser.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/datacollectingparser.py @@ -33,7 +33,7 @@ class DataCollectingParser(ctypesparser.CtypesParser, CtypesTypeVisitor): """ def __init__(self, headers, options): - super().__init__(options) + super(DataCollectingParser, self).__init__(options) self.headers = headers self.options = options @@ -76,7 +76,7 @@ def parse(self): f.write('#include "%s"\n' % os.path.abspath(header)) f.flush() try: - super().parse(fname, self.options.debug_level) + super(DataCollectingParser, self).parse(fname, self.options.debug_level) finally: os.unlink(fname) diff --git a/python/libgrass_interface_generator/ctypesgen/parser/lex.py b/python/libgrass_interface_generator/ctypesgen/parser/lex.py index 6e88b87d4d4..52019189adf 100644 --- a/python/libgrass_interface_generator/ctypesgen/parser/lex.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/lex.py @@ -56,7 +56,7 @@ def __init__(self, message, s): # Token class. This class is used to represent the tokens produced. -class LexToken: +class LexToken(object): def __str__(self): return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos) @@ -67,7 +67,7 @@ def __repr__(self): # This object is a stand-in for a logging object created by the # logging module. -class PlyLogger: +class PlyLogger(object): def __init__(self, f): self.f = f @@ -85,7 +85,7 @@ def error(self, msg, *args, **kwargs): # Null logger is used when no output is generated. Does nothing. -class NullLogger: +class NullLogger(object): def __getattribute__(self, name): return self @@ -168,7 +168,7 @@ def clone(self, object=None): # ------------------------------------------------------------ def writetab(self, lextab, outputdir=''): if isinstance(lextab, types.ModuleType): - raise OSError("Won't overwrite existing lextab module") + raise IOError("Won't overwrite existing lextab module") basetabmodule = lextab.split('.')[-1] filename = os.path.join(outputdir, basetabmodule) + '.py' with open(filename, 'w') as tf: @@ -549,7 +549,7 @@ def _statetoken(s, names): # This class represents information needed to build a lexer as extracted from a # user's input file. # ----------------------------------------------------------------------------- -class LexerReflect: +class LexerReflect(object): def __init__(self, ldict, log=None, reflags=0): self.ldict = ldict self.error_func = None @@ -826,7 +826,7 @@ def validate_rules(self): def validate_module(self, module): try: lines, linen = inspect.getsourcelines(module) - except OSError: + except IOError: return fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(') @@ -1035,7 +1035,7 @@ def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab', lexobj.writetab(lextab, outputdir) if lextab in sys.modules: del sys.modules[lextab] - except OSError as e: + except IOError as e: errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e)) return lexobj diff --git a/python/libgrass_interface_generator/ctypesgen/parser/preprocessor.py b/python/libgrass_interface_generator/ctypesgen/parser/preprocessor.py index ad7ba36eddf..38898874b09 100755 --- a/python/libgrass_interface_generator/ctypesgen/parser/preprocessor.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/preprocessor.py @@ -54,7 +54,7 @@ def token(self): # -------------------------------------------------------------------------- -class PreprocessorParser: +class PreprocessorParser(object): def __init__(self, options, cparser): self.defines = [ "__extension__=", @@ -188,7 +188,7 @@ def parse(self, filename): try: with open(self.options.save_preprocessed_headers, "w") as f: f.write(text) - except OSError: + except IOError: self.cparser.handle_error("Couldn't save headers.") self.lexer.input(text) diff --git a/python/libgrass_interface_generator/ctypesgen/parser/yacc.py b/python/libgrass_interface_generator/ctypesgen/parser/yacc.py index 535ed9f2229..f30cadb7a1a 100644 --- a/python/libgrass_interface_generator/ctypesgen/parser/yacc.py +++ b/python/libgrass_interface_generator/ctypesgen/parser/yacc.py @@ -105,7 +105,7 @@ # information, they can create their own logging object and pass # it into PLY. -class PlyLogger: +class PlyLogger(object): def __init__(self, f): self.f = f @@ -123,7 +123,7 @@ def error(self, msg, *args, **kwargs): critical = debug # Null logger is used when no output is generated. Does nothing. -class NullLogger: +class NullLogger(object): def __getattribute__(self, name): return self @@ -1312,7 +1312,7 @@ def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, # usyms - Set of unique symbols found in the production # ----------------------------------------------------------------------------- -class Production: +class Production(object): reduced = 0 def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0): self.name = name @@ -1384,7 +1384,7 @@ def bind(self, pdict): # reading table data from files. It only contains information # actually used by the LR parsing engine, plus some additional # debugging information. -class MiniProduction: +class MiniProduction(object): def __init__(self, str, name, len, func, file, line): self.name = name self.len = len @@ -1430,7 +1430,7 @@ def bind(self, pdict): # lr_before - Grammar symbol immediately before # ----------------------------------------------------------------------------- -class LRItem: +class LRItem(object): def __init__(self, p, n): self.name = p.name self.prod = list(p.prod) @@ -1476,7 +1476,7 @@ def rightmost_terminal(symbols, terminals): class GrammarError(YaccError): pass -class Grammar: +class Grammar(object): def __init__(self, terminals): self.Productions = [None] # A list of all of the productions. The first # entry is always reserved for the purpose of @@ -1974,7 +1974,7 @@ def build_lritems(self): class VersionError(YaccError): pass -class LRTable: +class LRTable(object): def __init__(self): self.lr_action = None self.lr_goto = None @@ -2730,7 +2730,7 @@ def lr_parse_table(self): def write_table(self, tabmodule, outputdir='', signature=''): if isinstance(tabmodule, types.ModuleType): - raise OSError("Won't overwrite existing tabmodule") + raise IOError("Won't overwrite existing tabmodule") basemodulename = tabmodule.split('.')[-1] filename = os.path.join(outputdir, basemodulename) + '.py' @@ -2841,7 +2841,7 @@ def write_table(self, tabmodule, outputdir='', signature=''): f.write(']\n') f.close() - except OSError as e: + except IOError as e: raise @@ -2939,7 +2939,7 @@ def parse_grammar(doc, file, line): # start symbol, error function, tokens, precedence list, action functions, # etc. # ----------------------------------------------------------------------------- -class ParserReflect: +class ParserReflect(object): def __init__(self, pdict, log=None): self.pdict = pdict self.start = None @@ -3007,7 +3007,7 @@ def validate_modules(self): for module in self.modules: try: lines, linen = inspect.getsourcelines(module) - except OSError: + except IOError: continue counthash = {} @@ -3312,7 +3312,7 @@ def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, star if debug: try: debuglog = PlyLogger(open(os.path.join(outputdir, debugfile), 'w')) - except OSError as e: + except IOError as e: errorlog.warning("Couldn't open %r. %s" % (debugfile, e)) debuglog = NullLogger() else: @@ -3488,14 +3488,14 @@ def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, star lr.write_table(tabmodule, outputdir, signature) if tabmodule in sys.modules: del sys.modules[tabmodule] - except OSError as e: + except IOError as e: errorlog.warning("Couldn't create %r. %s" % (tabmodule, e)) # Write a pickled version of the tables if picklefile: try: lr.pickle_table(picklefile, signature) - except OSError as e: + except IOError as e: errorlog.warning("Couldn't create %r. %s" % (picklefile, e)) # Build the parser diff --git a/python/libgrass_interface_generator/ctypesgen/printer_python/preamble.py b/python/libgrass_interface_generator/ctypesgen/printer_python/preamble.py index 3ebe0c5a6d5..f59907c0a5d 100644 --- a/python/libgrass_interface_generator/ctypesgen/printer_python/preamble.py +++ b/python/libgrass_interface_generator/ctypesgen/printer_python/preamble.py @@ -393,7 +393,7 @@ def UNCHECKED(type): # ctypes doesn't have direct support for variadic functions, so we have to write # our own wrapper class -class _variadic_function: +class _variadic_function(object): def __init__(self, func, restype, argtypes, errcheck): self.func = func self.func.restype = restype diff --git a/python/libgrass_interface_generator/ctypesgen/printer_python/printer.py b/python/libgrass_interface_generator/ctypesgen/printer_python/printer.py index 213aa294ede..b8e3280da32 100755 --- a/python/libgrass_interface_generator/ctypesgen/printer_python/printer.py +++ b/python/libgrass_interface_generator/ctypesgen/printer_python/printer.py @@ -120,7 +120,7 @@ def print_header(self): path = self.options.header_template try: template_file = open(path, "r") - except OSError: + except IOError: error_message( 'Cannot load header template from file "%s" ' " - using default template." % path, @@ -487,7 +487,7 @@ def strip_prefixes(self): def insert_file(self, filename): try: inserted_file = open(filename, "r") - except OSError: + except IOError: error_message('Cannot open file "%s". Skipped it.' % filename, cls="missing-file") self.file.write(