Skip to main content
0 votes
0 answers
35 views

Suppose you have some code like this: def some_func(): try: func_a() func_b() func_c() except SomeException as e: print("An exception occurred.") Is ...
jcgrowley's user avatar
  • 739
-3 votes
2 answers
90 views

I'm having a problem with a program where it runs the exception along with the try command and I don't know what to do since it prints the conversion and the error message. def main(): print('What ...
Chris William's user avatar
2 votes
1 answer
1k views

I am trying to write basic code that continues when a valid ticker (stock symbol) is input and restarts if the ticker is invalid. I thought I would try a while True / try / except method. This works ...
Omega's user avatar
  • 33
1 vote
1 answer
141 views

I have three dedicated functions, each containing a __try/_except block, and in which a EXCEPTION_ACCESS_VIOLATION, EXCEPTION_INT_DIVIDE_BY_ZERO, and EXCEPTION_FLT_DIVIDE_BY_ZERO exception should be ...
Alex Net's user avatar
  • 299
0 votes
0 answers
46 views

So, this code crushed when web driver not found element: try: driver.find_element(By.XPATH, "//span[contains(.,'some_text')]").get_attribute('innerHTML') except Exception as e: logger....
Viktor Katelevskij's user avatar
2 votes
1 answer
51 views

I see one of the methods in python uses raise_for_status(): def raise_for_status(self): if 400 <= self.status_code < 500: http_error_msg = ( ...
iDev's user avatar
  • 2,473
0 votes
1 answer
89 views

This code: def abc(): raise ValueError() def xyz(): try: raise TypeError() except TypeError: abc() xyz() creates the following traceback: Traceback (most recent call ...
user1806566's user avatar
  • 1,251
-6 votes
3 answers
82 views

At first, i wrote my simple code as below: while True: try: x = int(input("what's x? ")) except ValueError: print(f"x is not an integer!") else: ...
Gaurav's user avatar
  • 1
3 votes
1 answer
79 views

I am debugging some complicated legacy Python3 code and find myself needing to know, at a particular point in the executing code, all the try blocks that are active in the call stack. Is there a way ...
IronPillow2's user avatar
0 votes
2 answers
182 views

My following code was designed to handle exceptions and switch serialport if nothing was found. try: serial_port = '/dev/cu.usbserial-10' except: try: serial_port = '/dev/cu.usbserial-...
CheezGuy's user avatar
-1 votes
1 answer
61 views

I'm working with an external API and trying to automatically feed data from it into my own application. Let's say that the API call i'm making always has the fields 'length' and 'girth' and sometimes ...
amason13's user avatar
2 votes
2 answers
162 views

I want to accomplish the following: I have a global variable x assigning to int(input('x: ')) in the try block, but I want to pass the value of x in the except block to alert the user that the ...
Nitin Bhakta's user avatar
1 vote
1 answer
233 views

I am using scipy.sparse.linalg.spsolve() to solve a set of linear equations in a loop where the equations are opdated iteratively based on the previous solution. Sometimes I end up in a singular ...
Brian's user avatar
  • 23
1 vote
1 answer
105 views

I'm having problems with my code in python where basically I make several SSH connection. I'm always using this format: try: ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko....
martinmistere's user avatar
0 votes
1 answer
64 views

I'm an experience Perl programmer relatively new to Python. I'm writing a simple program which uses requests.get(), in a try/except block. pylint complains my bare 'except:' was too bare, so I made it ...
Tom Legrady's user avatar

15 30 50 per page
1
2 3 4 5
62