I am a newbie to python and I have an indentation error message when I commented (‘#’) the two last lines of the following code :
try:
return get_callable(callback), {}
# except (ImportError, AttributeError), e:
# raise ViewDoesNotExist("Tried %s. Error was: %s" % (callback, st r(e)))
Can anybody help ?
When commenting out a
try/except, place aif True: #in front of thetry:This makes for correct syntax without having to de-dent the inner block. You could also add a
finally: passblock after the commentedexcept:Your only other option is to comment out the
try:line as well, and remove the indentation of the block:You cannot leave a bare
try:in place without anexceptorfinallyblock to complete it.