Types of errors, error analysis and handling in Python

Hello all!

I have a very basic to intermediate level of Python language skill. During the coding or project whenever i have any error, it becomes nightmare to solve it.

Can someone please recommend me some python resources or project or tutorial or github repository, where they have mainly discussed about all types of errors and error analysis and the cure.

Thanks for your time in replying me!


Two guides you might find useful:

1 Like

In the beginning, you’ll find that a lot of your errors will be syntax errors due to whitespacing. I’d use an editor like Atom or Notepad++ that can help you with your spacing. You might have to play with some settings in the editor. This will help a lot. And also, try not to mix spaces and tabs. Pick one that works for you and stick to it.

The Python interpreter will tell you what type of error you have in the console output, pay attention to that for clues, google them if you have to.

There’s also always the official Python Documentation.
Python Documentation - Python.org

1 Like

Learning how to debug can be very frustrating, but debugging is a huge part of learning how to develop code. Professional developers are constantly debugging. The two go hand in hand, and your skills in both need time and practice to grow. The same resources you prefer to use for writing code are also going to be important for debugging.


Its nice resource and handy! Thanks.

I downloaded Atom. Its really great writing tool! Thanks :slight_smile:

1 Like


Making the habit knowing what i am doing that will really help me. You know, i especially have problem when i have to do some mathematical computations. Some error comes up related to matrix or array values, index, size, etc… and these errors kills me!!

You said the very important thing- “Debugging”. I think, by doing this i can understand the concepts at each step , and i can also make the code error free!

As a beginner, most of the time when i do coding, i just expect that the program should be running without error, probably this mindset is wrong!! I have to raise my mindset.

If you could say me something more about debugging, that will be bonus for me from yourside. Thanks for your reply!


1 Like

Honestly, if my code runs correctly on the first try, it usually means I forgot some test case or way that it could be wrong.

I am still working on my debugging skills, but generally, I try to break my code into a series of small chucks, turn those small chunks into functions, and the verify that every function produces the output that I expect for a few sets of inputs that cover all of my important use cases.

Learning how to write a series of small test cases that demonstrate the possible failure modes takes a lot of practice, but it is a critical skill in understanding and improving your code.

Just yesterday, I found a dedicated course on writing test cases with python. I will share my experience with you. I want to become good at these skills as soon as possible. :smile:

@JeremyLT @JayG

Is this what is meant by the term “unit testing”? I see that a lot in job postings (although I am IT Generalist/Support guy, not a developer, learning to code for fun).

Basically, yeah. You want to break code into small pieces or units that are easier to write and test. You combine those smaller pieces to build bigger parts that you also test until you build up to the full thing you want to make.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.