textual-dev icon indicating copy to clipboard operation
textual-dev copied to clipboard

Show traceback on import errors

Open bswck opened this issue 8 months ago • 1 comments

Getting an import error while trying to from foo import bar does not mean specifically that bar could not be imported from foo.

It might mean a bunch of things:

  • foo wasn't found
  • bar wasn't found in foo (the assumed case and probably the reason that the traceback is hidden as of now)
  • an inner import in foo's code raised an unrelated import error

In the last case, we never get to know what inner import causes the import failure. Thus, let's always show the import error traceback.

I didn't make an additional --tb/--show-traceback switch (similar to the one mypy has) because I see it as an overkill for a package that ends with -dev. In this PR I also cleaned some leftovers that probably should instead be picked up by linters in CI; a good reason for another PR.

bswck avatar Jun 23 '24 02:06 bswck