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
2
votes
0 answers

Script in Python crashed when alt+tab is pressed repeatedly (pyhook and pythoncom)

I'm making a script in Python 3.5.2 on windows 10 that capture the keys that user press.The code works perfectly except when I press alt+tab to switch the windows, sometimes crashes immediately and sometimes crashes when I press it repeatedly. The…
2
votes
0 answers

cx_Freeze ImportError: No module named 'pythoncom'

Problem I get the following error when trying to run an .exe built with cx_Freeze: ImportError: No module named 'pythoncom' How could I troubleshoot this? Additional information Setup: Windows 7 Enterprise 64-bit WinPython-64bit-3.5.2.3Qt5 (Python…
Niko Föhr
  • 28,336
  • 10
  • 93
  • 96
2
votes
0 answers

PYTHON - Failing to import pythoncom

I'm a newbie to python (3.5 version) and I installed the mudule pywin32 to my computer. When I try to import pythoncom I get this error. >>> import **pythoncom** Traceback (most recent call last): File "", line 1, in
Falakienos
  • 107
  • 1
  • 5
2
votes
0 answers

win32com.client.Dispatch works, win32com.client.GetActiveObject doesnt

Im using python 2.7.9, windows 7... The overall goal: Have another application access our custom com server (already running at this point) and send it a message to be displayed. Obviously, there needs to be a single server, multiple clients. Im…
pyNewbie
  • 155
  • 1
  • 2
  • 10
2
votes
1 answer

How to pass arguments to win32com event handler

The code below works fine. I can't find a way to pass some arguments to EventHandler or to call methods of MainClass from EventHandler. For example instead of using constant param, I'd like to pass it through constructor or setter method. I've tried…
Leonid
  • 1,127
  • 2
  • 15
  • 29
2
votes
2 answers

How to work around `pywintypes.com_error` using pyrtd/pythoncom?

I am trying to use the pyrtd module for Python to get the information which can be got in Excel through RTD. However, when I try to run the sample python script, I get the following error: pywintypes.com_error:( -2147221164, 'Class not registered',…
Eric Wang
  • 1,009
  • 1
  • 9
  • 16
2
votes
6 answers

ImportError with cx_freeze and pywin32: Module 'pythoncom' isn't in frozen sys.path

I am attempting to create a .exe on Windows 7 from a python3 script using cx_freeze. the Script involves using pywin32 to manipulate Excel files. I can build the .exe successfully from my setup.py file; however, when I run the .exe, the following…
user2624177
  • 81
  • 1
  • 4
1
vote
0 answers

Unable to select named edges & faces using SelectByID2, and unable to use InsertMoldPartingLIne in the Soldiworks API

I am writing a Python script using the Solidworks 2022 API (via COM). I am trying to call the SelectByID2 method to select both a named edge and a named face for use in the InsertMoldPartingLine method. The InsertMoldPartingLine method requires the…
Mark
  • 11
  • 1
1
vote
1 answer

Alternative of xlwings without using CoInitialize

I am trying to write a code that will be able to replace cells in an existing excel sheet with a dataframe values. The lines work, but the problem is: that the codes require pythoncom library, a windows base library. So when I tried to upload it to…
1
vote
0 answers

com_error function not in pythoncom

I am working on a project in which we link Aspen Plus to Python, so we can apply a reinforcement learning agent to design and optimize a separation train. Meanwhile a lot of errors have been fixed, but currently I am stuc on the following…
steef12111
  • 11
  • 1
1
vote
2 answers

Capture all keypresses of the system with Tkinter

I'm coding a little tool that displays the key presses on the screen with Tkinter, useful for screen recording. Is there a way to get a listener for all key presses of the system globally with Tkinter? (for every keystroke including F1, CTRL, ...,…
Basj
  • 41,386
  • 99
  • 383
  • 673
1
vote
1 answer

ImportError: Module 'pythoncom' isn't in frozen sys.path

I tries to convert my .py file to .exe which uses PYTTSX3 module through PyInstaller command and also imported hidden imports like pyttsx3.drivers, pyttsx3.drivers.sapi5. Command used: pyinstaller .\SCREENER.PY --hidden-import pyttsx3.drivers.sapi5…
1
vote
0 answers

Delay in a callback causes other callbacks not being invoked in PyHook

import pyWinhook as pyHook import time def OnMouseEventLeft(event): print('MessageName: %s' % event.MessageName) time.sleep(2) //Intentional delay print("------") return True def OnKeyboardEvent(event): print('Key: %s' % …
1
vote
1 answer

How can I loop through excel pivot slicers using python win32?

I am trying to loop through all the slicers and then export it to PDF. I am having trouble looping through the Slicer Items. I have tried the following, items = ['abs', 'abc', 'abd', 'cdc', 'dvd'] for each in range(0, len(items)): itemSlicer =…
1
vote
3 answers

Error with win32com.client.GetObject when connecting to SAP GUI

Dears, first of all this is the first time I ask a question on Stackoverflow so forgive me if I'm not following the right way to do this. I kindly ask for your help as I'm facing an issue with win32com. I'm trying to connect to SAP GUI in order to…
Roberto P
  • 11
  • 1
  • 3