Thomas Heller schrieb: > Here's the next idea that I have for the version checking: Version check > inside > the generated modules, but using code outside: > > So, inside the generated module: > > ''' > from comtypes import check_wrapper_version > check_wrapper_version('42') > ''' > > comtypes.check_wrapper_version() would compare against the code generator > version, > and in the simplest case raise an ImportError("version mismatch"). In a more > sophisticated implementation it could regenerate and reload the module. >
I have implemented this now; the code simply compares the actual and the required version and raises an ImportError if they are unequal. Also I must admit that I have reintroduced the os.stat() calls on the typelib files and the generated module files, this is too damn convenient for me. The code is much simpler now, and if the generated module's timestamp is less than the typelib's timestamp an ImportError is also raised. If any of the os.stat() calls fail then the import succeeds. I wonder if there should be a way in comtypes to enable/disable this timestamp check? Currently I've enabled this code only when a script is run, in other words only when hasattr(sys, "frozen") is False. -- Thanks, Thomas ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users