Antoni Parellada Antoni Parellada - 6 months ago 23
Python Question

IPython Notebook image loading syntax

I'm taking this Coursera course on linear algebra, which is Python based. I got so far as to produce some initial plots and work with complex numbers on IP Notebook. I am using Windows, and the display of the Notebook is on Chrome.

I got to a command to call a jpeg image on the plot and the line written by the instructor is:

from image import *


I am getting the following error message:

In [7]: from image import *
File "image.py", line 98
print("Hit Enter once the image is displayed.... ", end="")
^
SyntaxError: invalid syntax


I believe that the call may be pointing to the
image.py
downloaded from this site.

Answer

I'll go and assume that in the course they're working with python 3, so the error you're getting is because of the print function.

from image import *
    File "image.py", line 98
    print("Hit Enter once the image is displayed.... ", end="")
                                                           ^
SyntaxError: invalid syntax

Either use Python 3, or from __future__ import print_function