[Baypiggies] Crossplatform exceptions.WindowsError help
Paul McNett
p at ulmcnett.com
Tue Apr 15 03:17:37 CEST 2008
Aahz wrote:
> On Mon, Apr 14, 2008, Paul McNett wrote:
>> Hi,
>>
>> This code must run cross-platform:
>>
>> try:
>> ..
>> except WindowsError:
>> ..
>>
>> However, the WindowsError exception is only defined on Windows, not on
>> Linux or Mac. How do I keep a spurious NameError from happening on the
>> other platforms while still keeping the code clean (free from
>> os-specific code blocks)?
>
> try:
> WindowsError
> except:
> class WindowsError: pass
Okay, I guess that isn't so bad after all, now that I see it in blue on
white. Thanks!
Paul
More information about the Baypiggies
mailing list