What steps will reproduce the problem?
What is the expected output? What do you see instead?
My file to execute
Please provide any additional information below
File "C:\Users\Peter\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 2609, in edit_preferences
widget.initialize()
File "C:\Users\Peter\Anaconda3\lib\site-packages\spyder\plugins\configdialog.py", line 77, in initialize
self.load_from_conf()
File "C:\Users\Peter\Anaconda3\lib\site-packages\spyder\plugins\configdialog.py", line 381, in load_from_conf
color, bold, italic = self.get_option(option, default)
TypeError: 'NoneType' object is not iterable
pyflakes >=0.6.0 : 1.6.0 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pygments >=2.0 : 2.2.0 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
numpy >=1.7 : 1.13.3 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
rope >=0.9.4 : 0.10.5 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
cython >=0.21 : 0.26.1 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
IPython >=4.0 : 6.1.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
I expect to see my file execute. Instead, I get the error message:
NameError: name 'runfile' is not defined
Suggesting that spyder has dropped support for runfile(). Or that runfile was moved to a new location and is no longer in the default path. Seems this would have been caught in release testing, no?
Evidently, this is a very common problem as there are many, many complaints about this error, with many, many suggestions, but no accepted solutions and no acknowledgements that any solution worked.
Perhaps it is worth pointing out that copying and pasting the file at the spyder command line does work most of the time. Sometimes, the command prompt hangs on input and must be escaped to return to operation.
Thanks for reporting. Are you aware you can edit your posts? Also, Google/github search is your friend :) In any case, runfile
is most certainly not deprecated; and usually when this gets reported it has to do with something install specific. The error trace given in the original post is also a duplicate of a different common error, #5578 , which I would guess is triggered due to Spyder opening the run configuration prefs dialog on the first file run, and may be the root cause of the runfile error that I assume follows. In that case, just run spyder --reset
in a terminal to fix it for now, and it is already solved permanently in Spyder 3.2.5 once that is publicly released.
If that doesn't fix the runfile
issue, then its a separate issue and a possible duplicate of #3428 and its many brethern, and I include below my previous reply to the last individual who had such an error.
If you search for it, this error has been reported many times before from different causes (perhaps the most prolific being #3428 ); apparently some cases are bugs in Spyder and others are due to something going wrong during installation or something else gone wrong on the user side of things. If you have not already, you could read through those threads carefully and make sure none of those user-side fixes resolve your issue.
Other than that, you could try reinstalling a clean copy of anaconda, or at least installing Spyder in a clean conda-env, and seeing if the error persists. If so, and a more specific fix is not readily offered and a non-user cause is not ruled out, it would be important to know exactly what changed in your environment between when Spyder worked and when it didn't (OS, Python, Spyder, package updates, configuration, etc.), as that would be the main way to narrow down the problem.
"spyder --reset; spyder --default" did not work. A full removal of anaconda and a full reinstallation worked. Old school.
Thanks for your help. I hope you find the problem that causes this annoyance.
Glad you got it fixed. If the problem was the first one I mentioned, on Spyder's side, then it is already fixed in 3.2.5, If it is a more general issue with files not able to be run, and reinstalling fixed it, then as stated it is more than likely it is a more general issue with something going wrong with Anaconda's installation or something else user-side, which doesn't really have much to do with Spyder and which Spyder has no direct control over.
In any case, it by chance it does happen to be some esoteric, well-hidden bug, then I certainly wouldn't be the one finding it as I'm just another user like yourself, by no means a Spyder developer haha.
This was already fixed and it'll be part of our 3.2.5 version.
In the meantime, please run
spyder --reset
in a system terminal (cmd.exe) to fix it.
@ccordoba12 Indeed, deep in the thicket of posts I mention so above; the error trace was recognizable as a duplicate of #5578 , referring the user to that issue and your suggested fix, and conjectured that the reason the prefs bug was triggered was due to the first file run dialog likely trying to pop up and failing.
However, interestingly, the user then tried spyder --reset
as suggested (as well as spyder --default
and he indicated that it did not, in fact, fix the problem; only a full reinstall of anaconda apparently resolved it.
update the python path in Tools-> PYTHONPATH manager->
Locate the 'utils' directory as follows:
anaconda2 --> lib --> python
And Viola! done.
On Windows, spyder --reset
worked for me, if I ran it from the Anaconda Prompt (from Windows applications menu).
Most helpful comment
update the python path in Tools-> PYTHONPATH manager-> -->site-packages-->spyder-->utils
Locate the 'utils' directory as follows:
anaconda2 --> lib --> python
And Viola! done.