Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
- logger = logging.getLogger()
- logger.setLevel(logging.DEBUG)
- fh = logging.FileHandler('log_filename.txt')
- fh.setLevel(logging.DEBUG)
- fh.setFormatter(formatter)
- logger.addHandler(fh)
- ch = logging.StreamHandler()
- ch.setLevel(logging.DEBUG)
- ch.setFormatter(formatter)
- logger.addHandler(ch)
- from subprocess import Popen, PIPE, STDOUT, CREATE_NEW_CONSOLE
- import subprocess
- import comtypes
- # A little test server, complete with typelib, we can use for testing.
- # Originally submitted with bug:
- # [ 753154 ] memory leak wrapping object having _typelib_guid_ attribute
- # but modified by mhammond for use as part of the test suite.
- import sys, os
- import comtypes
- import comtypes.server.localserver
- from comtypes.client import GetModule
- # generate wrapper code for the type library, this needs
- # to be done only once (but also each time the IDL file changes)
- GetModule("pippo.tlb")
- from comtypes.gen.TESTSERVERLib import Pippo
- class CPippo(Pippo):
- # registry entries
- _reg_threading_ = "Both"
- _reg_progid_ = "Python.Test.Pippo"
- _reg_novers_progid_ = "Python.Test.Pippo.3"
- _reg_desc_ = "Pippo Python test object1.1"
- _reg_clsctx_ = comtypes.CLSCTX_INPROC_SERVER | comtypes.CLSCTX_LOCAL_SERVER
- #_regcls_ = comtypes.server.localserver.REGCLS_MULTIPLEUSE
- def __init__(self):
- self.MyProp1 = 10
- def Method1(self):
- return wrap(CPippo())
- if __name__=='__main__':
- #main(sys.argv)
- from comtypes.server.register import UseCommandLine
- print comtypes.server.register.UseCommandLine(CPippo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement