Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 675
Luis Biaus Avatar asked Mar 06 '23 04:03

Luis Biaus


1 Answers

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.

like image 89
Luis Biaus Avatar answered Mar 07 '23 18:03

Luis Biaus