Execution model

Always crashes if file contains broken syntax


In [6]:
definitely broken syntax :)

print "after broken syntax"  # Will this be executed?


  File "<ipython-input-6-fa1acc23c1b9>", line 1
    definitely broken syntax :)
                    ^
SyntaxError: invalid syntax

No the syntax error in the first line leads to immediate termination of the program by raising a SyntaxError Excpetion.


In [7]:
def i_contain_broken_syntax():
    definitely broken syntax :)

print "after broken syntax"  # Will this be executed?


  File "<ipython-input-7-c5bf2c398f67>", line 2
    definitely broken syntax :)
                    ^
SyntaxError: invalid syntax

apparently not the line containing the syntax error is not executed but needs to be parsed anyway, which is not possible if the line contains a syntax error.

Bad indentation always crashes


In [8]:
def f():
    print("This is a little demonstration")
    print("that the Jupyter Notebook")
    print("has a decent editor")
    print("Because I am pretty sure that only the error")
    print("is not enough if you are new to this")
	print("<--- What's that arrow? A tab character? Thank Jupyter!")


  File "<ipython-input-8-b099a36aca76>", line 7
    print("<--- What's that arrow? A tab character? Thank Jupyter!")
                                                                    ^
TabError: inconsistent use of tabs and spaces in indentation

In [ ]: