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

fix TypeError: a bytes-like object is required, not "str" error whe… #873

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

liwei-lai
Copy link

Describe

fix TypeError: a bytes-like object is required, not "str" error when handling manager_address argument in the Manager.init method of the manager module.

Example Configuration

{
    "server":"127.0.0.1",
    "server_port":12345,
    "password":"12345678",
    "method":"aes-256-cfb",
    "fast_open":false,
    "manager_address":"127.0.0.1:6001",
}

Traceback

Traceback (most recent call last):
  File "/bin/ssserver", line 11, in <module>
    load_entry_point('shadowsocks', 'console_scripts', 'ssserver')()
  File "shadowsocks/server.py", line 54, in main
    manager.run(config)
  File "shadowsocks/manager.py", line 199, in run
    Manager(config).run()
  File "shadowsocks/manager.py", line 48, in __init__
    if ':' in manager_address:
TypeError: a bytes-like object is required, not 'str'

Fix

add the judgement of decode function for handle the str problem.

if hasattr(manager_address, 'decode'):
    manager_address = manager_address.decode('utf-8')

…n handling manager_address argument in the Manager.__init__ method of the manager module
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 this pull request may close these issues.

2 participants