Thanks for the video. There are several commands available in Python for Introspection: dir() will give you the list of in-scope variables globals() will give you a dictionary of global variables locals() will give you a dictionary of local variables
Thank you dude ! I am an Intermidiate-Advanced Python programmer and I've been using Pycharm nearly since my beginings in Python (a year ago) WITHOUT ever knowing about the debug tool ! Now I understand WHY you don't recommand IDEs for beginners ! Thank you so much.
@@qasimzaheer1140 Probably the standard python environment which you can download directly on the official website or maybe even SublimeText3 which is better but a bit painful to put on your computer. Good luck with your code mate !
I think the best way to explain "Step Over" is that it doesn't step into ANY function calls on the current line, regardless of whether they are in your code or not. Great video otherwise!
Thank you for explaining this stuff. I am new to this and currently in college for computer science and you are helping me tons. Can just one favor is to highlight your mouse points because the background is dark
Some screen recorders highlight mouse clicks, which is especially useful when the text displayed is so small. The text in this video is too small to read comfortably. Some of Tim's other videos have better text sizes and less need for highlighting of mouse clicks.
There's this problem in my Pycharm where when I debug, it says "Variable are not available" even when I already have a breakpoint set on it. The weirdest part is that I am able to debug some functions, but for others, it just says that the variables are not available. I also don't know what difference decides whether the variables can be "available" or not. Can you please help me with this?
Code below ;) import random def generateRandom(upper): r = random.randint(1, upper) return r def main(): run = True num1 = generateRandom(10) num2 = generateRandom(10) result = num1 * num2 while run: ans = input("What is " + str(num1) + " x " + str(num2) + "? ") if ans.isdigit(): if int(ans) == result: print('Correct') run = False else: print('Incorrect solution') else: print("Input must be a numer") if __name__ == '__main__': main()
hey, love your videos! using PyCharm with python 3.8, not getting the comments appearing IN the code, next to the variables when the breakpoint is reached. Please help?
Tim, I simply cannot download pandas for Python 3.9. It gives environment error in my terminal. If you know the cause please let me know. Thanks. Awesome video, by the way.
hi Tim, stumbled across this video on the debugger and hoping to get some help. two days ago my python debugging tools would stop working when i call input() functions during debugging process (VSC & Pycharm) . when i key in an entry for input() , my code keeps running non stop with no output registered. however, when i run my code directly in terminal it is working fine. Using python 3.8 . please help!
I'm working in something using pycharm but when I run my script : Process finished with exit code 0 appears . I understand that it doesn't have any error in it but how can I see the result ?? (I did all the print things ) it's urgent plzzzzzzzzzzzz
Thanks for this video! One comment: before making a video please increase the font sizes so it would be readable in smaller screens: File>>Setting>>Font
The call stack and step in & out functions are closely related. When you call a function, it creates a frame on the call stack for tracking the state of that function. The frames are crumbs and the call stack is a bread crumb trail of the current execution of your program. When you step into a function while debugging, you'll see a new frame added to the top of the call stack; likewise, when you step out of a function, you'll see a frame popped off the stack. You can set a break point in a function that is deep in a series of function calls and see exactly how you got there by looking at the call stack. You can click on each frame to examine the state of that frame's function. Line #'s and highlighting make the code path easier to follow. Step over- you just stay in the current frame (at least until you hit the end of the function, then it acts like step out) Step in - you debug in the next function's frame if there is a function on that line (pushes a frame on the call stack) [If there is no function call on the current line then it acts like step over] Step out - you execute all the code in the current function's frame and return, putting you back in the caller function's frame (pops a frame off the call stack) Nice tutorial. Time to start using PyCharm!
Thanks for that! But is there a way to debug the code by blocks like Jupyter Notebook? It would be great if Debugger allowed to go to previous step, and change something. Otherwise, one have to run the whole code again.
Here is his starting code: import random def generate_random(upper): """ :param upper: >= 0 :return: int """ r = random.randint(1, upper) return r def main(): run = True num1 = generate_random(10) num2 = generate_random(10) result = num1 * num2 while run: ans = input('What is ' + str(num1) + ' x ' + str(num2) + '? ') if ans.isdigit(): if int(ans) == result: print('Correct') run = False else: print('Incorrect! Try again!') else: print("Answer must be a positive number, try again.") # global vars times = 10 for x in range(times): main()
Hey loved the way you explained it.. Also as you said its gonna make my life a lot easier .. So thanks.. Also would love to see an entire series on Pycharm.. and a Like and Subscribed for this video ;) ..
Have this issue of the step into my code thing not being available. It's such a great tool but when I run debugger the code just executes and completes and the step in options are greyed out. If anyone has a fix please let me know
# Starting Code: import random def generate_random(upper): """ :param upper: >= 0 :return: int """ r = random.randint(1, upper) return r def main(): run = True num1 = generate_random(10) num2 = generate_random(10) result = num1 * num2 while run: ans = input('What is ' + str(num1) + ' x ' + str(num2) + '? ') if ans.isdigit(): if int(ans) == result: print('Correct') run = False else: print('Incorrect! Try again!') else: print("Answer must be a positive number, try again.") # global vars times = 10 for x in range(times): main()
Yeah, but next time you need to zoom in or zoom out the screen while you are explaining or teaching someone, because it's too small while watching your video.
Although I've used this kind of debugger since way back in the early 1980s with BASIC. However, not all programming languages have good debuggers (and some are overly complicated), if they have a debugger at all. Consequently, most of the time I simply either print debug statements to a console or send debugging text to custom text field.
So if there's one MASSIVE difference between PyCharm and Vs Code this is it. This is an awesome debugger that will become more important as your programs become more complex and your programming skills become more advanced.
hello sir i was wondering if you know that setting SecurePreTest in pycharm cuz im tryna prank my friend im tryna prank him by bruteforcing his fb and post clowns hehe please im not doing it for abd stuff e
when I click on the debug tool it says "connection to python debugger failed, socket closed" and it doesn't let me run the debug. any way to solve that?
i imported a Github project (github.com/cmseaton42/Allen-Bradley-Toolkit.git) but i do not know how to convert a directory to a module. Do you know how to convert a directory to a module?
If I'd like to work through these with you, where would the files be? The biggest issue I'm having in following along is in the fact that I can't play with the software to see the same thing you see on your screen.
great video! one question though, you say the debugger goes through the text line by line, how come the code in the main function is executed without being called at the breakpoint?
I use windows so go to C:\ C:\Users C:\Users\User_Name\ C:\Users\User_Name\PycharmProjects C:\Users\User_Name\PycharmProjects\ProjectName And upload it