Questions tagged [pywin32]

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

Python for Windows Extension (PyWin32) is a close wrapper around Microsoft Windows API. It is so close that you can actually read MSDN documentation and almost directly translate their examples into Python. PyWin32 is actively developed and is supported in Python 2.x and 3.x.

Latest official build can be downloaded here: https://sourceforge.net/projects/pywin32/files/pywin32/

You can get support by joining their mailing list here: http://mail.python.org/mailman/listinfo/python-win32. ActiveState maintains a good copy of PyWin32's documentation: http://docs.activestate.com/activepython/2.7/pywin32/win32_modules.html

Tim Golden has written several add-on packages for this project, such as WMI, winshell and WinSys. These may be browsed here: http://timgolden.me.uk/python/ He also has many tutorials on his website for PyWin32 and his own packages that are well worth the time to learn.

1590 questions
14
votes
4 answers

Using PythonService.exe to host python service while using virtualenv

I've got a Windows 7 environment where I need to develop a Python Windows Service using Python 3.4. I'm using pywin32's win32service module to setup the service and most of the hooks seem to be working ok. The problem is when I attempt to run the…
David K. Hess
  • 14,018
  • 2
  • 42
  • 63
14
votes
6 answers

GetWindowRect too small on Windows 7

The actual problem I'm trying to solve is, I want to automatically find out the size of the margins around windows. If you can find a better way, please by all means answer that instead of this. To do this I decided to take a screenshot of a test…
Devin Jeanpierre
  • 80,391
  • 4
  • 53
  • 78
13
votes
3 answers

Programmatically find the installed version of pywin32

Some Python packages provide a way for a program to get the installed version. E.g. >>> import numpy >>> numpy.version.version '1.5.0' But I can't find a way to do so for pywin32. What good way might there be to find out?
Craig McQueen
  • 37,399
  • 27
  • 113
  • 172
13
votes
3 answers

SMTP through Exchange using Integrated Windows Authentication (NTLM) using Python

I want to use the credentials of the logged-in Windows user to authenticate an SMTP connection to an Exchange server using NTLM. I'm aware of the python-ntlm module and the two patches that enable NTLM authentication for SMTP, however I want to use…
Louis
  • 503
  • 1
  • 3
  • 9
13
votes
3 answers

Get memory usage of computer in Windows with Python

How can I tell what the computer's overall memory usage is from Python, running on Windows XP?
Claudiu
  • 206,738
  • 150
  • 445
  • 651
12
votes
2 answers

How to enable tab and arrow keys using python win32gui

I've created several buttons (windows) in a main window, but tab and arrow keys are not working. My research revealed that for C++, the use of IsDialogMessage in the message pump creates a bypass of TranslateMessage/DispatchMessage as follows to…
mjpsr11
  • 467
  • 9
  • 21
12
votes
3 answers

win32com import error python 3.4

I just installed python 3.4 64bit and tried to install win32com. I have downloaded pywin32-218.win-amd64-py3.4.exe and ran it without any problem. pip freeze reports pywin32==218. However, when I try to import win32com.client I get following…
foosion
  • 6,807
  • 23
  • 58
  • 97
12
votes
1 answer

Python Screenshot of inactive window PrintWindow + win32gui

After hours of googling I managed to "write" this: import win32gui from ctypes import windll hwnd = win32gui.FindWindow(None, 'Steam') hdc = win32gui.GetDC(hwnd) hdcMem = win32gui.CreateCompatibleDC(hdc) hbitmap = win32ui.CreateBitmap() hbitmap =…
Maksim
  • 177
  • 1
  • 2
  • 11
12
votes
1 answer

How to catch printer event in python

I want to catch the signal when the printer started to print. That would be fine if you tell me how to get the path of document that will print. pywin32print looks like useful but I don't know how to use.
frukoprof
  • 255
  • 2
  • 9
12
votes
5 answers

os.path.islink on windows with python

On Windows 7 with Python 2.7 how can I detect if a path is a symbolic link? This does not work os.path.islink(), it says it returns false if false or not supported and the path I'm providing is definitely a symbolic link so I'm assuming it's not…
user391986
  • 24,692
  • 37
  • 113
  • 191
11
votes
2 answers

"Not implemented" Exception when using pywin32 to control Adobe Acrobat

I have written a script in python using pywin32 to save pdf files to text that up until recently was working fine. I use similar methods in Excel. The code is below: def __pdf2Txt(self, pdf, fileformat="com.adobe.acrobat.accesstext"): …
Blish
  • 113
  • 1
  • 5
11
votes
4 answers

How to install pywin32 in virtualenv with python 2.7 64 bit?

I wonder right way to install on virtualenv with 64 bit python 2.7 pywin32 module (Operating system is Windows 7 64 bit). I've found exe installer on Sourceforge. When i run easy_installer on command line first everything goes fine but soon i see…
tony
  • 1,406
  • 2
  • 21
  • 27
11
votes
3 answers

Error while working with excel using python

while my script is updating one excel same time if i am going to do any other work manually with another excel error occurs i am using dispatch from win32com.client import Dispatch excel = Dispatch('Excel.Application') excel.Visible …
sagar
  • 1,139
  • 4
  • 19
  • 38
11
votes
2 answers

Get data via DDE in Python by bypassing Excel

I have a data provider who provides a DDE link (that I can use in Excel) and an exe file that runs in the background which serves as a Data Manager (not sure if this is what called as a DDE Server) and the DDE link connects to that exe file. I want…
uday
  • 5,583
  • 8
  • 49
  • 86
11
votes
2 answers

Creating a python win32 service

I am currently trying to create a win32 service using pywin32. My main point of reference has been this tutorial: http://code.activestate.com/recipes/551780/ What i don't understand is the initialization process, since the Daemon is never…
UberJumper
  • 17,305
  • 17
  • 62
  • 86