Skip to content
This repository

workaround spawnb missing from pexpect.__all__ #1101

Closed
wants to merge 1 commit into from

2 participants

Min RK Thomas Kluyver
Min RK
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 *.

Min RK 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
Thomas Kluyver
Collaborator

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?

Min RK
Owner
Thomas Kluyver
Collaborator
Min RK
Owner

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

Min RK minrk closed this December 04, 2011
Thomas Kluyver
Collaborator

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

Showing 1 unique commit by 1 author.

Dec 04, 2011
Min RK 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
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. 4  IPython/external/pexpect/__init__.py
4  IPython/external/pexpect/__init__.py
... ...
@@ -1,5 +1,9 @@
1 1
 try:
2 2
     import pexpect
3 3
     from pexpect import *
  4
+    # pexpect-u-2.5 has a spawnb, but version 2.5 excludes it from __all__,
  5
+    # so we must explicitly fetch it
  6
+    if hasattr(pexpect, 'spawnb'):
  7
+        spawnb = pexpect.spawnb
4 8
 except ImportError:
5 9
     from _pexpect import *
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.