Skip to content Skip to sidebar Skip to footer

Python/django Syntax Error In Exception Handling

In the code below i m getting syatax error in Error handling statements' i m using ATOM text editor. django for web interface and netmiko libaray for my backend code. from django.s

Solution 1:


codes below are true:

cmd = request.POST.get('command', '')
try:
    netconnect = ConnectHandler(**devices)
except Exception as e:
    print ('Authentication failed' + ipInsert)
    continue
getIP = netconnect.send_command(ipInsert)

Solution 2:

  • In python due to incorrect alignment, there might be errors, in your program, try and Exception do not seem to be aligned.
  • There should be an except block for each try, where you would catch the exceptions thrown from try block.
  • Also, there seems to be error at 31st line, but posted code is less

Post a Comment for "Python/django Syntax Error In Exception Handling"