try-catch

I don't understand try, except and continue

I don't understand try, except and continue Question: I am creating a .py game where I need to have user inputs that only consist of 1,2 or 3. I would like it so that the menu asks the user once at the beginning to enter one of these three numbers and if the user enters …

Total answers: 1

How to suppress irrelevant errors in a try block

How to suppress irrelevant errors in a try block Question: Suppose I want to check that a certain entry is in a Series. I would like to try to access that entry, and if that fails, raise a simple, short ValueError. For example, I have a series that doesn’t have entry C – I want …

Total answers: 1

How to log every error in file you get in cmd

How to log every error in file you get in cmd Question: I tried try catch block in my python script but my team lead wants to log every error which can occure i cannot write try catch every line do anyone know better way to do this? currently im using try catch and logger …

Total answers: 1

Get the exactly error line in try catch (error line of a subfile)

Get the exactly error line in try catch (error line of a subfile) Question: I’m developing a python bot and the debug sucks, when I use try catch to handle exceptions. I need to get the right error line, when error occurs in a subfile, where I’m import a function. Following, is an example: My …

Total answers: 1

How do I create a function/method out of this code and then call it to the main()?

How do I create a function/method out of this code and then call it to the main()? Question: enter code hereThis is the original code that I wrote: while True: user_input = (input(">>",)) try: user_input = int(user_input) except ValueError: pass if user_input in range(1, len(something): break I want to put in a method: `get_user_answer(n: int, …

Total answers: 3

Python Try Except stopping program as opposed to skipping over errror

Python Try Except stopping program as opposed to skipping over errror Question: I am running a sequence of scripts that are independent of each other. Meaning if one of them fails I want the rest to continue on and just be notified of the one that failed(I can implement the notification later). For now I …

Total answers: 1

locating element explicitly waiting and without wait what's difference?

locating element explicitly waiting and without wait what's difference? Question: The question is about selenium webdriver’s explicitly wait feature which is same locating action with a timeout. Webdriver waits element to be visible or present. In my situation, I locate elements with explicit waiting and without it. When it is without the explicit wait, it …

Total answers: 1

Why is Try Block of code not counting the same as when I don't use Try?

Why is Try Block of code not counting the same as when I don't use Try? Question: I have a function that pulls data from a Restaurant’s Clover POS System, then returns dictionaries with how many of each item was sold and then how many of each modification was made (ex: "Remove Nutella":5) My problem …

Total answers: 1