Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31193

Re: Checking for dlls in ctypes

Newsgroups comp.lang.python
Date 2012-10-13 06:40 -0700
References <975da919-c70a-492a-9d49-62254a76eb6c@googlegroups.com>
Message-ID <f50647a5-0117-4e82-aaab-1792d838ed2b@googlegroups.com> (permalink)
Subject Re: Checking for dlls in ctypes
From 88888 Dihedral <dihedral88888@googlemail.com>

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Checking for dlls in ctypes Wanderer <wanderer@dialup4less.com> - 2012-10-12 08:36 -0700
  Re: Checking for dlls in ctypes Dave Angel <d@davea.name> - 2012-10-12 12:28 -0400
    Re: Checking for dlls in ctypes Wanderer <wanderer@dialup4less.com> - 2012-10-12 10:57 -0700
    Re: Checking for dlls in ctypes Wanderer <wanderer@dialup4less.com> - 2012-10-12 10:57 -0700
    Re: Checking for dlls in ctypes Nobody <nobody@nowhere.com> - 2012-10-13 12:32 +0100
  Re: Checking for dlls in ctypes MRAB <python@mrabarnett.plus.com> - 2012-10-12 17:57 +0100
    Re: Checking for dlls in ctypes Wanderer <wanderer@dialup4less.com> - 2012-10-12 10:52 -0700
    Re: Checking for dlls in ctypes Wanderer <wanderer@dialup4less.com> - 2012-10-12 10:52 -0700
  Re: Checking for dlls in ctypes 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-13 06:40 -0700

csiph-web