Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Python 3 compatibility / porting. #116

Open
robputt opened this issue Mar 16, 2018 · 5 comments
Open

Python 3 compatibility / porting. #116

robputt opened this issue Mar 16, 2018 · 5 comments
Assignees

Comments

@robputt
Copy link
Collaborator

robputt commented Mar 16, 2018

No description provided.

@robputt
Copy link
Collaborator Author

robputt commented Mar 16, 2018

Does Twisted Conch support Py3 now?

@robputt robputt self-assigned this Mar 16, 2018
@robputt
Copy link
Collaborator Author

robputt commented Mar 16, 2018

Last upstream commit seems to be from 14th September 2016, is Twisted dead?

@robputt
Copy link
Collaborator Author

robputt commented Mar 16, 2018

Seems Twisted Conch is not yet Py3 capable...

2018-03-16 10:25:52+0000 [twisted.conch.ssh.factory.SSHFactory] Unhandled Error
Traceback (most recent call last):
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/internet/selectreactor.py", line 149, in _doReadOrWrite
why = getattr(selectable, method)()
--- ---
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/internet/tcp.py", line 1073, in doRead
protocol.makeConnection(transport)
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/internet/protocol.py", line 510, in makeConnection
self.connectionMade()
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/conch/ssh/transport.py", line 543, in connectionMade
self.sendKexInit()
File "/Users/robe8437/Documents/Python/envs/general_dev/lib/python3.6/site-packages/twisted/conch/ssh/transport.py", line 565, in sendKexInit
NS(b','.join(self.supportedPublicKeys)),
builtins.TypeError: sequence item 0: expected a bytes-like object, str found

Maybe we can subclass it and override methods that require updating? < @tnich @Bifrozt @bang-uin thoughts?

@sturmf
Copy link

sturmf commented Oct 15, 2018

Any news on this, I get this with Twisted 18.7.0 and Python3.

@sturmf
Copy link

sturmf commented Oct 15, 2018

Ok I stand corrected it does work!
But now you have to prefix a lot of the strings with b for a byte array. E.g. the key looks now like this:

publicKeys = {
    b'ssh-rsa': keys.Key.fromString(data=sshkeys.SERVER_PUBLIC_KEY)
}

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

No branches or pull requests

2 participants