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.

1996 questions
17
votes
7 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
  • 16,632
  • 2
  • 49
  • 73
16
votes
3 answers

Python Flask as Windows Service

I am trying to get a Flask app to run as a Service in Windows. I have already tried to implement a solution as suggested here and here without success. I have a simple folder with just two files: Project | +-- myapp.py +--…
drec4s
  • 7,946
  • 8
  • 33
  • 54
15
votes
4 answers

How to retrieve the selected text from the active window

I am trying to create a simple open source utility for windows using Python that can perform user-defined actions on the selected text of the currently active window. The utility should be activated using a pre-defined keyboard shortcut. Usage is…
George Notaras
  • 151
  • 1
  • 1
  • 5
14
votes
1 answer

What is the difference between pywin32 and pypiwin32?

I am trying to automate Microsoft Office applications and after some Googling, I came across pypiwin32 and pywin32 to interact with Windows Component Objects. My question is, what's the difference between the two libraries? I have tried Googling…
Jie Jenn
  • 445
  • 5
  • 15
14
votes
4 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,375
  • 5
  • 20
  • 38
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
  • 92,913
  • 4
  • 55
  • 79
13
votes
1 answer

How to exit cleanly from Flask and 'waitress' running as a Windows pywin32 service

I have managed to cobble together a working demo of a pywin32 Windows service running Flask inside the Pylons waitress WSGI server (below). A niece self contained solution is the idea... I have spent hours reviewing and testing ways of making…
Alias_Knagg
  • 886
  • 1
  • 7
  • 21
13
votes
4 answers

Python win32 service starting automatically

I am writing a python win32 service below are snippet of my code when i compile the service it works but i need to go to services.msc and start it manually. Is there an option when i install the serivce by : myservice.exe install it will starts…
AKM
  • 6,285
  • 9
  • 31
  • 34
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
  • 41,871
  • 30
  • 130
  • 181
13
votes
9 answers

python: convert pywintyptes.datetime to datetime.datetime

I am using pywin32 to read/write to an Excel file. I have some dates in Excel, stored in format yyyy-mm-dd hh:mm:ss. I would like to import those into Python as datetime.datetime objects. Here is the line of code I started with: prior_datetime =…
Nathaniel Givens
  • 411
  • 1
  • 3
  • 15
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
  • 523
  • 1
  • 4
  • 9
13
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
  • 6,453
  • 13
  • 56
  • 94
13
votes
1 answer

What exactly does win32com.client.Dispatch("WScript.Shell")?

I was searching for a Python piece of code which would simulate keystrokes. I stumble upon something using win32com.client.Dispatch("WScript.Shell"). I am not fan (at all) of Windows but it is to help a friend with automation of a game. I got a…
petosorus
  • 133
  • 1
  • 1
  • 6
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
  • 224,032
  • 165
  • 485
  • 680
13
votes
2 answers

Use Python to Write VBA Script?

This might be a bit of a stretch, but is there a possibility that a python script can be used to create VBA in MS Excel (or any other MS Office product that uses VBA) using pythonwin or any other module. Where this idea came from was pythons…
Mike
  • 4,099
  • 17
  • 61
  • 83