TypeError: six.StringIO(resp.content) must be str or None, not bytes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.vmware |
Fix Released
|
Undecided
|
Haifeng.Yan |
Bug Description
using the example from https:/
output:
# python vmware.py
/root/haven/
InsecureReque
Traceback (most recent call last):
File "vmware.py", line 65, in <module>
vmware = VirtualMachine(
File "vmware.py", line 57, in __init__
retries=0.1, interval=10)
File "vmware.py", line 50, in __init__
self.sess = get_session(host, username, password, retries, interval)
File "vmware.py", line 19, in get_session
interval,
File "/root/
self.
File "/root/
return evt.wait()
File "/root/
return hubs.get_
File "/root/
return self.greenlet.
File "/root/
idle = self.f(*self.args, **self.kw)
File "/root/
result = f(*args, **kwargs)
File "/root/
return f(*args, **kwargs)
File "/root/
session_manager = self.vim.
File "/root/
pool_
File "/root/
pool_maxsize)
File "/root/
cache=_CACHE)
File "/root/
self.wsdl = reader.open(url)
File "/root/
d = self.fn(url, self.options)
File "/root/
d = reader.open(url)
File "/root/
d = self.download(url)
File "/root/
fp = self.options.
File "/root/
return six.StringIO(
TypeError: initial_value must be str or None, not bytes
summary: |
- TypeError: initial_value must be str or None, not bytes + TypeError: six.StringIO(resp.content) must be str or None, not bytes |
description: | updated |
Changed in oslo.vmware: | |
assignee: | nobody → Haifeng.Yan (yanheven) |
Changed in oslo.vmware: | |
status: | New → Fix Released |
in py2, using requests, type(response. conten) =unicode, six.StringIO( resp.content) is fine. conten) =byte, six.StringIO( resp.content) will raise TypeError: initial_value must be str or None, not bytes.
but in py3, type(response.
suggest: resp.content) instead.
in py3, use six.BytesIO(