pythondjangopython-2.7django-mssql

"no module named pythoncom"


I am trying to build a test Django application and I want to connect to a MSSQL server. When I tried running my program I get an error ImportError: No module named pythoncom. So I figured it's a missing module so I downloaded pywin32(32bit) for python 2.7 and installed it(Successfully). The problem is that error still appears and I can't seem to get rid of it. I've tried everything from running the install as admin to ActivePtyhon(freezes at determining disk space..)

This is the original Exception message:

    self.ensure_connection()
  File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan
kProject\BlankProject\env\lib\site-packages\django\db\backends\__init__.py", lin
e 133, in ensure_connection
    self.connect()
  File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan
kProject\BlankProject\env\lib\site-packages\django\db\backends\__init__.py", lin
e 122, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan
kProject\BlankProject\env\lib\site-packages\sqlserver_ado\base.py", line 244, in
 get_new_connection
    conn = Database.connect(**conn_params)
  File "C:\Users\pce-coop\Desktop\Test Power Monitoring App\Test Django App\Blan
kProject\BlankProject\env\lib\site-packages\sqlserver_ado\dbapi.py", line 171, i
n connect
    import pythoncom
ImportError: No module named pythoncom

Solution

  • used easy_install in my virtual environment and instead of entering the command, I used the path name to the pywin32.exe. In my case it was "C:\Users\PC\Downloads\pywin32-219.win32-py2.7.exe"