Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

<UPDATE> Never did get IPython3 to work under Windows, but I did manage to get it to work on my local CentOS server (after much frustration) by eventually discovering the absolutely indispensable virtualenv tool. Not sure if virtualenv would work its magic on Windows as well, but I'm content for now using IPython via SSH. </UPDATE>

I'm new to Python and decided to dive in with Python 3.2. I love that the language comes with a built-in interactive interpreter, but I'm looking for something more full-featured, and IPython looks like it fits the bill. I installed Distribute and used to following command from my C:\Python32\Scripts\ directory to get the egg:

easy_install http://archive.ipython.org/release/0.11/py3/ipython-0.11-py3.2.egg

This completed successfully, although the output has since gone beyond my scrollback threshold so I can't produce it here. I ran ipython3 --help and produced the help screen, so I know that at least part of it has installed correctly. However, when I execute ipython3 I get the following error:

$ ipython3
Error in sys.excepthook:
TypeError: _isdir() takes exactly 1 argument (0 given)

Original exception was:
Traceback (most recent call last):
  File "c:\Python32\Scripts\ipython3-script.py", line 9, in <module>
    load_entry_point('ipython==0.11', 'console_scripts', 'ipython3')()
  File "C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\frontend\terminal\ipapp.py", line 369, in launch_new_instance
    app.initialize()
  File "C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\frontend\terminal\ipapp.py", line 283, in initialize
    self.init_shell()
  File "C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\frontend\terminal\ipapp.py", line 303, in init_shell
    ipython_dir=self.ipython_dir)
  File "C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\config\configurable.py", line 295, in instance
    inst = cls(*args, **kwargs)
  File "C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\frontend\terminal\interactiveshell.py", line 112, in __init__
    user_global_ns=user_global_ns, custom_exceptions=custom_exceptions
  File "C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\core\interactiveshell.py", line 384, in __init__
    self.db = PickleShareDB(os.path.join(self.profile_dir.location, 'db'))
  File "C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\utils\pickleshare.py", line 52, in __init__
    if not self.root.isdir():
TypeError: _isdir() takes exactly 1 argument (0 given)

Other than --help I haven't yet found any other arguments that don't produce this error. I grepped for "_isdir" in C:\Python32\lib\site-packages\ipython-0.11-py3.2.egg\IPython\ and found only two references to it, in a file called tempdir.py, both shown here:

# XXX (ncoghlan): The following code attempts to make
# this class tolerant of the module nulling out process
# that happens during CPython interpreter shutdown
# Alas, it doesn't actually manage it. See issue #10188
_listdir = staticmethod(_os.listdir)
_path_join = staticmethod(_os.path.join)
_isdir = staticmethod(_os.path.isdir)
_remove = staticmethod(_os.remove)
_rmdir = staticmethod(_os.rmdir)
_os_error = _os.error

def _rmtree(self, path):
    # Essentially a stripped down version of shutil.rmtree.  We can't
    # use globals because they may be None'ed out at shutdown.
    for name in self._listdir(path):
        fullname = self._path_join(path, name)
        try:
            isdir = self._isdir(fullname)

And grepping the same directory for "isdir" returns about 100 matches; about 50% of these use 1 argument, the rest 0. I'm not sure if this is a problem with inheritance or scope or what, nor do I have any idea what the importance of the preceding underscore is. Googling "TypeError: _isdir()" returns no matches whatsoever.

Any ideas?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Finally decided to give this another stab, and managed to get it to work. The solution is a two-line change in the ipython-0.11-py3.2.egg\IPython\utils\pickleshare.py file, line 52:

Before:

if not self.root.isdir():
    self.root.makedirs()

After:

if not os.path.isdir(self.root):
    os.makedirs(self.root)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.