Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runfile is not defined ? #3428

Closed
stonebig opened this issue Sep 17, 2016 · 33 comments
Closed

runfile is not defined ? #3428

stonebig opened this issue Sep 17, 2016 · 33 comments
Milestone

Comments

@stonebig
Copy link
Contributor

stonebig commented Sep 17, 2016

Description of your problem

What steps will reproduce the problem?

  1. on latest spyder 2016-09-15 type a script on editor and run it (in winpython latest)
  2. ipython console says "runfile" doesn't exist ?

What is the expected output? What do you see instead?

runfile is found and there is no issue

Please provide any additional information below
spyder-20160917runfile

Versions and main components

  • Spyder Version: github 2016-09-16
  • Python Version: 3.5
  • Operating system: Windows10 (winpython)

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:
jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 2.0.0b4 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.1 (OK)
pandas >=0.13.1 : 0.19.0rc1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
pyflakes >=0.6.0 : 1.3.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.6.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.4.6 (OK)
sympy >=0.7.3 : 1.0 (OK)

@stonebig
Copy link
Contributor Author

there is no issue if I choose to "run in a dedicated python console" or in an "terminal external windows"

@Nodd
Copy link
Contributor

Nodd commented Sep 17, 2016

What is your ipython version ?

@ccordoba12
Copy link
Member

I'll take a look at this one. It's very strange that runfile doesn't appear defined.

@ccordoba12 ccordoba12 added this to the v3.0 milestone Sep 17, 2016
@stonebig
Copy link
Contributor Author

stonebig commented Sep 17, 2016

@Nodd Ipython 5.1.0 (all the latest officials wheels from Jupyter/Ipython system..)

Do you need me to check Beta6 was ok ? (I would think problems are with the big change #2878 merged 3 days ago)

@ccordoba12
Copy link
Member

@stonebig, this means (most probably) that there's an error in sitecustomize. Please run in a console:

set SPYDER_DEBUG=3
spyder --show-console

and check if there are any errors printed in our Python or IPython consoles

@stonebig
Copy link
Contributor Author

this does nothing but showing 1 second the spyder "splash" screen. and no DOS error.

@ccordoba12
Copy link
Member

ccordoba12 commented Sep 17, 2016

But there have to be errors printed in our Python consoles, at least, or something saying that sitecustomize failed to load.

Can't you see anything like that?

@stonebig
Copy link
Contributor Author

stonebig commented Sep 17, 2016

well, for my case I should type:

set SPYDER_DEBUG=3
spyder.exe --show-console

yet nothing visible... trying to see further, it seems I have hidden "Console Windows Host" processes in background

@wtheis
Copy link

wtheis commented Sep 17, 2016

Not sure whether this is helpful:

I see the same issue of 'NameError: name 'runfile' is not defined' and also the other issue
At spyder start, Kernel is said "dead and restarting" a lot of times (on a slow pc) #3429.

(py3x) set SPYDER_DEBUG=3
(py3x) C:\Users\wt>spyder.exe --show-console
Traceback (most recent call last):
File "C:\Anaconda\envs\py3x\Scripts\spyder-script.py", line 2, in start.main()
File "C:\Anaconda\envs\py3x\lib\site-packages\spyder\app\start.py", line 104, in main mainwindow.main()
File "C:\Anaconda\envs\py3x\lib\site-packages\spyder\app\mainwindow.py", line 2955, in main or options.optimize)
File "C:\Anaconda\envs\py3x\lib\site-packages\spyder\utils\windows.py", line 33, in set_attached_console_visible
return bool(ShowWindow(console_window_handle, flag[state]))
KeyError: 3

Changing the debug level:

(py3x) set SPYDER_DEBUG=0'
(py3x) C:\Users\wt>spyder.exe --show-console

I get many lines of:
QWindowsFontDataBase::createEngine: CreateFontFromLOGFONT failed()

And whenever spyder was maximized in the previous run I also get one line of:
QWindowsWindow::setGeometry: Unable to set geometry 3780x2220+45+102 on QWidgetWindow/'MainWindowClassWindow'. Resulting geometry: 3780x2088+45+102 (frame: 16, 72, 16, 16, custom margin: 0, 0, 0, 0, minimum size: 368x263, maximum size: 16777215x16777215).

spyder --reset doesn't change the subsequent behaviour.

I have windows 10, anaconda, display 3840x2160 (with 250% size scaling)

Version and main components

  • Spyder Version: 3.0.0.dev0
  • Python Version: 3.5.1
  • Qt Versions: 5.6.0, PyQt5 5.6 on Windows

Dependencies

jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.1 (OK)
nbconvert >=4.0  :  4.1.0 (OK)
numpy >=1.7      :  1.10.4 (OK)
pandas >=0.13.1  :  0.18.0 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pyflakes >=0.6.0 :  1.1.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
pylint >=0.25    :  1.5.4 (OK)
qtconsole >=4.2.0:  4.2.0 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.3.1 (OK)
sympy >=0.7.3    :  1.0 (OK)

@ccordoba12
Copy link
Member

Thanks, but the error in sitecustomize should be printed in our Python consoles, not directly in the terminal where Spyder was started. Please try to take a look there :-)

@stonebig
Copy link
Contributor Author

stonebig commented Sep 17, 2016

activating the console by hand, I see nothing there, but the death of the kernel:
spyder-20160917runfile3

@ccordoba12
Copy link
Member

I don't know then :-/ I don't understand how runfile is not defined. I can't see any error in my Windows tests.

@stonebig
Copy link
Contributor Author

another look, at the sys.path:


import sys

sys.path
Out[4]: 
['',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\lib\\site-packages\\spyder\\utils\\site',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\python35.zip',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\DLLs',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\lib',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\lib\\site-packages',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\lib\\site-packages\\win32',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\lib\\site-packages\\win32\\lib',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\lib\\site-packages\\Pythonwin',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\python-3.5.2\\lib\\site-packages\\IPython\\extensions',
 'C:\\WinPython\\basedir35\\buildQt5\\winpython-32bit-3.5.x.3\\settings\\.ipython']

@stonebig
Copy link
Contributor Author

stonebig commented Sep 17, 2016

there is no possible effect of Matplotlib2.0.0b4 ? (I see in an old changelog "sitecustomize error when using Matplotlib 1.5 with Python 2")

error also there with PyQt4

@ccordoba12
Copy link
Member

Maybe, I haven't tested with Matplotlib 2.0.0b4. Could you test with 1.5.3?

@stonebig
Copy link
Contributor Author

will do. also maybe the kernel initial death is generating new kernel with "runfile" lost ?

@stonebig
Copy link
Contributor Author

stonebig commented Sep 17, 2016

same error with Matplotlib 1.5.3...
will now try with earlier build of Spyder (3.0.0b6) ... b6 works like a charm

@stonebig
Copy link
Contributor Author

a side-remark, First time I start a just created WinPython, Spyder tries to go to internet. never figured why, as I did put the parameter "check for Update on startup" to "False"

@stonebig
Copy link
Contributor Author

stonebig commented Sep 17, 2016

other check: it fails with Spyder-3.0.0b7 official wheel, on Qt5.7.0 Python3.5.2

@ghostcow
Copy link

Hello,

I upgraded to 3.0.0b7 and this issue started immediately
NameError: name 'runfile' is not defined

I'm on Ubuntu 14.04.3

@impact27
Copy link
Contributor

impact27 commented Sep 19, 2016

Idem on OSX 10.11.6
The first thing I see in the IPython console is:
Kernel Died. Restarting.

@impact27
Copy link
Contributor

I also have:
NameError: name 'debugfile' is not defined

@hoogenm
Copy link

hoogenm commented Sep 19, 2016

I had the same problem after upgrading from 3.0.0b4 to 3.0.0b7. The error seemed to disappear when I ran sitecustomize.py manually from within Spyder 3 (from the folder \Python3.4\Lib\site-packages\spyder\widgets\externalshell). I suspect some kind of path error. After adding the folder externalshell folder to the PYTHONPATH in Spyder (through PYTHONPATH manager in the Tools menu), it seems the runfile is not defined error stays away (also after a refresh restart).

@jitseniesen
Copy link
Member

I have the same problem with Spyder version 3.0.0b7 installed with conda. I think the problem is that spyder/utils/site/sitecustomize.py is not installed. I don't understand how the package get built, but comparing the spyder/utils/site subdirectory (which is not installed) with the spyder/utils/external, perhaps the problem is a missing spyder/utils/site/__init__.py file?

When running Spyder from a git clone using bootstrap.py, the error disappears.

@stonebig
Copy link
Contributor Author

stonebig commented Sep 19, 2016

I confirm @jitseniesen suggestion works. I copied spyder/utils/introspection/init.py to spyder/utils/site/init.py and rebuild the wheel, and "runfile" is found again

@yw5aj
Copy link

yw5aj commented Sep 19, 2016

+1 for this problem when installed with conda. I used stonebig's suggestion (git clone, copied spyder/utils/introspection/__init__.py to spyder/utils/site/__init__.py) and used python setup.py install to solve this issue.

@ccordoba12
Copy link
Member

Yes, the problem is the spyder/utils/site directory didn't get packaged because of the lack of an __init__.py file in that dir (as @jitseniesen suggested ;-).

I'll solve this problem right away and release beta8!

@ccordoba12 ccordoba12 modified the milestones: v3.0beta8, v3.0 Sep 20, 2016
@jitseniesen
Copy link
Member

Yes, the problem is the spyder/utils/site directory didn't get packaged because of the lack of an __init__.pyfile in that dir (as @jitseniesen suggested ;-).

It was the comment by @hoogenm that put me on the right track.

@stonebig
Copy link
Contributor Author

stonebig commented Sep 20, 2016

If possibe, it would be nice to have the black DOS window solved in beta8 also (if it's an easy fix)

@ccordoba12
Copy link
Member

@stonebig, It'll be there too :-)

@amine-aboufirass
Copy link

I'm getting this issue in Spyder 3.1.4 with Python 3.6. I checked both spyder/utils/site and spyder/utils/introspection/. Both of these contain the init.py file. I thought this problem was already fixed? How can I fix it now?

@cmbowyer13
Copy link

I'm having the same issue with Spyder 3.2.3 with python 3.6
Traceback (most recent call last):

File "", line 1, in
runfile('/Users/calebbowyer/Documents/Python/HW3_py3.py', wdir='/Users/calebbowyer/Documents/Python')

NameError: name 'runfile' is not defined

@dilip1812
Copy link

IPython >=4.0 : 7.2.0 (OK)
cython >=0.21 : 0.29.2 (OK)
jedi >=0.9.0 : 0.13.2 (OK)
matplotlib >=2.0.0: 3.0.2 (OK)
nbconvert >=4.0 : 5.4.0 (OK)
numpy >=1.7 : 1.15.4 (OK)
pandas >=0.13.1 : 0.23.4 (OK)
psutil >=0.3 : 5.4.8 (OK)
pycodestyle >=2.3 : 2.4.0 (OK)
pyflakes >=0.6.0 : 2.0.0 (OK)
pygments >=2.0 : 2.3.1 (OK)
pylint >=0.25 : 2.2.2 (OK)
qtconsole >=4.2.0 : 4.4.3 (OK)
rope >=0.9.4 : 0.11.0 (OK)
sphinx >=0.6.6 : 1.8.2 (OK)
sympy >=0.7.3 : 1.3 (OK)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests