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.
-
Might be a character encoding issue? Or maybe the file can't be accessed because the previous run is still running?Philip– Philip2018年10月29日 01:57:46 +00:00Commented Oct 29, 2018 at 1:57
-
The thing is this happens to me with different scripts, which led me to think there might be something wrong with iPython itself, but I haven't been able to figure it out. It may as well be something that is wrong in all my scripts, but if that were the case shouldn't the error report point to the line in the script that is causing the error? When I've had syntax errors inside the script they were always reported and located, and the fact that restarting iPython lets me run it again just confuses me more.Luis Biaus– Luis Biaus2018年10月29日 03:16:14 +00:00Commented Oct 29, 2018 at 3:16
-
Have you searched their known bugs? (github.com/ipython/ipython/issues) Or submit yours there ofcoursePhilip– Philip2018年10月29日 03:18:10 +00:00Commented Oct 29, 2018 at 3:18
-
Ok, I'll have a look over there, thanks!Luis Biaus– Luis Biaus2018年10月31日 18:03:06 +00:00Commented Oct 31, 2018 at 18:03
1 Answer 1
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.