Python win32api 模块,OutputDebugString() 实例源码

我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用win32api.OutputDebugString()

项目:rdkit4excel    作者:janholstjensen    | 项目源码 | 文件源码
def rdkit_descriptor(self, smiles, descriptor=u'MolLogP'):
        try:
            self.rdkit_info_num_calls = self.rdkit_info_num_calls + 1
            # win32api.OutputDebugString(str(type(smiles)) + " " + str(type(descriptor)))
            smiles = dispatch_to_str(smiles)
            descriptor = dispatch_to_str(descriptor)

            myfunction = getattr(Descriptors, descriptor)
            mol = Chem.MolFromSmiles(smiles)
            if mol != None:
                return myfunction(mol)
            else:
                # OK, so you are wondering how on Earth a function that is marked up
                # as out:float can return a string ?! Me too, but it works :-), and
                # makes it possible to show a decent error to the end user.
                # Apparently COM returns the value as a variant regardless of the
                # specified IDL retval type (?)...
                return 'ERROR: Cannot parse SMILES input.'
        except Exception as e:
            return "ERROR: " + str(e)

# Generates a molfile with 2D coordinates from SMILES input. Useful for depiction.
#RDKITXL: in:smiles:str, out:str
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def HandleOutput(self,message):
#       debug("QueueOutput on thread %d, flags %d with '%s'...\n" % (win32api.GetCurrentThreadId(), self.writeQueueing, message ))
        self.outputQueue.put(message)
        if win32api.GetCurrentThreadId() != self.mainThreadId:
            pass
#           debug("not my thread - ignoring queue options!\n")
        elif self.writeQueueing==flags.WQ_LINE:
            pos = message.rfind('\n')
            if pos>=0:
#               debug("Line queueing - forcing flush\n")
                self.QueueFlush()
                return
        elif self.writeQueueing==flags.WQ_NONE:
#           debug("WQ_NONE - flushing!\n")
            self.QueueFlush()
            return
        # Let our idle handler get it - wake it up
        try:
            win32ui.GetMainFrame().PostMessage(win32con.WM_USER) # Kick main thread off.
        except win32ui.error:
            # This can happen as the app is shutting down, so we send it to the C++ debugger
            win32api.OutputDebugString(message)

    # delegate certain fns to my view.
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def HandleOutput(self,message):
#       debug("QueueOutput on thread %d, flags %d with '%s'...\n" % (win32api.GetCurrentThreadId(), self.writeQueueing, message ))
        self.outputQueue.put(message)
        if win32api.GetCurrentThreadId() != self.mainThreadId:
            pass
#           debug("not my thread - ignoring queue options!\n")
        elif self.writeQueueing==flags.WQ_LINE:
            pos = message.rfind('\n')
            if pos>=0:
#               debug("Line queueing - forcing flush\n")
                self.QueueFlush()
                return
        elif self.writeQueueing==flags.WQ_NONE:
#           debug("WQ_NONE - flushing!\n")
            self.QueueFlush()
            return
        # Let our idle handler get it - wake it up
        try:
            win32ui.GetMainFrame().PostMessage(win32con.WM_USER) # Kick main thread off.
        except win32ui.error:
            # This can happen as the app is shutting down, so we send it to the C++ debugger
            win32api.OutputDebugString(message)

    # delegate certain fns to my view.
项目:OSPTF    作者:xSploited    | 项目源码 | 文件源码
def _trace_(self, *args):
    for arg in args[:-1]:
      win32api.OutputDebugString(str(arg)+" ")
    win32api.OutputDebugString(str(args[-1])+"\n")
项目:pupy    作者:ru-faraon    | 项目源码 | 文件源码
def _trace_(self, *args):
    for arg in args[:-1]:
      win32api.OutputDebugString(str(arg)+" ")
    win32api.OutputDebugString(str(args[-1])+"\n")
项目:rdkit4excel    作者:janholstjensen    | 项目源码 | 文件源码
def __init__(self):

# Structured comments starting with RDKITXL are used to markup published
# properties and functions. Only published properties and functions will
# be visible in Excel.
#
# Structured comments must immediately precede the line defining the
# property or function. So any comments describing the property or function
# must be placed *before* the structured comment.
#
# The marked-up properties and functions generate corresponding properties
# and functions in the RDKitXL.idl file which is then compiled to an
# RDKitXL.tlb type library that Excel can read.
#
# All data types have to be made explicit in the generated IDL. Accepted
# types in the structured comments are 'int', 'str', and 'float'.

# Get RDKit version string.
#RDKITXL: prop:str
        self.rdkit_info_version = rdkit.__version__

# Get number of function calls done. Requires all published functions to
# increment this value.
#RDKITXL: prop:int
        self.rdkit_info_num_calls = 0

# String parameters with default values:
#   Values must be unicode strings.
#   Values may not contain " inside the string.
#
# Debug output: Use win32api.OutputDebugString() and something like DbgView
# to trace it. Do not use print() - it will cause "Bad file descriptor" failures
# (suspect that it is a threading issue).

# Calculates a named RDKit descriptor value from a SMILES input.
#RDKITXL: in:smiles:str, inopt:descriptor:str, out:float
项目:rdkit4excel    作者:janholstjensen    | 项目源码 | 文件源码
def rdkit_smiles_to_molblock(self, smiles):
        self.rdkit_info_num_calls = self.rdkit_info_num_calls +1
        # win32api.OutputDebugString(str(type(smiles)))
        smiles = dispatch_to_str(smiles)

        mol = Chem.MolFromSmiles(smiles)        
        if mol != None:
            # Add coords for depiction.
            AllChem.Compute2DCoords(mol)
            return Chem.MolToMolBlock(mol)
        else:
            return 'ERROR: Cannot parse SMILES input.'
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def write(self,message):
        try:
            self.redir.write(message)
        except:
            win32api.OutputDebugString(message)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def _trace_(self, *args):
    for arg in args[:-1]:
      win32api.OutputDebugString(str(arg)+" ")
    win32api.OutputDebugString(str(args[-1])+"\n")
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def write(self,message):
        try:
            self.redir.write(message)
        except:
            win32api.OutputDebugString(message)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def _trace_(self, *args):
    for arg in args[:-1]:
      win32api.OutputDebugString(str(arg)+" ")
    win32api.OutputDebugString(str(args[-1])+"\n")