Python Spyder reset

Akavall picture Akavall · Mar 17, 2012 · Viewed 81.4k times · Source

I was using python(x,y), which came with Spyder. Yesterday, Spyder crashed I can't figure it out how to fix it. I uninstalled python(x,y) and reinstalled, still the same problem.

If I try to open Spyder I get this message:

Spyder crashed during last session

If Spyder does not start at all and before submitting a bug report, please try to reset setting to defaults by running Spyder with the command line option '--reset:

python spyder --reset

Of course, I tried to do the above, but it doesn't seem like I have Spyder in my path. When I try to put

python spyder --reset

in my command prompt window, I get this error message:

python: can't open file 'spyder': [Errno 2] No such file or directory

I made some attempts of trying to add spyder to path, but they all failed. How should I go about adding Spyder to path?

I am using Windows Vista on a 32 bit system.

My Spyder Crash report looks like this:

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 1547, in main
    mainwindow = run_spyder(app, options)
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 1472, in run_spyder
    main.setup()
  File "C:\Python27\lib\site-packages\spyderlib\spyder.py", line 555, in setup
    multithreaded=self.multithreaded)
  File "C:\Python27\lib\site-packages\spyderlib\plugins\console.py", line 54, in __init__
    light_background=light_background)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\internalshell.py", line 101, in __init__
    debug, profile)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 698, in __init__
    ShellBaseWidget.__init__(self, parent, history_filename, debug, profile)
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 61, in __init__
    self.history = self.load_history()
  File "C:\Python27\lib\site-packages\spyderlib\widgets\shell.py", line 500, in load_history
    if rawhistory[1] != self.INITHISTORY[1]:
IndexError: list index out of range

I am terrible with this stuff, so I might be missing something completely obvious or doing something really stupid.

I am wondering if anyone else ran into a similar problem, or can just give suggestions on what to do, and how to do this "reset" thing, or maybe other advice.

Thank You in Advance

Answer

jfs picture jfs · Mar 17, 2012

python doesn't search spyder in the PATH e.g.:

c:\some\dir> python some_file

Here python tries to read c:\some\dir\some_file file i.e., it looks in the current directory for some_file file.

c:\some\dir> python another_dir\some_file

Here python tries to read c:\some\dir\another_dir\some_file file i.e., it looks in the another_dir directory for some_file file.

c:\some\dir> python C:\path\to\some_file

Here python tries to read C:\path\to\some_file file i.e., it looks in the C:\path\to directory.


If documentation says run: python spyder --reset it assumes that you're in the directory where spyder script lives. It works both from the source checkout scripts directory (if you'd like to run it without installation) and from whatever directory the installation puts scripts in.

Installation process should create spyder or spyder.bat files. If spyder.bat in your PATH then you could run it as:

c:\any\dir> spyder

So instead of python spyder --reset you could try:

c:\any\dir> spyder --reset

The traceback shows that the first executed function is spyderlib.spyder.main(), source code for the spyder script confirms it, so you can run:

python -c "from spyderlib.spyder import main; main()" --reset