21

I am a newbie (just 1 week) to this Python world. I tried installing django-mssql, but when I tried to import the library (using import sqlserver_ado.dbapi), I got this error message:

ImportError: No module named pythoncom

I tried to look for that library without success.

Can you guys point me in the right direction?

Perception
  • 79,279
  • 19
  • 185
  • 195
Quaspam
  • 263
  • 1
  • 3
  • 6
  • 2
    If you're on a Mac or Linux OS, use 'django-pyodbc' because django-mssql doesn't work – Will Dec 01 '14 at 19:52

5 Answers5

41

You are missing the pythoncom package. It comes with ActivePython but you can get it separately on GitHub (previously on SourceForge) as part of pywin32.

You can also simply use:

pip install pywin32
kichik
  • 33,220
  • 7
  • 94
  • 114
  • Let me try the ActivePython installation and will keep you posted, thnx – Quaspam Nov 10 '10 at 14:39
  • 1
    Installing ActivePython solved the hassle of installing other packages, it came with pretty much everything. Thnx once again – Quaspam Nov 12 '10 at 07:01
  • I think I just download Pywin32 from http://sourceforge.net/projects/pywin32/files/pywin32/. It works with the official Python distribution – swdev Apr 15 '14 at 01:08
  • 1
    I'm having this error on OSX Mavericks. But I can't seem to be able to install pythoncom on mavericks. What should I do? – AllTradesJack Nov 03 '14 at 18:21
  • 5
    That package is for Windows only. It uses Windows API and cannot be used on Mac. – kichik Nov 03 '14 at 18:22
15

If you're on windows you probably want the pywin32 library, which includes pythoncom and a whole lot of other stuff that is pretty standard.

Tobias Kienzler
  • 25,759
  • 22
  • 127
  • 221
Binary Phile
  • 2,538
  • 16
  • 16
6

You should be using pip to install packages, since it gives you uninstall capabilities.

Also, look into virtualenv. It works well with pip and gives you a sandbox so you can explore new stuff without accidentally hosing your system-wide install.

Hank Gay
  • 70,339
  • 36
  • 160
  • 222
1
$ pip3 install pypiwin32

Sometimes using pip3 also works if just pip by itself is not working.

sscswapnil
  • 639
  • 6
  • 6
1

Just go to cmd and install pip install pywin32 pythoncom is part of pywin32 for API window extension....

Dharman
  • 30,962
  • 25
  • 85
  • 135