I recently discussed some problems I had had in getting PyODBC working with Django and Django-pyodbc, but at the time it was decided to switch to an ASP.NET solution instead. For various reasons, we are trying once again to set up Django and PyODBC, and while we've had some success, another set of problems has arisen. At this time, running manage.py syncdb in the relevant directory results in the following traceback:

Traceback (most recent call last):
  File "C:\Python26\Lib\site-packages\AllProBugProWeb\proj\manage.py", line 11,
in <module>
    import settings
  File "C:\Python26\Lib\site-packages\AllProBugProWeb\proj\settings.py", line 3,
 in <module>
    import pyodbc
  File "build\bdist.win32\egg\pyodbc.py", line 7, in <module>
  File "build\bdist.win32\egg\pyodbc.py", line 6, in __bootstrap__
ImportError: DLL load failed: The specified procedure could not be found.

When trying to access the website, a different ImportError is raised, one which I suspect is a different problem (perhaps a misconfiguration of some sort on my part) but may still be relevant in tracking down the first issue:

Internal Server Error
An error occurred processing this request.

--------------------------------------------------------------------------------

Request handler failed

Traceback (most recent call last):
  File "C:\Python26\Lib\site-packages\AllProBugProWeb\Http\Isapi.py", line 67, in Request
    return RunWSGI(Handler, Base=Base)
  File "C:\Python26\Lib\site-packages\AllProBugProWeb\Http\WSGI.py", line 155, in RunWSGI
    Result = Application(Environ, StartResponse)
  File "c:\Python26\Lib\site-packages\django\core\handlers\wsgi.py", line 250, in __call__
    self.load_middleware()
  File "c:\Python26\Lib\site-packages\django\core\handlers\base.py", line 39, in load_middleware
    for middleware_path in settings.MIDDLEWARE_CLASSES:
  File "c:\Python26\Lib\site-packages\django\utils\functional.py", line 276, in __getattr__
    self._setup()
  File "c:\Python26\Lib\site-packages\django\conf\__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "c:\Python26\Lib\site-packages\django\conf\__init__.py", line 89, in __init__
    raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'proj.settings' (Is it on sys.path?): DLL load failed: The specified procedure could not be found.



Additional Information

--------------------------------------------------------------------------------


-- Module Search Path --

C:\Python26\Lib\site-packages\AllProBugProWeb
c:\Python26\Lib\site-packages\pyodbc-2.1.8-py2.6-win32.egg
C:\Python26\lib\site-packages\django_mssql-1.0.0.dev_unknown-py2.6.egg
C:\Python26\lib\site-packages\pymssql-1.9.909_dev-py2.6-win32.egg
C:\Python26\lib\site-packages\ipython-0.10.2-py2.6.egg
C:\Python26\lib\site-packages\nose-1.0.0-py2.6.egg
c:\Python26
c:\Python26\bin
c:\Python26\Lib\site-packages
c:\django-pyodbc
c:\pywin32
C:\Python26\Lib\site-packages\pywin32_system32
c:\pywin32\win32
c:\pywin32\win32\lib
c:\pywin32\Pythonwin
C:\Windows\system32\python26.zip
C:\Python26\Lib
C:\Python26\DLLs
C:\Python26\Lib\lib-tk
c:\windows\system32\inetsrv
C:\Python26\lib\site-packages\win32
C:\Python26\lib\site-packages\win32\lib
C:\Python26\lib\site-packages\Pythonwin
c:\Python26\bin
c:\Python26\Lib\site-packages\AllProBugProWeb


-- Other Path Info --

Current Directory = 'C:\Python26\Lib\site-packages\AllProBugProWeb'
Python Home       = '<Auto>'
sys.executable    = 'C:\Python26\Lib\site-packages\AllProBugProWeb\PyISAPIe.dll'
sys.exec_prefix   = 'C:\Python26'
sys.prefix        = 'C:\Python26'

I included the path data following the traceback because it may be relevant in tracking the problem down. The dev system is a Win7 32-bit virtual machine running in VirtualBox; the underlying parent systems vary (hence the use of the relatively consistent and easily duplicated VM image). The target database is MS SQL Server Express 2008 R2, and the PyODBC and Django-PyODBC libraries were compiled from sources with MinGW32 (gcc 4.4.1as the compiler). The Python interpreter is the standard CPython 2.6 downloaded directly from python.org and installed automatically.

Recommended Answers

All 2 Replies

You compiled the Python with same compiler? Compilers of Python and other parts should e same. Standard Python is compiled with Microsoft visual c++ 2008.

Ah, no, I did not; I wasn't aware that this was an issue, nor did I know which compiler was used for Python. I'll download the Python sources and try compiling it with MinGW to see if that has any effect.

On a side note, I have cross-posted this to the PyODBC Google Group (http://groups.google.com/group/pyodbc?hl=en), as that list is more specific to the topic at hand; had I thought to, I would have posted there to begin with, simply because they are the experts on the specific subject. I did make a point of mentioning this there as well, but I still would like to apologize about the cross-post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.