How to Debug Python Script

Publié le: 21 juillet 2014
sur la chaîne: Techy Help
1,814
like

Can you tell me how to debug Python script?

First, to find out exactly what is wrong, go to Google.

Then what?

Enter in the error message you are getting to get an idea of what went wrong.

I've heard of people refer to Google as the great brain in the sky, and in go pick Google's brain, cause heaven knows I don't. What if Google doesn't have the answer?

Then your next step is Googling a few Python programming for beginners books and buying a few to read, because you're so lost you need to return to start before you begin again.

Let's say Google has a solution for the error.

If you are lucky, it'll tell you where the decorator was wrong, whether the issue is a closure that didn't find closure or a missing file you need in the Python egg.

What is a Python egg? Aside from real snake eggs, of course.

It is a Python project that is encapsulated in a single directory, with all files the Python program needs to run. Other Python programs may have to pull files equivalent to a dll file that reside elsewhere than its own directory.

Might problems occur because the files are missing?

Oh, of course. Just because you have Python editor and an IDE installed doesn't mean it has all the little files you need, just like how having a PC with an operating system doesn't mean you have all the drivers for your devices.

What other advice do you have for debugging Python?

Use the PDB module and insert pdb set trace as a breakpoint.

I don't know what that function does.

As the interpreter runs, that acts like a page break. By adding these breaks or pauses, you'll know where the error occurs because it is in the code after the last PDB break.

I don't know how to flip a page so to speak in Python.

C is continue, both in computer science programs and degree programs. At least until you get to the D of the diploma.


Sur cette page du site, vous pouvez voir la vidéo en ligne How to Debug Python Script durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Techy Help 21 juillet 2014, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 1,814 fois et il a aimé like téléspectateurs. Bon visionnage!