boulate
boulate

Reputation: 21

Why are python traceback messages not displayed?

I am trying to convert a python 2 library to python 3. I managed to convert a good part thanks to the python traceback error messages displayed in the terminal. But part of this library, which is a web server serving as IDE, does not display error messages making conversion difficult.

Why are python traceback messages not displayed? Is there a way to display them?

I found that we could set 'sys.tracebacklimit = 0' to hide the traceback but it didn't have an effect in my case setting it to 1000.

Upvotes: 2

Views: 82

Answers (1)

Paul Bissex
Paul Bissex

Reputation: 1704

As the veteran of a large Python 3 conversion, a few thoughts:

  • The library has a test suite (python setup.py check). That should be your guide as to the correctness of your conversion, not the absence of errors in manual use.
  • You don't say what tools you are using. I recommend Futurize. Do the Stage 1 and Stage 2 conversions (which are mostly automated) to get yourself a codebase that still runs in Python 2, but has been cleaned of things that are guaranteed to break in Python 3. Then you run the tests until you have fixed all the errors and any failures.
  • This is an 11-year-old old codebase built for Python 2.2. I recommend getting it running (i.e. tests passing) under Python 2.7 first rather than going all the way from 2.2. to 3.8.

TLDR: Don't get hung up on trying to surface errors from the server right now. Use the tests to find the stuff you need to fix. Use Futurize.

(I recently gave a "Porting 100,000 lines of Python 2 to Python 3" talk if you're interested.)

Upvotes: 2

Related Questions