Luis Biaus
Luis Biaus

Reputation: 111

Syntax error while trying to run scripts from iPython

When I start up iPython in Ubuntu, I normally just run my script like this:

run code.py

If something fails, I can keep working with the variables and functions defined in the code. The problem starts when I fix the code using a text editor and try running it again. Then I get:

run code.py
File "<ipython-input-16-b1a3e2c6b7e8>", line 1
    run code.py
           ^

The ^ always marks the last character before the .py extension. If I close iPython and reopen it, I can run the code without a problem. This issue only arises when I run a second code from iPython, and the problem is solved by resetting iPython.

It gets very annoying and I can't figure out what is causing this.

Upvotes: 4

Views: 722

Answers (1)

Luis Biaus
Luis Biaus

Reputation: 111

I've finally realized what was the problem. I was calling a variable "run" inside most of my scripts, and then ipython was left without the command run.

Upvotes: 7

Related Questions