54

I'm building an open source project that uses python and c++ in Windows. I came to the following error message:

 ImportError: No module named win32con 

The same happened in a "prebuilt" code that it's working ( except in my computer :P )

I think this is kind of "popular" module in python because I've saw several messages in other forums but none that could help me.

I have Python2.6, should I have that module already installed? Is that something of VC++?

Thank you for the help.

I got this url http://sourceforge.net/projects/pywin32/ but I'm not sure what to do with the executable :S

OscarRyz
  • 196,001
  • 113
  • 385
  • 569
  • See the [Python Programming On Win32](http://oreilly.com/catalog/9781565926219/) for details on this package. – S.Lott Oct 22 '08 at 23:46

7 Answers7

55
pip install pypiwin32

Glyph had packed packed it until somebody sends patch to build wheels as part of pywin32 build process to close https://sourceforge.net/p/pywin32/bugs/680/

anatoly techtonik
  • 19,847
  • 9
  • 124
  • 140
  • 4
    When I try to run this I get the following error: " Could not find a version that satisfies the requirement pywin32>=223 (from pypiwin32) (from versions: ) No matching distribution found for pywin32>=223 (from pypiwin32)" - I'm running Python 2.7.10, do you know what might be the problem? – MACC Jun 19 '18 at 06:37
  • @MACC no idea. Perhaps your connection is down or your system is not Windows. Because `pywin32==223` is there - https://pypi.org/project/pywin32/#files – anatoly techtonik Jun 19 '18 at 12:37
  • 1
    **WARNING:** [“Pypiwin32 is an old and outdated repackaging of pywin32 from its creator to use wheels. It is abandoned for a long time. You should just use pywin32.”](https://stackoverflow.com/a/55918399/4877269) – Alex Peters Jun 26 '21 at 02:15
24

This module contains constants related to Win32 programming. It is not part of the Python 2.6 release, but should be part of the download of the pywin32 project.

Edit: I imagine that the executable is an installation program, though the last time I downloaded pywin32 it was just a zip file.

Curt Hagenlocher
  • 20,680
  • 8
  • 60
  • 50
11

If you have pywin32 installed you can do in python 3.7+

import win32.lib.win32con as win32con
Thomas Ducrot
  • 2,841
  • 1
  • 16
  • 14
8

Ok I stumbled here twice for installs on two machines so here is a quick link for that ressource

http://sourceforge.net/projects/pywin32/files/pywin32/

This is the actual download page of the project and now a readme download

Eric
  • 19,525
  • 19
  • 84
  • 147
2

Note that the Pywin32 download page contains installers for version 2.6 (i386 and AMD64). The ActiveState distribution is a single installer that includes pywin32 - currently at version 2.5.2.

gimel
  • 83,368
  • 10
  • 76
  • 104
1

The PyWin32 download references including project references are found in the pypi registry.

Jerome Anthony
  • 7,823
  • 2
  • 40
  • 31
-1

navigate to: C:\Python27\Lib\site-packages\win32\lib and copy the win32con.py file into your project directory.