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
350
votes
26 answers

How do I watch a file for changes?

I have a log file being written by another process which I want to watch for changes. Each time a change occurs I'd like to read the new data in to do some processing on it. What's the best way to do this? I was hoping there'd be some sort of hook…
Jon Cage
  • 33,172
  • 32
  • 120
  • 206
67
votes
3 answers

Why can't I find any pywin32 documentation/resources

I cannot find pywin32 documentation or even a little synopsis of what the module is (I am aware its for win32 API stuff). Is there any pywin32 documentation or resources? Maybe some examples?
in70x
  • 1,078
  • 1
  • 10
  • 16
57
votes
11 answers

import win32api error in Python 2.6

When running python26 under windows OS (64bits)..... I have got errors like: import win32api" error in Python 2.6: pywintypes26.dll or pythoncom26.dll missing ImportError: DLL load failed: The specified module could not be found. I have done the…
Vin.X
  • 4,595
  • 3
  • 26
  • 35
49
votes
5 answers

How to install pywin32 module in windows 7

I am trying to install pywin32. I downloaded it from sourceforge.net. When I run setup.py install it shows "Unable to find vcvarsall.bat". I Googled about it and found that I have to install MinGW and set path then run python setup.py build…
narayanpatra
  • 5,427
  • 13
  • 45
  • 59
42
votes
10 answers

Symlinks on windows?

Does anyone know of a way to make/read symbolic links across versions of win32 from Python? Ideally there should be a minimum amount of platform specific code, as I need my app to be cross platform.
Harkonnen Jama
39
votes
4 answers

What can you do with COM/ActiveX in Python?

I've read that it is possible to automate monthly reports in Crystal Reports with COM/ActiveX. I'm not that advanced to understand what this is or what you can even do with it. I also do a lot of work with Excel and it looks like you also use…
mandroid
  • 2,189
  • 5
  • 23
  • 35
36
votes
1 answer

Error "ValueError: can't format dates this early" on one PC, works on other

I have a Python script that works perfectly fine on my development PC. Both are Windows 7 with the same Python version (2.7.9). However on the target machine I get a ValueError: can't format dates this early The error seems to come from pywin32…
beginner_
  • 6,371
  • 18
  • 60
  • 112
30
votes
13 answers

How to fix "ImportError: DLL load failed" while importing win32api

I'm setting up an autoclicker in Python 3.8 and I need win32api for GetAsyncKeyState but it always gives me this error: >>> import win32api Traceback (most recent call last): File "", line 1, in ImportError: DLL load failed while…
Glxce
  • 311
  • 1
  • 3
  • 5
28
votes
5 answers

Is there a way to decode numerical COM error-codes in pywin32

Here is part of a stack-trace from a recent run of an unreliable application written in Python which controls another application written in Excel: pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146788248),…
Salim Fadhley
  • 18,674
  • 18
  • 72
  • 100
25
votes
4 answers

Connect to Exchange mailbox with Python

I need to connect to an Exchange mailbox in a Python script, without using any profile setup on the local machine (including using Outlook). If I use win32com to create a MAPI.Session I could logon (with the Logon() method) with an existing…
Tony Meyer
  • 9,361
  • 5
  • 38
  • 47
25
votes
5 answers

How to check if OS is Vista in Python?

How, in the simplest possible way, distinguish between Windows XP and Windows Vista, using Python and pywin32 or wxPython? Essentially, I need a function that called will return True iff current OS is Vista: >>> isWindowsVista() True
DzinX
  • 47,309
  • 9
  • 57
  • 78
23
votes
6 answers

Common ways to connect to odbc from python on windows?

What library should I use to connect to odbc from python on windows? Is there a good alternative for pywin32 when it comes to odbc? I'm looking for something well-documented, robust, actively maintained, etc. pyodbc looks good -- are there any…
user89021
  • 13,714
  • 14
  • 51
  • 65
23
votes
1 answer

ctypes: construct pointer from arbitrary integer

For low-level purposes, I need to construct a ctypes pointer from an arbitrary address, given as an integer. For instance: INTP = ctypes.POINTER(ctypes.c_int) p = INTP(0x12345678) # i *know* this is the address But all such attempts result in…
sebulba
  • 1,075
  • 2
  • 7
  • 17
22
votes
1 answer

Install pywin32 with pip in Windows 7 does not work in python 3.4.2

Hy@everybody, i've try to install pywin32 via pip (1.5.6) with python 3.4.2 under Windows 7, but i've always got the follwing error-message: Could not find any downloads that satisfy the requirement pywin32 Some externally hosted files were ignored…
tonka
  • 3,590
  • 3
  • 19
  • 28
22
votes
1 answer

How do I get started with PyWin32

I am looking for good resources to get started with pywin32. I haven’t found much in the way of tutorials, books or blogs that talk about it. I’d like to be able to use python to automate some of my common repetitive Microsoft Excel and Word Tasks…
B-Rell
  • 630
  • 3
  • 7
  • 15
1
2 3
99 100