Menu

ImportError _mssql missing

stoyan
2009-09-10
2013-04-29
  • stoyan

    stoyan - 2009-09-10

    hello
    i installed latest package on WindowsXP, but get this error when trying to import pymssql:

    >>> import pymssql
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "d:\programs\python26\lib\site-packages\pymssql.py", line 30, in <module>

        import _mssql, types, string, time, datetime, warnings
    ImportError: DLL load failed: The specified module could not be found.

    could anyone help?
    10x!

     
  • vzingertal

    vzingertal - 2009-09-23

    I got exactly the same problem.  I can guees why :  _mssql has an extention **.pyd**
    I have no idea what that is, but when Python is trying to import modules, it's looking for **.py** files with source code in them.
    I've sent an email to the person who maintains this project

     
  • kwas

    kwas - 2010-01-25

    I have a same problem on Vista. I have activepython distribution installed manually, without using windows installer. So, when I run installer for the pymssql, it just can't find python.  I decide to use easy_install for installation and run following command (assuming you have easy_install.exe in your PATH and pymssql installation package in your current directory ):

    D:\Downloads\>easy_install pymssql-1.0.2.win32-py2.6.exe
    Processing pymssql-1.0.2.win32-py2.6.exe
    WARNING: can't process DATA/LIB/site-packages/ntwdblib.dll
    creating 'c:\users\...\appdata\local\temp\easy_install-9lqwha\pymssql-1.0.2-py2.6-win32.egg' and adding 'c:\users\...\appdata\local\temp\easy_install-9lqwha\pymssql-1.0.
    2-py2.6-win32.egg.tmp' to it
    Moving pymssql-1.0.2-py2.6-win32.egg to d:\apps\python26\lib\site-packages
    Adding pymssql 1.0.2 to easy-install.pth file
    Installed d:\apps\python26\lib\site-packages\pymssql-1.0.2-py2.6-win32.egg
    Processing dependencies for pymssql==1.0.2
    Finished processing dependencies for pymssql==1.0.2
    

    Note the warning on the third line. Then, when I run python, I got following:

    D:\Apps>python
    ActivePython 2.6.4.8 (ActiveState Software Inc.) based on
    Python 2.6.4 (r264:75706, Nov  3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pymssql
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "c:\users\...\appdata\local\temp\easy_install-9lqwha\pymssql-1.0.2-py2.6-win32.egg.tmp\pymssql.py", line 30, in <module>
      File "c:\users\...\appdata\local\temp\easy_install-9lqwha\pymssql-1.0.2-py2.6-win32.egg.tmp\_mssql.py", line 7, in <module>
      File "c:\users\...\appdata\local\temp\easy_install-9lqwha\pymssql-1.0.2-py2.6-win32.egg.tmp\_mssql.py", line 6, in __bootstrap__
    ImportError: DLL load failed: system cannot find path specified (this was in russian)
    >>>
    

    So I notice the warning and just put ntwdblib.dll to folder that will be accessible by python dll search (in my case  it was root folder of python installation). You can get ntwdblib.dll either by extracting it from the installation package (7zip can extract it), or from source zip package, which also contains it. After placing ntwdblib.dll and starting python I got following:

    ActivePython 2.6.4.8 (ActiveState Software Inc.) based on
    Python 2.6.4 (r264:75706, Nov  3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pymssql
    >>>
    

    I'm sure the cause of this was setting zip_safe flag to true while building distribution as it prevents unpacking ntwdblib.dll from distribution archive.

     
  • A

    A - 2010-03-02

    Those Windows .exe files are in fact self-extracting ZIP archives, you can use any tool to extract it to your python library path, e.g. c:\python26\lib\site-packages. Put pymssql.*,  _mssql.* and ntwdblib.dll there and it'll be fine.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.