SiLab-Bonn/basil

Confusing exception error message

Closed this issue · 0 comments

basil/basil/dut.py

Lines 255 to 267 in 07b7cf3

try:
mod = import_module(importname)
except ImportError: # give it another try
exc = sys.exc_info() # temporarily save exception
if mod_name:
try:
mod = import_module(mod_name)
except ImportError:
raise exc[0], exc[1], exc[2] # raise previous error
else:
importname = mod_name
else: # finally raise exception
raise

Why is in line 263 the previous error raised? This lead to a confusing error message for me when I was missing pyUSB, but the error shown was "module pytlu.ZestSC1TL does not exist" or something like that when I called the pytlu program. pytluZestSC1TL was not the problem, but that module crashed when trying to load pyUSB.