Checking for dlls in ctypes

88888 Dihedral dihedral88888 at googlemail.com
Sat Oct 13 09:40:01 EDT 2012


Wanderer於 2012年10月12日星期五UTC+8下午11時36分27秒寫道:
> I'm trying to write some code that will load one of three dll depending on the one available. I've tried the code below, but it doesn't work. The try except doesn't catch the exception. Is there a way to do this?
> 
> 
> 
>         try:
> 
>             self.dll = windll.pvcam64
> 
>         except:
> 
>             print "No pvcam64"
> 
>             try:
> 
>                 self.dll = windll.pvcam32
> 
>             except:
> 
>                 print "No pvcam32"
> 
>                 try:
> 
>                     self.dll = windll.pvcam
> 
>                 except:
> 
>                     print "No pvcam"
> 
>                     return
> 
>                 else:
> 
>                     print "installed pvcam"
> 
>             else:
> 
>                 print "installed pvcam32"
> 
>         else:
> 
>             print "installed pvcam64"

In linux  there are shared libraries that could be linked in the runtime.

But for the security concerns this requres the system administrator account 
to install shared libraries.



More information about the Python-list mailing list