Questions tagged [pythoncom]

PythonCOM is a module, encapsulating the OLE automation API.

PythonCOM is a module, encapsulating the OLE automation API.

http://timgolden.me.uk/pywin32-docs/html/com/win32com/HTML/PythonCOM.html

108 questions
3
votes
2 answers

Python - pythoncom.com_error handling in Python 3.2.2

I am using Python 3.2.2, and building a Tkinter interface to do some Active Directory updating. I am having trouble trying to handle pythoncom.com_error exceptions. I grabbed some code from…
user1198460
  • 33
  • 1
  • 1
  • 3
3
votes
2 answers

Python, Pyglet, win32 API, COM: how to call IStream::Release if all I have is a pointer?

I am trying to fix a memory leak in Pyglet. It occurs only on win32, as it involves IStream object, allocated by ole32.CreateStreamOnHGlobal not being freed. You can find the issue #552 on Pyglet tracker by clicking here. As you can see in the…
dotz
  • 884
  • 1
  • 8
  • 17
3
votes
2 answers

How can we create multiple PDF files using different win32com instances?

I have been trying to create multiple pdf files using DispatchEx but when I try to test my code, it creates only first pdf file while all other requests fail with strange errors. What am I doing wrong and/or how can I effectively handle multiple…
J J
  • 43
  • 7
3
votes
1 answer

Importing pywinauto (or comtypes) clobbers existing COM object

Creating / getting a COM object using win32com.client.GetActiveObject and then import pywintypes results in an AttributeError upon each call to the original COM object. Code to reproduce import win32com.client catia_com =…
hansonap
  • 461
  • 1
  • 4
  • 16
3
votes
0 answers

pythoncom error invoking COM method excel new sheet

I have been working on some Python/Excel application, however I ran into an interesting issue. I have simplified the example to the extent producing the error. (Warning - infinite loop without break mechanism) from win32com.client import…
Peter Majko
  • 1,241
  • 11
  • 22
3
votes
2 answers

Windows startup with pyw file doesn't close cmd

I've been working on a small script that's supposed to run in the background of my computer. I already have the script working and everything except one thing that hours of google searching and hunting have not found the answer to. The file has a…
JustDucky
  • 132
  • 1
  • 10
3
votes
1 answer

How to correctly load a Windows COM DLL in Python

I am trying to load a windows COM DLL in Python to get all the exposed interfaces. Using the dependency walker tool I can list the functions in the dll. I see only 4…
sk11
  • 1,779
  • 1
  • 17
  • 29
3
votes
1 answer

I want to stop pythoncom working

I was writing a code about keylogging by pyHook. The following codes are example: import pythoncom as pc, pyHook as ph def KeyboardHook(event): print chr(event.Ascii) return True hm = ph.HookManager() hm.KeyDown =…
Eray Erdin
  • 2,633
  • 1
  • 32
  • 66
3
votes
2 answers

win32 Python - pythoncom error - ImportError: No module named pywintypes

I am trying to import pythoncom, but it gives me this error: Traceback (most recent call last): File "F:/Documents and Settings/Emery/Desktop/Python 27/Try", line 2, in import pythoncom File "F:\Python27\lib\site-packages\pythoncom.py",…
user1848679
  • 31
  • 1
  • 2
2
votes
2 answers

pyHook stops receiving Key press events (randomly)?

I have a program that captures all key presses using pyHook, then runs a few functions. I notice that after a while (of random duration), the program was stop receiving key triggers, even though I am pressing keys? Is pyHook unstable? I'm not…
Anti Earth
  • 4,671
  • 13
  • 52
  • 83
2
votes
0 answers

Creating a rule in outlook from python 3.10 to move to a different folder

I have created a function that uses the win32com library to create custom rules instead of creating them manually. I was not able to create the rule in outlook at first, so I tried to remove as much conditions as possible to find the error. This is…
HousamKak
  • 23
  • 3
2
votes
0 answers

Win32Com Python use one global Dispatcher instance to create multiple workbook objects in Flask

Heres the code of what im trying to implement from flask import Flask, request, jsonify import json import pythoncom import win32com.client from win32com.client import Dispatch xl = None xl = win32com.client.Dispatch("Excel.Application") app =…
Prateek
  • 31
  • 3
2
votes
3 answers

Ending a Program Mid-Run

pythoncom.PumpMessages() From what I understand this line basically tells the program to wait forever. For my purposes it seems to be working. However, I'd like to be able to end the program given the right stimulus. How would one go about ending…
rectangletangle
  • 50,393
  • 94
  • 205
  • 275
2
votes
0 answers

How to pass safearray from python to COM?

I need to pass list of Booleans values to COM as VT_ARRAY. from win32com.client import Dispatch, VARIANT import pythoncom api = Dispatch("MyAPI") controller = api.CreateInterface() first = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BOOL, [True,…
Denis
  • 63
  • 4
2
votes
0 answers

pyHook library Pyhook.PumpWaitingMessages returns nothing

So, I've been trying to play with this a little, and I have this next bit of code def KeyboardEvent(event): global log log.append(chr(event.Ascii)) print log return True hooks_manager = pyHook.HookManager() hooks_manager.KeyDown =…
Ido Kadosh
  • 81
  • 8