You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might not be IPython's fault, but if there's a file called new.py in the directory I launch trunk IPython from, it won't start.
17:34@new(master)$ ipython
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
Type "copyright", "credits" or "license" for more information.
IPython 0.11.dev -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]:
Do you really want to exit ([y]/n)?
17:34@new(master)$ touch new.py
17:34@new(master)$ ipython
'import site' failed; use -v for traceback
Traceback (most recent call last):
File "/home/pi/.local/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2675, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 662, in subscribe
callback(dist)
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2675, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2180, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1770, in declare_namespace
__import__(parent)
ImportError: No module named pyface
17:34@new(master)$
The text was updated successfully, but these errors were encountered:
I'm not sure which party is to blame for this particular problem, but creating a module that conflicts with a standard library module is always a bad idea. There is already a 'new' module in the standard library (at least in Python 2):
Yup, just like you can't do anything in the mpl directory because it includes a file named 'collections' that conflicts with the stdlib.
I'm closing this because it's an unfortunate aspect of how Python works but nothing we can control/fix/work around in IPython. I really wish Python had done something like C++, where the top-level namespace was empty and the stdlib used std as the namespace. Coupled with 'from foo:` syntax, it would be very nice:
from std:
import sys
import os
import new
from numpy:
import linalg
import rand
etc...
This might not be IPython's fault, but if there's a file called new.py in the directory I launch trunk IPython from, it won't start.
The text was updated successfully, but these errors were encountered: