[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: the equivalent of python's "try import <something> except: import fallback" ?
- From: gary ng <garyng2000@...>
- Date: Fri, 16 Feb 2007 18:29:16 -0800 (PST)
Hi,
I am writing a generic module which I want to use in
slightly different config and want to do the following
python equivalent :
try
import "lcrypto"
md5 = lcrypto.md5
except:
import "my_md5"
md5 = my_md5.md5
because on my limited space WRT54G, I don't have the
lcrypto binding and need to use a trimdown version.
I am again sure this can be done but don't know how.
thanks for any help.
And a side question, is there a simple way to add
serveral frequently used so modules into the
interpreter for example the bitlib, socket etc. ?
____________________________________________________________________________________
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/