pdeitel / PythonFundamentalsLiveLessons

Example code for Our Python Fundamentals LiveLessons Videos
351 stars 387 forks source link

SyntaxError: invalid syntax #1

Closed MACCK-CT closed 4 years ago

MACCK-CT commented 4 years ago

Hi,

I'm new to python and trying to execute the code in chapter 2 but I am receiving the following errors:

In [3]: ipython fig02_01.py File "", line 1 ipython fig02_01.py ^ SyntaxError: invalid syntax

In [4]: ipython fig02_02.py File "", line 1 ipython fig02_02.py ^ SyntaxError: invalid syntax

I did not modify the code, just trying to call it. Not sure what I am doing wrong.

Thanks

IB72 commented 4 years ago

It would appear that you are trying to run the program from the IPython interactive mode. Exit the interactive mode by pressing "Ctrl + D" if running the Anaconda prompt on Windows and run the program again from there just as you called the code above.

Disclaimer: I am not acting on behalf of Mr. and Mr. Deitel - I am also following along with this great resource.

Attemptying to call the program from IPython interactive mode: Capture

Calling the code with the IPython command outside of interactive mode: Capture2

MACCK-CT commented 4 years ago

Hi, You are correct, I was still in ipython interactive mode from the previous lab. After I exited I was able to run the program.

Thanks