Skip to content

MyErrVisualizer is an utility to better showcase a Traceback generated from Errors while running a Python File

Notifications You must be signed in to change notification settings

hellosaumil/MyErrVisualizer

Repository files navigation

MyErrVisualizer

MyErrVisualizer is an utility to better showcase a Traceback generated from Errors while running a Python File!

For Web Version:

Live: MyErrVisualizer on Heroku

For CLI:

Download just ONE file! - myErrVisualizer.py


Man Page like Description

Name

myErrVisualizer - MyErrVisualizer is an utility to better showcase a Traceback generated from Errors while running a Python File

Synopsis

myErrVisualizer ERROR_FILE_PATH... [NUM_CALLS]...

Description

A Simple Command-Line Utility to Visualize your Python Errors

It is often time-consuming for me to go through python error traceback calls to figure which file, which function and which line has the error. Also, the error statement is buried deep down in those traces which is hard to read. I attempt in this utility to increase the readability of python error logs.

Note: Use of NUM_CALLS is only supported for standard error logs and not unenven logs, See Caveats to understand the differnce.

Showcase

Comparision: MyErrVisualizer v/s Typical Python Error

MyErrVisualizer2 myErrVisualizer in a Terminal Window

MyErrVisualizer2 Typical Python Error shown in a Terminal Window

Comparision: MyErrVisualizer v/s Typical Python Error in Jupyter Notebook Logs

MyErrVisualizer1 myErrVisualizer in a Terminal Window

MyErrVisualizer1 Typical Python Error shown in a Terminal Window


With Options like num_calls to show only First and Last n Calls. (Here, n=3)

MyErrVisualizer1

Options

Describes all Options of myErrVisualizer
-f		Provide the Error File Name that contains
        Python Error Traceback Calls After -f or --err_file_path option
--err_file_path		 

-n		Number of Error Calls to be printed, default=None
        (only works with standard error tracesback calls)
--num_calls		 


-h		Shows Usage Help
--help

Usage

When creating a error file of the traceback calls, include logs starting from the line that states Traceback (most recent call last): to SomeError: Error Message that is displayed

python myErrVisualizer.py                			# Displays Help Page
python myErrVisualizer.py   -f   error_file.err			# Provide an error file
python myErrVisualizer.py   -f   error_file.err   -n   3	# Provide number of calls to showcase, default=None

alternatively,

python myErrVisualizer.py   --err_file_path   error_file.err
python myErrVisualizer.py   --err_file_path   error_file.err   --num_calls   3

Caveats

Standard Traceback Calls:

Traceback (most recent call last):
  File "sample_file.py", line 274, in <module>
    generate_image(iteration, netG)
  File "sample_file.py", line 138, in generate_image
    test_dir + '/samples_{}.png'.format(frame)
  File "/home/user/repo/codes/folder1/folder2/sample_file2.py", line 31, in save_images
    img = np.zeros((h*nh, w*nw))
TypeError: 'float' object cannot be interpreted as an integer

i.e., Each line starting with File is followed by a code with referencing(tracing) back to the original error, usually a file line and code line pattern.

Unenven Traceback Calls:

Traceback (most recent call last):
  File "sample_file.py", line 274, in <module>
  File "sample_file.py", line 138, in generate_image
    test_dir + '/samples_{}.png'.format(frame)
  File "/home/user/repo/codes/folder1/folder2/sample_file2.py", line 31, in save_images
    img = np.zeros((h*nh, w*nw))
TypeError: 'float' object cannot be interpreted as an integer

i.e., Each line starting with File may not be followed by a code

Version

Beta 0.1 - Only Supports Unix Systems (i.e, macOS, OS X, Linux - Ubuntu), Supports Python 2.x and 3.x

Author

Written by Saumil Shah.
More details about this project can be found at : https://github.com/hellosaumil/MyErrVisualizer
[Download source code here!](/)

Reporintg Bugs

Report bugs to https://github.com/hellosaumil/MyErrVisualizer/issues

About

MyErrVisualizer is an utility to better showcase a Traceback generated from Errors while running a Python File

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published