Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

workaround spawnb missing from pexpect.__all__ #1101

Closed
wants to merge 1 commit into from

2 participants

@minrk
Owner

@takluyver's pexpect-u is unicode-ready, and we handle it, but
spawnb is not in __all__ (at least in the 2.5 release), so our
check for it here
fails, and we use the unicode output, calling decode on it directly,
which would raise UnicodeError on things like ls in a dir with unicode files.

This manually assigns pexpect.spawnb, not trusting that it will be included in
from pexpect import *.

@minrk minrk workaround spawnb missing from pexpect.__all__
@takluyver's pexpect-u is unicode-ready, and we handle it, but
spawnb is not in `__all__` (at least in the 2.5 release), so our
check for it [here](https://github.com/ipython/ipython/blob/master/IPython/utils/_process_posix.py#L151)
fails, and we use the unicode output, calling `decode` on it directly,
which would raise UnicodeError on things like `ls` in a dir with unicode files.

This manually assigns `pexpect.spawnb`, not trusting that it will be included in
`from pexpect import *`.
40b5719
@takluyver
Owner

Since there's probably no-one using pexpect-u yet, would it make more sense to just add spawnb to __all__, and then release the corresponding version as 2.5.1?

@minrk
Owner
@takluyver
Owner
@minrk
Owner

That's fine. I'll just close this, noting that IPython requires pexpect-u ≥ 2.5.1.

@minrk minrk closed this
@takluyver
Owner

Released pexpect 2.5.1, equivalent to the version we bundle in IPython.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 4, 2011
  1. @minrk

    workaround spawnb missing from pexpect.__all__

    minrk authored
    @takluyver's pexpect-u is unicode-ready, and we handle it, but
    spawnb is not in `__all__` (at least in the 2.5 release), so our
    check for it [here](https://github.com/ipython/ipython/blob/master/IPython/utils/_process_posix.py#L151)
    fails, and we use the unicode output, calling `decode` on it directly,
    which would raise UnicodeError on things like `ls` in a dir with unicode files.
    
    This manually assigns `pexpect.spawnb`, not trusting that it will be included in
    `from pexpect import *`.
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 IPython/external/pexpect/__init__.py
View
4 IPython/external/pexpect/__init__.py
@@ -1,5 +1,9 @@
try:
import pexpect
from pexpect import *
+ # pexpect-u-2.5 has a spawnb, but version 2.5 excludes it from __all__,
+ # so we must explicitly fetch it
+ if hasattr(pexpect, 'spawnb'):
+ spawnb = pexpect.spawnb
except ImportError:
from _pexpect import *
Something went wrong with that request. Please try again.