10000 'bytes' object has no attribute 'encode' · Issue #346 · PythonCharmers/python-future · GitHub
[go: up one dir, main page]

Skip to content
'bytes' object has no attribute 'encode' #346
Open
@eljeffeg

Description

@eljeffeg

Future didn't make any changes to this and it doesn't work in py3

os.urandom(self.id_size).encode('hex')

      File "/usr/local/RootTheBox/libs/Sessions.py", line 90, in _generate_session_id
        return os.urandom(self.id_size).encode('hex')
    AttributeError: 'bytes' object has no attribute 'encode'

json.dumps(dump).encode('base64').strip()

  File "/usr/local/RootTheBox/libs/Sessions.py", line 132, in serialize
    return json.dumps(dump).encode('base64').strip()
  File "/usr/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")

Also get "memcache.Client.MemcachedKeyTypeError: Key must be str()'s" which seems related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0