When commenting out a try / except, place a if True: # in front of the try:
if True: #try:
return get_callable(callback), {}
# except (ImportError, AttributeError), e:
# raise ViewDoesNotExist("Tried %s. Error was: %s" % (callback, st r(e)))
This makes for correct syntax without having to de-dent the inner block. You could also add a finally: pass block after the commented except:
try:
return get_callable(callback), {}
# except (ImportError, AttributeError), e:
# raise ViewDoesNotExist("Tried %s. Error was: %s" % (callback, st r(e)))
finally:
pass
Your only other option is to comment out the try: line as well, and remove the indentation of the block:
# try:
return get_callable(callback), {}
# except (ImportError, AttributeError), e:
# raise ViewDoesNotExist("Tried %s. Error was: %s" % (callback, st r(e)))
You cannot leave a bare try: in place without an except or finally block to complete it.