Skip to content
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

Pexpect update: AttributeError: type object 'spawn' has no attribute 'crlf' #1

Open
entropyqueen opened this issue Nov 2, 2015 · 1 comment

Comments

@entropyqueen
Copy link

Since last pexpect update, I am having a traceback with binexpect

Traceback (most recent call last):
  File "sploit.py", line 19, in <module>
    target.prompt()
  File "/usr/lib/python3.5/binexpect.py", line 200, in prompt
    if binmixin: self.setnlcr()
  File "/usr/lib/python3.5/binexpect.py", line 143, in setnlcr
    mode[TLIST.OFLAG] = mode[TLIST.OFLAG] | termios.ONLCR
  File "/usr/lib/python3.5/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/usr/lib/python3.5/binexpect.py", line 127, in changemode
    self.setmode(fd, when, mode)
  File "/usr/lib/python3.5/binexpect.py", line 101, in setmode
    self.crlf = pexpect.spawn.crlf
AttributeError: type object 'spawn' has no attribute 'crlf'

My python version is 3.5
And I'm using the latest version of pexpect, which is the 4.0.1

Also, I checked the sources of pexpect version 4.0.1, the spawn class you are using inherits from SpawnBase, which does have a 'crlf' attribute. The 'crlf' attribute is set in SpawnBase's constructor, which is call by spawn using super().

Basically, we just need to instanciate the pexpect.spawn class.
That being said, I don't know what command should be given to pexpect in order to make that work properly.

@wapiflapi
Copy link
Owner

FTR this is probably the commits upstream that introduced this behavior. jeberger/pexpect@ce1e181

I'm pretty sure we could just drop the monkey patching now that this is "fixed" upstream. We'll only really loose the ability to set it to something different than the default for the OS which shouldn't be done this way anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants