0

Python pyodbc can't be imported

Hello,

I need to use in my package connection to the database. I already have my own system that allows me to access db and I use it in many applications that allow using Python, such as Maya or Nuke and now I wanted to use it in RV.

The system uses SQLAlchemy and pyodbc. I copied sources of SQLAlchemy to the python26 catalog, I also copied pyodbc.pyd file but the mode still has problems with pyodbc module. The message is:

ImportError: DLL load failed: the specified module could not be found.

Is the problem related to the fact that pyodbc is pyd file?

What might cause this error?

 

Thanks in advance,

Lukasz

3 条评论

  • 0
    Avatar
    Alan Trombla

    Hi Lukasz,

    I assume when you say "python26 catalog" you mean the lib/python2.6 directory of the RV install ?   The pyd file is a windows DLL so the error may mean that the windows DLL loader couldn't find pyodbc or that it couldn't find some other DLL that pyodbc depends on.

    DLL modules (modules of type "pyd") should go in the directory /lib/python2.6/lib-dynload.  Is that where you put pyodbc.pyd ?  If so, it may be finding that file but not some other DLL that it depends on.  In that case you need to figure out the dependent DLLs and copy them in too.  The only way I know how to do this is to use the "depends" utility to load pyodbc.pyd.  You can find that utility here.

    Another approach that should be easier if it works would be to initialize the PYTHONPATH environment variable with locations of the "native" install of SQLAlchemy and pyodbc.  Did you try that ?

    But since you have this working in Nuke for instance, I guess the question is how did you get that working ?   I would have imagined that doing the analogous thing for RV would work.

    Cheers,

    Alan

  • 0
    Avatar
    Lchmielewski

    Hi Alan,

     

    Thanks a lot for your answer.  I do have the pyd in the correct catalog (.../lib-dynload) but that didn't change anything. Then I used depends on this pyodbc.pyd and I found out that I have msvcr90.dll missing so I copied it from another place in the system to .../lib-dynload and now I get a different error, the one I attached to this post.

     

    What might cause it? Does it mean I have somethin else missing? Or just one of the files is not in a correct version?

     

    Best regards,

    Lukasz

  • 0
    Avatar
    Alan Trombla

    Hi Lukasz,

    I'm afraid that problem might be unsurmountable.  "msvcr90.dll" is the C Runtime for MS  Visual Studio 2008.  But since RV is compiled with VS 2010, it has already linked with the appropriate C runtime for that version of Visual Studio: "msvcr100.dll:"   I'm sure it causes problems to have two versions of the runtime loaded simultaneously, so it looks like that pyd cannot be loaded by RV.

    I think the only option at this point would be to recompile the module with VS2010.

    Sorry to not have something more hopeful to say !

    Alan

请先登录再写评论。