Closed s-pearce closed 2 years ago
Hi s-pearce,
It is an easy mistake to make not to pass the "pattern=" with the argument list. To fix this particular error should be not too difficult, but I should think a bit of a solution that handles the situation to distinguish between filenames=[...] and pattern="..." better.
As of version 0.4.10 this issue has been solved. The UnboundLocalError that got triggered was due to a dbd.close() being out of place. Furthermore, if a string is supplied as first argument to MultiDBD, instead of a list or tuple with filenames, it is assumed that files should be selected according to a pattern based on this string. So dbd = dbdreader.MultiDBD("01550000.*bd") should now just work.
Thanks for reporting the bug!
Thanks Lucas.
Hi Lucas, I made an error by accident on trying to open a MultiDBD class call by not calling out the
pattern
keyword argument and instead using the pattern as the first position argument, which saw the string as a sequence and failed to open the files it thought it had. That is not an unexpected Exception, however, during the Exception, another one was raised (UnboundLocalError
) for trying to access and close thedbd
object before assignment (see example below). It may require a slight update to the exception handling (although it is probably a pretty obscure error if the class is called correctly).