From: Alex Hall on 14 Mar 2010 23:43 Hi all, I have a dll I am trying to use, but I get a Windows error 126, "the specified module could not be found". Here is the code segment: nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll") I have the specified dll file in the same directory as the file trying to use said dll, and this is the only reference I make to the dll. Do I need to register it somehow? If so, does this need to be done once, or each time the application runs? If I need to register it, how would I do so? Thanks! -- Have a great day, Alex (msg sent from GMail website) mehgcap(a)gmail.com; http://www.facebook.com/mehgcap
From: Alf P. Steinbach on 15 Mar 2010 00:19 * Alex Hall: > Hi all, > I have a dll I am trying to use, but I get a Windows error 126, "the > specified module could not be found". Here is the code segment: > nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll") > > I have the specified dll file in the same directory as the file trying > to use said dll, and this is the only reference I make to the dll. Do > I need to register it somehow? If so, does this need to be done once, > or each time the application runs? If I need to register it, how would > I do so? Thanks! If 'ctypes.windll.LoadLibrary' just calls the Windows API LoadLibrary function without adding any path, then the directories considered will only be those known to the Windows API, like e.g. the process' current directory (I'm not sure if the current directory is considered, but the details aren't important). And most likely your calling script file is not in any of those directories. Probably it will work to specify the full path to the DLL. You can obtain the path to the calling file's directory by using the __file__ variable and the 'os.path' functions. Cheers & hth., - Alf
From: Tim Golden on 15 Mar 2010 04:41 On 15/03/2010 03:43, Alex Hall wrote: > I have a dll I am trying to use, but I get a Windows error 126, "the > specified module could not be found". Here is the code segment: > nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll") > > I have the specified dll file in the same directory as the file trying > to use said dll The DLL search path: http://msdn.microsoft.com/en-us/library/7d83bc18%28VS.80%29.aspx includes the directory which holds the executable for the current prcoess; it include the current directory; and it includes other things which I doubt apply here. But it doesn't include (if I may be permitted a little well-intentioned ridicule) the directory where the current Python module is stored. In other words: what does os.getcwd () return? TJG
From: Ulrich Eckhardt on 15 Mar 2010 06:14 Alex Hall wrote: > I have a dll I am trying to use, but I get a Windows error 126, "the > specified module could not be found". Here is the code segment: > nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll") In addition to Alf's answer, this can also happen when the OS can't find another DLL that this one depends on. Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
From: Alex Hall on 15 Mar 2010 07:28 On 3/15/10, Ulrich Eckhardt <eckhardt(a)satorlaser.com> wrote: > Alex Hall wrote: >> I have a dll I am trying to use, but I get a Windows error 126, "the >> specified module could not be found". Here is the code segment: >> nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll") > > In addition to Alf's answer, this can also happen when the OS can't find > another DLL that this one depends on. Well, os.getcwd() returns "c:\python26", not my program's directory. However, I changed the reference to the dll to be helpers.progdir+'\\nvdaControllerClient32.dll' and still no luck! helpers.progdir is a var holding the top-level directory of my project, using os.path. Again, using this more precise reference still fails, triggering my except statement in my try/catch loop.
|
Next
|
Last
Pages: 1 2 Prev: Understanding the CPython dict implementation Next: sqlite savepoint problem [solved] |