22

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?

1
  • 2
    If you're on a Mac or Linux OS, use 'django-pyodbc' because django-mssql doesn't work Commented Dec 1, 2014 at 19:52

5 Answers 5

42

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 
Sign up to request clarification or add additional context in comments.

5 Comments

Let me try the ActivePython installation and will keep you posted, thnx
Installing ActivePython solved the hassle of installing other packages, it came with pretty much everything. Thnx once again
I think I just download Pywin32 from sourceforge.net/projects/pywin32/files/pywin32. It works with the official Python distribution
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?
That package is for Windows only. It uses Windows API and cannot be used on Mac.
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.

4 Comments

And since installing pywin32 can give you headaches, try pip install pypiwin32
@CristiFati Perhaps don't attempt to remonstrate people for fourteen-year-old answers. Just a suggestion.
@BinaryPhile: I'm not attempting to remonstrate anyone. I just happened to see a (currently) bad advice in a (upvoted) comment (that may have done the trick at some point), and I want that people unfamiliar with these packages to be aware of that (the reasons listed in my answer). As you can see there's also an answer from 2020 with the same instructions.
5

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.

1 Comment

This is irrelevant answer. At best it could be a comment to another answer. not an answer on its own.
1

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

Comments

0
$ pip3 install pypiwin32 

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

1 Comment

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.