New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: AttributeError: 'error' object has no attribute 'errno' #38

merged 4 commits into from Feb 7, 2014


None yet
2 participants

mattprintz commented Feb 4, 2014

This fixes an issue I am encountering where 'errno' is not an attribute of the 'select.error' class. This preserves the behavior should the errno attribute exist, but allows the old behavior (changed in commit efa531a on 2013-12-30) to continue to function.

I got this issue when using pexpect3.1 on python2.7.3 and passing a SIGWINCH via signal after running interact

In short: I resize my window, pexpect causes program to crash

File "/home/mprintz/temp/pexpect3/local/lib/python2.7/site-packages/pexpect/", line 1690, in __select
if err.errno == errno.EINTR:
AttributeError: 'error' object has no attribute 'errno'


This comment has been minimized.


takluyver commented Feb 5, 2014

Rats, I merged #33 assuming that the same thing would work in Python 2, but it looks like although OSError got an errno attribute, select.error didn't. We might be able to use err.args[0] on both versions, though.

Whatever we do, can I ask you to add a test that covers the exception handling code, so that we don't break this again? I think it will need to start a subprocess which is sets a SIGALRM for itself and then waits in a __select call for some input that won't come. Here's some playing around with code interactively:

In [12]: def noop(x, y):
   ....:     pass

In [13]: signal.signal(signal.SIGALRM, noop)
Out[13]: 1

In [14]: signal.alarm(5)
Out[14]: 0

In [15]:[1],[],[])
InterruptedError                          Traceback (most recent call last)
<ipython-input-15-ce00e451633d> in <module>()
----> 1[1],[],[])

InterruptedError: [Errno 4] Interrupted system call

This comment has been minimized.


mattprintz commented Feb 6, 2014

I simplified the code to use args as you suggested, and have added a test.

This tests that the child process can set and get the windows size.
This makes use of an external script

This comment has been minimized.


takluyver Feb 6, 2014


Thanks, but can you update the docstring to describe what this actually tests? Also, sinch doesn't mean anything. And both the test and the script are misnamed, because they do nothing with sigwinch at all. The test is for interrupting a select() system call, and the script simply pauses for two seconds.


This comment has been minimized.


mattprintz commented Feb 7, 2014

I have moved around and updated the testing scripts to make them fit in better, make more sense, and be properly documented.


This comment has been minimized.


takluyver commented Feb 7, 2014

Thanks, that looks good. Merging.

takluyver added a commit that referenced this pull request Feb 7, 2014

Merge pull request #38 from mattprintz/master
Bug: AttributeError: 'error' object has no attribute 'errno'

@takluyver takluyver merged commit a97f580 into pexpect:master Feb 7, 2014

1 check passed

default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment