Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 328fd7b

Browse filesBrowse files
committed
add a hack to add a write() method to our fake stdin object to keep e.g. IPython happy
1 parent 5e24f65 commit 328fd7b
Copy full SHA for 328fd7b

1 file changed

+7Lines changed: 7 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bpython/cli.py‎

Copy file name to clipboardExpand all lines: bpython/cli.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import termios
3939
import fcntl
4040
import unicodedata
41+
import errno
42+
4143
from itertools import takewhile
4244
from locale import LC_ALL, getpreferredencoding, setlocale
4345
from optparse import OptionParser
@@ -103,6 +105,11 @@ def __init__(self, interface):
103105
def __iter__(self):
104106
return iter(self.readlines())
105107

108+
def write(self, value):
109+
# XXX IPython expects sys.stdin.write to exist, there will no doubt be
110+
# others, so here's a hack to keep them happy
111+
raise IOError(errno.EBADF, "sys.stdin is read-only")
112+
106113
def isatty(self):
107114
return True
108115

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.