Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Shouldn't the try: __import__ in __init__ re-raise original exception? #23868
It is confusing when
Where actually the true error is not in
As you can see, I happen to have a file called
Tracking back the source of it, in
Question also asked in SO:
A +1 for this. I do think Pandas is being misleading in this case - I've just spend a good ten minutes trying to figure out why Pandas thinks Numpy isn't installed when
I don't see any particular advantage to what Pandas is doing - why not just allow the underlying ImportError to be raised, whether it's the requirement itself missing or some dependency of that, like just about every other package? Turning an ImportError into a potentially less informative ImportError doesn't seem to be very useful.
If you really, really want to have the little message that can give a single message saying that all three of numpy, pytz, and dateutil missing, I'd be tempted to go with:
Is there any need to raise a separate import error - i.e. what would Pandas add that isn't already there? If there's a default ImportError that already says that it couldn't find
(This is different from some other cases further down in
I'd be happy to give this one a go - seems like a fairly simple one to start with!
Ah, sorry, I misunderstood the issue. The idea is to raise a single error message with all of the import errors, so #23868 (comment) won't quite work.
I think the simplest thing is to include the original exception in the