Skip to main content

Questions tagged [pywin32]

The PyWin32 package is a close wrapper around Microsoft Windows API. It was created and is still maintained by Mark Hammond.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

Unable to access FastApi app that is running as windows service created with pywin32

i have a basic fastapi main.py as following: from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware app = FastAPI() origins = ["*"] app.add_middleware( ...
Jaydeep's user avatar
  • 795
0 votes
0 answers
49 views

Reading & Writing other process's STD handles in python

I am trying to use Pywin32 to get the STD handles of another process, then read and write to them. My source code is: import win32api import win32con import win32file STD_INPUT_HANDLE = -10 ...
user0's user avatar
  • 13
0 votes
1 answer
36 views

Excel Ungrouping data

I am trying to ungroup the data in excel file. I am not aware of row no which have been grouped. When I click on 2 on top of file data gets ungrouped. Is there a way I could do it using python. I ...
Rishi Parpyani's user avatar
0 votes
1 answer
57 views

Why my "try/except" block misses the error?

I've been researching how to make my python code relaunch with admin privileges and was able to find the answer as: import sys import os from win32comext.shell import shell asadmin = 'asadmin' if sys....
Leonard Betts's user avatar
0 votes
0 answers
50 views

Calling Excel Macros in Python

I need help with my python code for the following: In this network path: “\folder\name\endfile.xlsm”, I have a file called "endfilexlsm" Within this file, I have a macro called “...
Sam Smith's user avatar
1 vote
1 answer
44 views
+50

AttributeError: xlColumnClustered

My Python code to generate charts from pywin32 in Excel is: def add_chart1(location, sheet, range1, title, left, right, height, width, charttype): pythoncom.CoInitialize() xl = win32.gencache....
Hello World's user avatar
0 votes
0 answers
7 views

how to obtain a pop-up or system alert when my timer ends in Django

I have a task-timer app, the timer model has an attribute "end" that takes in timefield by generics.createAPIview. I want to add a feature using signals such that, when the timers end time ...
BK Anushree's user avatar
0 votes
0 answers
16 views

Windows exhibit multiple child/sub processes in Task Manager

I have a Python application that I'm running as a service using the pywin32 library. I have multiple Windows 10 servers, each hosting around ten Python services running the same code on different ...
Riyaz J's user avatar
-3 votes
0 answers
34 views

How can I call method in Windows Service using Python

I have monitor service programmed in Python. Which checks status of windows service whether running or Stopped. Working fine. But Some times windows service is not responding. even though service is ...
naresh mesineni's user avatar
3 votes
2 answers
69 views

Appending excel spreadsheet data to file using python

I need help with my python code for the following: In this network path: “\folder\name\endfile.xlsm”, I have a file called "endfilexlsm" Within this file, I have a macro called “...
Sam Smith's user avatar
0 votes
0 answers
41 views

Printing PDF to printer, printer only makes sound but there is no print output

I'm using the win32print API to send a document to a printer. Here is the code: import win32print import win32api import os import time def list_printers(): printers = win32print.EnumPrinters(...
dhrummil's user avatar
0 votes
0 answers
12 views

how copy object in block editor and paste in model space used python pywin32?

def get_block_objects(block_ref): try: block_name = block_ref.Name block_table_record = block_ref.Database.Blocks.Item(block_name) return block_table_record except ...
AG1LE's user avatar
  • 1
0 votes
0 answers
41 views

DLL load failed: The specified module could not be found , win32com.client python library

when I import the win32com.client module i get this error DLL load failed: The specified module could not be found the line producing the error is : \venv\lib\site-packages\win32\lib\pywintypes.py ...
ILyes Haddad's user avatar
0 votes
0 answers
29 views

What does GetClientRec(hwnd) return?

I am confused about the return value of win32gui.GetClientRec(hwnd). It returns the actual pixel positions (scale factor: 100%) instead of the scaled pixel positions (scale factor: 150%) of the window....
chaos light's user avatar
0 votes
0 answers
20 views

pythonservice.exe crash when run a python script as win10 service after upgrade python version from 3.10 to 3.12. Cannot find the reason

I write a python script used to reversely forward a port. I use pywin32 to convert the python codes as a win10 service. The service runs ok when python version is 3.10. However, after I upgrade the ...
wangwei's user avatar
  • 47
0 votes
0 answers
19 views

Extracting Volume from Inventor part files

I'm working on a subprogram of a large project that's fetching parametrical data from 3D files and CAM files for data analytics. I've been trying to walk through a large article database containing 3D ...
Gerben's user avatar
  • 1
-1 votes
1 answer
109 views

Getting Desktop Icon's positions with pywin32 (Python)

I've been trying to get the X and Y of the icons on the desktop screen however none of the solutions I've tried seem to give the desired outcome "Icon: {Name} (X,Y)" or something along those ...
AboveAphid's user avatar
1 vote
0 answers
22 views

How to fix this keystroke script in a hidden window?

I'm trying to make it so that when the program starts, key is pressed in a hidden game window. import win32gui, win32process, win32con, win32api import time # VK vars VK_KEY_W = 0x57 VK_KEY_A = 0x41 ...
Arthur's user avatar
  • 11
1 vote
1 answer
82 views

How to get a windows keyboard layout "description"

I am currently making a Windows app with Python, and it needs to get all installed system layouts: I've already got the basic thing working using the Win32 APIs GetKeyboardLayoutList and ...
Surge's user avatar
  • 19
1 vote
1 answer
40 views

win32gui keys getting stuck when sending to minecraft

I am using win32gui to try and send key inputs to my minecraft window, to move my character even while the game is minimized / unfocused. It's supposed to send W for 1 second, release it, then do the ...
Makatina's user avatar
2 votes
0 answers
50 views

How can I simulate that I'm pressing two keys at the same time? (win32gui)

I'm trying to simulate that I'm pressing two keys at the same time in a program that is not focused, that is not active, that is minimized. I tried running the following code snippet: def ...
Marckson Assis's user avatar
1 vote
1 answer
113 views

I can't install pywin32

I'm trying to get this program to run: https://github.com/GavriloviciEduard/ShinyHunter But I get this error message: C:\Users\marku\ShinyHunter>python -m poetry install Installing dependencies ...
MarkuzZz's user avatar
0 votes
0 answers
31 views

Is there a way to retreive only specific event id and source from events rather than retriving all events?

I am able to retrieve all the events and filter them to retrieve the specific Id along with source. But instead of retrieving all of them, i want to retrieve only the events which i have given as ...
EmptyBrain's user avatar
0 votes
0 answers
56 views

Different behaviour between win 10 and win 11 of a python script

The following code works differetly between two PC with identical PY version 3.11.9, identical libraries installed and identical source folder files. The aim is to open every single excel file in a ...
Wolowizard's user avatar
0 votes
0 answers
85 views

How to simulate mouse drag by win32api.SendMessage in Python?

I try to simulate mouse drag operation by win32api.SendMessage in Python, here is my code: import win32api ... lParam_start = win32api.MAKELONG(start[0], start[1]) lParam_end = win32api.MAKELONG(end[0]...
Soc. mc's user avatar
  • 11
1 vote
0 answers
42 views

Unable to detect mouse movement with pynput mouse listener when run as a service

I am trying to create a windows service using python that monitors mouse movement and keyboard presses. The code works fine when ran in the console however when I modified it to turn it into a service,...
Maimun Ahmed's user avatar
0 votes
1 answer
47 views

SetClipboardData can't write any data

I am trying to write HTML to the clipboard as rich text, but it doesn't work. What did I do wrong? I tried running html_to_clipboard separately, but the clipboard is empty. SetClipboardData does not ...
END SKY's user avatar
0 votes
1 answer
40 views

Pywin32: Do SetWindowDisplayAffinity is not avaliable?

I am looking to implement windows api with python pywin32 then I want to hide a screenshot application. I have seen other options like using C/C++ language but I don't know, what do you recommend? ...
Eliezer Reuven Ramirez Ruiz's user avatar
0 votes
0 answers
8 views

EnsureDispatch("PowerPoint.Application") does not generate msoShapeXxxxxxx constants

According to documentation, if you use win32com Python Library as follow import win32com.client as win32 and use the following instructions # Start PowerPoint and generate constants PowerPointApp = ...
Dario de Judicibus's user avatar
0 votes
0 answers
48 views

Not being able to access SharePoint List with Python

I'm attempting to automate some queries using Python, but I'm encountering difficulties connecting to and extracting data from a SharePoint List (which is what my organization uses). The simplest ...
Hermaeus's user avatar
0 votes
2 answers
93 views

How to solve com_error: (-2147221008, 'CoInitialize has not been called.', None, None) for multithreaded excel application?

I have a worker thread for a PYQT5 application that feeds into a progress bar when the function is called. The issue is that I am getting a com_error: (-2147221008, 'CoInitialize has not been called.',...
Raph Car's user avatar
0 votes
0 answers
26 views

Getting error: RPC server unavailable while trying to read outlook email through Python

I am getting the error as (-2147023174, 'The RPC server is unavailable.', None, None) I am trying the below code: import win32com.client import os from datetime import datetime, timedelta outputDir = '...
Ananthu Sreedhar's user avatar
0 votes
0 answers
17 views

pywintypes.com_error when running python code as Inventor API

def createEndOrCoffeeTable(length, width, height, legType, color): import win32com.client as wc inv = wc.GetActiveObject('Inventor.Application') doc = inv.Documents.Add(12290, inv....
Maxmilian's user avatar
0 votes
1 answer
40 views

How to print pdfs with the printer property "staple" in python using adobe acrobat

currently I'm trying to automate a few things in my workspace to make things easier. We're receiving a lot of invoices trough our email and I wanted to print and save the pdf into a certain location. ...
Nico Xenox's user avatar
0 votes
0 answers
19 views

pywin32 module was not found

pywin32 was not able use in python; python version 3.12 pywin32 module version 306 I don't know the reason to solve the error. pywin32 module not found. I correctly set the path but doesn't work. I ...
HEMACHANDRAN 004's user avatar
0 votes
0 answers
41 views

CopyPicture method of Range class failed - Python

I am running into the following error in Python pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', 'CopyPicture method of Range class failed', 'xlmain11.chm', 0, -...
fiona van der steur's user avatar
0 votes
1 answer
78 views

openpyxl vs pywin32 vs others libraries: copy and paste the value of cells containing the =IMAGE() in Excel

I'm trying to copy and paste the values of cells containing the formula =IMAGE(Url) in Excel. The result is an image embedded in the cell and no longer linked to the Url. I am able to do it with ...
lexignot's user avatar
0 votes
0 answers
15 views

Pywin32 open Excel file take too mush time

I have a Excel file that receiver stock market data streaming real-time from excel add-in .xll my excel file also using that data and calculate on them if i open it manually by excel app in window it ...
khang khang's user avatar
0 votes
0 answers
25 views

xlsx to pdf using pywin32 unable to save pdf

I am trying to save an excel sheet by opening the file in excel with the pywin32 package. The file will open, however it crashes when trying to save as a pdf. My hunch is it is a printer issue of some ...
DJ-MT's user avatar
  • 1
0 votes
0 answers
29 views

Airflow DAG that runs a Windows process

I would like to set up an automation pipeline that involves programmatically using a Windows application. Unfortunately, there is no way around using the Windows application as there are no other ...
kayoz's user avatar
  • 1,124
1 vote
0 answers
59 views

Python: determine whether the microphone is turned on in Windows

How can I use python to find out if the microphone is on on a Windows system? All I found was a single question Python check if microphone input is muted to which there is simply no answer! All I have ...
OKwy's user avatar
  • 84
2 votes
1 answer
74 views

Is there a way to see if an excel workbook contains shapes using either openpxyl or by looking at the underlying XML?

I have thousands of excel workbooks and need to create a list of which ones contain shapes that might have text (ie a text box). How would I use either openpyxl or the underlying XML to generate a ...
Hooded 0ne's user avatar
1 vote
1 answer
91 views

Detect vid and pid of a keyboard using python

I'm new to python but I will try my best to explain what's happening. So i want to write a python script which detects VID,PID and NAME of a keyboard and mouse using pywin32. I already wrote a script ...
Ahmad Irfan's user avatar
0 votes
1 answer
98 views

How to import win32api from pywin32 when running pythonnet in a c#/.NET environment?

I am working on integrating Python with a C#/.NET runtime using pythonnet, but I keep encountering a module import error with win32api. The error message is "No module named 'win32api'." I ...
thalm's user avatar
  • 2,888
0 votes
0 answers
51 views

Python COM connection issue when using win32 for Excel and Outlook

I am trying to take a screenshot of an excel sheet that contains real-time data and put it into an email to send out. When I have the excel sheet closed that program runs fine however when I have the ...
probslater's user avatar
0 votes
1 answer
65 views

How to change the font of added text in pyautocad or win32com?

This code adds MTEXT text elements to an autocad drawing. I need the font of this text to be Arial: for coordinates in gold_marker_coords: x, y, z, text_value = coordinates m_text = ms....
Bobby Lith's user avatar
0 votes
0 answers
34 views

How to add AppendInnerLoop method to Autocad using Python?

Inputs: layers_points = https://pastebin.com/raw/YHmSSLp8 all_cycles = https://pastebin.com/raw/bXFqyqaR The task is to create cycles on coordinates from all_cycles and add hatches on them. My code ...
Bobby Lith's user avatar
0 votes
0 answers
28 views

Access is denied with win32security though running with administrative privileges

This is a sample project I am working on, it is in it beginning stages but I keep getting Access is denied even though I am running the program with administrative privileges. I am on windows 11. ...
Richmond koomson's user avatar
0 votes
1 answer
57 views

How to copy and paste an autocad table using python

I am trying to use pyautocad to copy a table from one autocad drawing and paste it in another. Its important that I retain the same table style and location as well. Afterwards the script populates ...
Mason Keresty's user avatar
0 votes
1 answer
278 views

How do I fix an error while trying to send email using Outlook with COM?

I'm new to the world of programming, I've been following tutorials and recently I have a project to send a report by email but it gives an error, the error follows: Traceback (most recent call last): ...
Bruno Martins's user avatar

1
2 3 4 5
42