def __init__(self, host, port, **kwargs): # comtypes will try to import numpy to see if it is available. # Since Client64 passes its sys.path to Server32 the modules that # are available to Client64 to import are also available to Server32. # Therefore, we don't want this test to fail because the Python # environment that is running Client64 has numpy installed. # (This only appeared to be an issue when Client64 runs on Python 3.5) Server32.remove_site_packages_64bit() super(Shell32, self).__init__('WScript.Shell', 'com', host, port) self._environ = self.lib.Environment('System')
def __init__(self, host, port, **kwargs): # comtypes will try to import numpy to see if it is available. # Since Client64 passes its sys.path to Server32 the modules that # are available to Client64 to import are also available to Server32. # Therefore, we don't want this test to fail because the Python # environment that is running Client64 has numpy installed. # (This only appeared to be an issue when Client64 runs on Python 3.5) path = Server32.remove_site_packages_64bit() super(FileSystemObjectServer, self).__init__('Scripting.FileSystemObject', 'com', host, port) # put 'site-packages' back in if path: sys.path.append(path) self.temp_file = os.path.join(tempfile.gettempdir(), 'msl-loadlib-FileSystemObject.txt')
from msl.loadlib import LoadLibrary, Server32 # comtypes on the 32-bit server will try to import numpy # remove site-packages before importing msl.loadlib.activex if Server32.is_interpreter(): Server32.remove_site_packages_64bit() from msl.loadlib.activex import Application prog_id = 'MediaPlayer.MediaPlayer.1' class ActiveX(Server32): def __init__(self, host, port, **kwargs): super(ActiveX, self).__init__(prog_id, 'activex', host, port) def this(self): return self.lib.IsSoundCardEnabled() def static(self): return Application.load(prog_id).IsSoundCardEnabled() def create(self): return Application().load(prog_id).IsSoundCardEnabled() def parent(self): app = Application() return app.load(prog_id, parent=app).IsSoundCardEnabled() def panel(self): app = Application()