4

I have a Django application using django-mssql to communicate w/ SQL Server.

This works just fine in the dev server (runserver) but under Apache/mod-wsgi, I get a error related to it trying to find a .dll which does exist:

Exception Type: ImportError
Exception Value:    No system module 'pywintypes' (pywintypes27.dll)
Exception Location: C:\Python27\lib\site-packages\win32\lib\pywintypes.py in __import_pywin32_system_module__, line 98
Python Executable:  C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe

I used ActivePython2.7.2, mod_wsgi, pywin32 Build 216 and Django1.3.1, all of 32 bits

pywintypes27.dll exists in C:\Windows\SysWOW64 instead of C:\Windows\System32 as expected in my 64 bit windows 7

Thanks in advance

This is the same question as django-mssql not working in Apache w/ mod-wsgi, but works fine in dev server but that answer didn't help me cause I have installed 32 bits pywin32, I am new to stackoverflow and hope it is right to ask as a new question rather than hijack people's thread.

Community
  • 1
  • 1
Terry
  • 533
  • 7
  • 17

3 Answers3

17

Move files:

  • pythoncom27.dll
  • pythoncomloader27.dll
  • pywintypes27.dll

from "C:\Python27\Lib\site-packages\pywin32_system32"

to

"C:\Python27"

Hope it helps.

Deep LF
  • 199
  • 1
  • 12
Terry
  • 533
  • 7
  • 17
  • 3
    Which suggests you didn't install Python for all users when you installed it. There is a checkbox on the installer or in batch install config file if doing it that way. – Graham Dumpleton Oct 14 '11 at 21:58
  • Thanks for it! I will make sure I install it for all users next time. – Terry Oct 17 '11 at 14:00
0

Install pywin32-218.win32-py2.7.exe in machines of 32 or 64 bits.

Deep LF
  • 199
  • 1
  • 12
tonyprr
  • 139
  • 1
  • 3
0

For those who installed pywin32 via pip : check that you have done it outside a virtualenv.

If you've done it inside virtualenv, we can get this kind of error.

Prefer binarie installation : See Mark Amery response here

HamzDiou
  • 588
  • 9
  • 15