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

TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple' #78

Closed
cy6erGn0m opened this issue Mar 12, 2016 · 10 comments
Closed

TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple' #78

cy6erGn0m opened this issue Mar 12, 2016 · 10 comments

Comments

@cy6erGn0m
Copy link

sshuttle constantly crashes with

Starting sshuttle proxy.
firewall manager: Starting firewall with Python version 3.4.1
firewall manager: ready method name nat.
IPv6 enabled: False
UDP enabled: False
DNS enabled: False
TCP redirector listening on ('127.0.0.1', 12300).
Starting client with Python version 3.4.1
c : connecting to server...
Traceback (most recent call last):
  File "/usr/bin/sshuttle", line 9, in <module>
    load_entry_point('sshuttle==0.77.2', 'console_scripts', 'sshuttle')()
  File "/usr/lib/python3.4/site-packages/sshuttle/cmdline.py", line 226, in main
    opt.daemon, opt.pidfile)
  File "/usr/lib/python3.4/site-packages/sshuttle/client.py", line 712, in main
    seed_hosts, auto_nets, daemon)
  File "/usr/lib/python3.4/site-packages/sshuttle/client.py", line 421, in _main
    options=dict(latency_control=latency_control))
  File "/usr/lib/python3.4/site-packages/sshuttle/ssh.py", line 88, in connect
    empackage(z, 'sshuttle.server') +
  File "/usr/lib/python3.4/site-packages/sshuttle/ssh.py", line 52, in empackage
    return b'%s\n%d\n%s' % (name.encode("ASCII"), len(content), content)
TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'
cgmachine:/home/cy6ergn0m # 
@vieira
Copy link
Contributor

vieira commented Mar 12, 2016

You are using Python 3.4.x which is not supported. Try with either 2.7 or 3.5. [1] I could fix that problem but likely there will be many others... On the client you have to be root anyway to run sshuttle, can you upgrade python?
For the server, where you don't necessarily have root there is #56.

[1] Client side requirements

@cy6erGn0m
Copy link
Author

I see. Not sure it is safe to upgrade as it is distribution default version: possible damage is unpredictable, perhaps I can add some custom repository

@vieira
Copy link
Contributor

vieira commented Mar 12, 2016

@cy6erGn0m Fedora? Do you have 2.7 and 3.4 or just 3.4? I guess that at least in the situation where there is 2.7 and some unsupported 3.x as default we should fallback to 2.7.

I don't know if there is enough interest in making it work with 3.4 on the client. I did it for the server and I don't think it will ever get merged, which I kind of understand as it is painful to write code and test across all supported OSs and Python versions...

vieira added a commit to vieira/sshuttle that referenced this issue Mar 12, 2016
In situations where 2.7 is available and some unsupported 3.x is the
system's default we should probably fallback to 2.7 instead of the
default (that might be e.g. 3.4). This might fix sshuttle#78.
@brianmay
Copy link
Member

It is possible #79 may not help here. It depends on if/how you are installing sshuttle (e.g. If you are installing it python 3.4 you may need to install it using python 2.7 instead) or if you are invoking it with the ./run command.

@cy6erGn0m
Copy link
Author

@vieira opensuse. I have python 2.7 and 3.4 so fallback would help

@cy6erGn0m
Copy link
Author

In fact I can install 3.5.1 from a "factory repo" but "factory" sounds like something may go wrong :)

@vieira
Copy link
Contributor

vieira commented Mar 14, 2016

Could you test #79?

@brianmay
Copy link
Member

This was marked as fixed in #79, however there are not enough details given as to how sshuttle was started or why it tried to use Python 3.4; so the problem may not be fixed.

@CyberKiller40
Copy link

CyberKiller40 commented Apr 29, 2016

The issue still exists
OpenSUSE 13.2, having both python 2.7 and 3.4, sshuttle installed from pip (v0.78.0)

@brianmay
Copy link
Member

@CyberKiller40 It sounds like you installed sshuttle using the Python 3.4 version of pip; sshuttle does not work with Python 3.4. You will need to install sshuttle using the Python 2.7 version of pip. I don't have a OpenSUSE box to test, however guessing it might be called "pip2.7".

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

Successfully merging a pull request may close this issue.

4 participants