Tracking down DLL load errors in Windows ?

Discussion in 'Python' started by Fred P, Oct 15, 2009.

  1. Fred P

    Fred P Guest

    Hi, a bit of platform-specific advice sought here... I'm trying to diagnose
    one of those mysteries Windows is so fond of...

    Say that I have code that imports some binary Python module from site-
    packages (in this case, libpyexiv2.pyd through pyexiv2.py, could be anythng
    else).

    On three Windows boxes I've tried it (XP Pro or Home, Python 2.5)
    everything works fine. On a fourth, importing the module fails with a
    traceback like this :

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "c:\python\lib\site-packages\pyexiv2.py", line 60, in <module>
    import libpyexiv2
    ImportError: DLL load failed: This application could not start
    because its configuration is incorrect. Reinstalling it might solve
    the problem.

    I have tried long and hard to spot a meaningful difference between the
    first three systems and the last, without success.

    Is there any tool and/or methodology I could use to at least pinpoint the
    exact DLL that libpyexiv2 is failing to load, and ideally also the reason
    why ?...

    TIA,
    fp
     
    Fred P, Oct 15, 2009
    #1
    1. Advertising

  2. Christian Heimes <> said :

    > Fred P wrote:
    >> Is there any tool and/or methodology I could use to at least pinpoint
    >> the exact DLL that libpyexiv2 is failing to load, and ideally also
    >> the reason why ?...

    >
    > The depencency walker http://www.dependencywalker.com/ works fine for
    > me.


    I'd never heard of that tool before, but it looks powerful indeed !

    Thanks a lot for the pointer,
    fp
     
    Fred Pacquier, Oct 16, 2009
    #2
    1. Advertising

  3. Fred P

    Mark Tolonen Guest

    "Fred P" <> wrote in message
    news:Xns9CA5E52BEC783PaCmAnRDLM@212.27.60.39...
    > Hi, a bit of platform-specific advice sought here... I'm trying to
    > diagnose
    > one of those mysteries Windows is so fond of...
    >
    > Say that I have code that imports some binary Python module from site-
    > packages (in this case, libpyexiv2.pyd through pyexiv2.py, could be
    > anythng
    > else).
    >
    > On three Windows boxes I've tried it (XP Pro or Home, Python 2.5)
    > everything works fine. On a fourth, importing the module fails with a
    > traceback like this :
    >
    > Traceback (most recent call last):
    > File "<stdin>", line 1, in <module>
    > File "c:\python\lib\site-packages\pyexiv2.py", line 60, in <module>
    > import libpyexiv2
    > ImportError: DLL load failed: This application could not start
    > because its configuration is incorrect. Reinstalling it might solve
    > the problem.
    >
    > I have tried long and hard to spot a meaningful difference between the
    > first three systems and the last, without success.
    >
    > Is there any tool and/or methodology I could use to at least pinpoint the
    > exact DLL that libpyexiv2 is failing to load, and ideally also the reason
    > why ?...


    That error message is returned from executables built with later versions of
    Visual Studio (at least 2005 and 2008...not sure about 2003). The Windows
    application event log will indicate what DLL is missing.

    In addition to tools others have noted, depends.exe (comes with VS2005...was
    removed in VS2008 for unknown reasons) will list the DLLs required by an
    executable. Another Visual Studio tool, "dumpbin /imports <target>" works,
    too.

    -Mark
     
    Mark Tolonen, Oct 17, 2009
    #3
  4. "Mark Tolonen" <> said :

    > That error message is returned from executables built with later
    > versions of Visual Studio (at least 2005 and 2008...not sure about
    > 2003). The Windows application event log will indicate what DLL is
    > missing.
    >
    > In addition to tools others have noted, depends.exe (comes with
    > VS2005...was removed in VS2008 for unknown reasons) will list the DLLs
    > required by an executable. Another Visual Studio tool, "dumpbin
    > /imports <target>" works, too.


    Silly me, I hadn't even thought of the Windows event log either... thanks
    much !
    fp
     
    Fred Pacquier, Oct 17, 2009
    #4
  5. Fred P <> said :
    > Hi, a bit of platform-specific advice sought here... I'm trying to
    > diagnose one of those mysteries Windows is so fond of...
    > Say that I have code that imports some binary Python module from site-
    > packages (in this case, libpyexiv2.pyd through pyexiv2.py, could be
    > anythng else).
    > On three Windows boxes I've tried it (XP Pro or Home, Python 2.5)
    > everything works fine. On a fourth, importing the module fails with a
    > traceback like this :
    > Traceback (most recent call last):
    > File "<stdin>", line 1, in <module>
    > File "c:\python\lib\site-packages\pyexiv2.py", line 60, in <module>
    > import libpyexiv2
    > ImportError: DLL load failed: This application could not start
    > because its configuration is incorrect. Reinstalling it might solve
    > the problem.
    > I have tried long and hard to spot a meaningful difference between the
    > first three systems and the last, without success.
    > Is there any tool and/or methodology I could use to at least pinpoint
    > the exact DLL that libpyexiv2 is failing to load, and ideally also the
    > reason why ?...


    Thanks to Mark and Christian : dependency-walker confirmed the VC++
    issue.

    After installing the MS redistributable DLL package -- actually I had to
    install *three* before hitting the right one (2005SP1) -- libpyexiv2
    finally loads all its dependencies.

    Of course I've still no idea why/how it ran on the first three systems
    (and most others, from the look of it) without doing anything, and not on
    this one... but at least now it works :)
     
    Fred Pacquier, Oct 18, 2009
    #5
  6. Fred P

    Mark Tolonen Guest

    "Fred Pacquier" <> wrote in message
    news:Xns9CA8B91A1519APaCmAnRDLM@212.27.60.38...
    >
    > After installing the MS redistributable DLL package -- actually I had to
    > install *three* before hitting the right one (2005SP1) -- libpyexiv2
    > finally loads all its dependencies.
    >
    > Of course I've still no idea why/how it ran on the first three systems
    > (and most others, from the look of it) without doing anything, and not on
    > this one... but at least now it works :)


    Yes, welcome to Microsoft's solution to DLL Hell...Side-by-Side DLL Hell.

    -Mark
     
    Mark Tolonen, Oct 19, 2009
    #6
  7. "Mark Tolonen" <> said :

    > Yes, welcome to Microsoft's solution to DLL Hell...Side-by-Side DLL
    > Hell.


    As always, it boils down to a philosophical choice : is it better to suffer
    through Hell alone, or in bad company ? :)
     
    Fred Pacquier, Oct 19, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    985
    Mark Goldin
    Jan 17, 2004
  2. Ben Amada
    Replies:
    4
    Views:
    559
    Ben Amada
    Aug 18, 2004
  3. =?Utf-8?B?bWFyZWFs?=

    Tracking down threads created within a ASP.NET app

    =?Utf-8?B?bWFyZWFs?=, Mar 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    425
    Scott Allen
    Mar 4, 2005
  4. MKoool

    Tracking down memory leaks?

    MKoool, Feb 12, 2006, in forum: Python
    Replies:
    15
    Views:
    532
    Christos Georgiou
    Feb 14, 2006
  5. Replies:
    9
    Views:
    2,913
Loading...

Share This Page