Open PerilousApricot opened 9 years ago
Looking at it more, it's worse than it appears. Not only does the traceback for the real error get blown away, but it gets replaced by a pretty glaring bug in the exception handling code:
https://github.com/dmwm/CRABClient/blob/master/src/python/CRABClient/Commands/SubCommand.py#L91
def _extractReason(self, configname, re):
"""
To call in case of error loading the configuration file
Get the reason of the failure without the stacktrace. Put the stacktrace in the crab.log file
"""
#get only the error wihtout the stacktrace
msg = str(re)
filename = os.path.abspath( configname )
cfgBaseName = os.path.basename( filename ).replace(".py", "")
cfgDirName = os.path.dirname( filename )
if not cfgDirName:
modPath = imp.find_module(cfgBaseName)
else:
modPath = imp.find_module(cfgBaseName, [cfgDirName])
try:
modRef = imp.load_module(cfgBaseName, modPath[0],
modPath[1], modPath[2])
except Exception, ex:
msg = str(ex)
return msg
The second try-except causes the error that's reported to be from imp.load_module, not from the one above. The whole function doesn't make sense though. Why spend all that time extracting out module information if it's not actually used?
Hi Andrew,
I think this got broken at some point during a refactoring and nobody ever noticed. Thanks for reporting.
_extractReason
is supposed to extract the reson so that we only print the traceback in a crab.log
logfile. Honestly I have never liked that. I agree that stacktraces should not make it to users, but in this particular case it's a stacktrace provoked by the user's code, so he is interested in it.
@mmascher this is too technically tricky for me but maybe you can hand it over to @emaszs with some coaching
@mmascher @emaszs is this something we still have to address, or shall we close ?
Reraising a new exception blows away the context that would be needed to fix the problem. Who was set to NoneType??