Python2.7: TypeError: Cannot mix str and non-str arguments

Bug #1662893 reported by Lucas Alvares Gomes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-redfish
New
Undecided
Unassigned

Bug Description

Running python-redfish on Python2 is raising the following error as part of the connect() method: TypeError: Cannot mix str and non-str arguments.

It works fine on Python3.5 tho

LOG:

(venv) [fedora@localhost tmp]$ python
Python 2.7.13 (default, Jan 12 2017, 17:59:37)
[GCC 6.3.1 20161221 (Red Hat 6.3.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import redfish
>>> redfish.connect('http://localhost:8001/redfish/v1', '', '', simulator=True, enforceSSL=False, verify_cert=False)
Initialize python-redfish
Certificat is not checked, this is insecure and can allow a man in the middle attack
Root url : http://localhost:8001/redfish/v1
------------------------------------------------------------
Url: http://localhost:8001/redfish/v1
Header: {u'Origin': 'http://localhost:8001', u'OData-Version': u'4.0', u'Content-type': u'application/json', u'Accept': u'application/json', u'User-Agent': u'python-redfish'}
------------------------------------------------------------
Executing GET request:
    URL: http://localhost:8001/redfish/v1
    headers: {u'Origin': 'http://localhost:8001', u'OData-Version': u'4.0', u'Content-type': u'application/json', u'Accept': u'application/json', u'User-Agent': u'python-redfish'}
    query: {}
    data: None

   GET: Headers: Host: localhost:8001
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: python-redfish
Origin: http://localhost:8001
OData-Version: 4.0
Content-type: application/json

127.0.0.1 - - [07/Feb/2017 02:46:39] "GET /redfish/v1 HTTP/1.1" 200 -
Got 200 OK:
    {<email address hidden>': u'#ServiceRoot.v1_0_2.ServiceRoot', u'Tasks': {<email address hidden>': u'/redfish/v1/TaskService'}, u'Managers': {<email address hidden>': u'/redfish/v1/Managers'}, u'UUID': u'92384634-2938-2342-8820-489239905423', u'Links': {u'Sessions': {<email address hidden>': u'/redfish/v1/SessionService/Sessions'}}, u'AccountService': {<email address hidden>': u'/redfish/v1/AccountService'}, u'EventService': {<email address hidden>': u'/redfish/v1/EventService'}, u'RedfishVersion': u'1.0.2', <email address hidden>': u'/redfish/v1/', <email address hidden>': u'/redfish/v1/$metadata#ServiceRoot', u'Chassis': {<email address hidden>': u'/redfish/v1/Chassis'}, <email address hidden>': u'Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright.', u'Systems': {<email address hidden>': u'/redfish/v1/Systems'}, u'Oem': {}, u'SessionService': {<email address hidden>': u'/redfish/v1/SessionService'}, u'Id': u'RootService', u'Name': u'Root Service'}

{ <email address hidden>': u'Copyright 2014-2016 Distributed Management Task Force, Inc. (DMTF). For the full DMTF copyright policy, see http://www.dmtf.org/about/policies/copyright.',
    <email address hidden>': u'/redfish/v1/$metadata#ServiceRoot',
    <email address hidden>': u'/redfish/v1/',
    <email address hidden>': u'#ServiceRoot.v1_0_2.ServiceRoot',
    u'AccountService': { <email address hidden>': u'/redfish/v1/AccountService'},
    u'Chassis': { <email address hidden>': u'/redfish/v1/Chassis'},
    u'EventService': { <email address hidden>': u'/redfish/v1/EventService'},
    u'Id': u'RootService',
    u'Links': { u'Sessions': { <email address hidden>': u'/redfish/v1/SessionService/Sessions'}},
    u'Managers': { <email address hidden>': u'/redfish/v1/Managers'},
    u'Name': u'Root Service',
    u'Oem': { },
    u'RedfishVersion': u'1.0.2',
    u'SessionService': { <email address hidden>': u'/redfish/v1/SessionService'},
    u'Systems': { <email address hidden>': u'/redfish/v1/Systems'},
    u'Tasks': { <email address hidden>': u'/redfish/v1/TaskService'},
    u'UUID': u'92384634-2938-2342-8820-489239905423'}
API Version : 1.02
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/python-redfish/venv/lib/python2.7/site-packages/redfish/main.py", line 153, in connect
    verify_cert=verify_cert
  File "/tmp/python-redfish/venv/lib/python2.7/site-packages/redfish/main.py", line 242, in __init__
    mapping.redfish_mapper.map_sessionservice()),
  File "/tmp/python-redfish/venv/lib/python2.7/site-packages/redfish/types.py", line 82, in get_link_url
    return urljoin(self.url, link)
  File "/tmp/python-redfish/venv/lib/python2.7/site-packages/future/backports/urllib/parse.py", line 418, in urljoin
    base, url, _coerce_result = _coerce_args(base, url)
  File "/tmp/python-redfish/venv/lib/python2.7/site-packages/future/backports/urllib/parse.py", line 115, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments
>

Revision history for this message
Uggla (rene-ribaud) wrote :

Hello Lucas,

First thanks for all the bug reports. I will try to look at them ASAP.
Can you please just let me know the simulator and python-redfish release you used.
This will probably help me to reproduce the bug.

Revision history for this message
Lucas Alvares Gomes (lucasagomes) wrote :
Revision history for this message
Uggla (rene-ribaud) wrote :

OK thanks. What about python-redfish ?

FYI, I have not tested against simulator v1.0. So that may explain I have not seen the bug so far.

Revision history for this message
Lucas Alvares Gomes (lucasagomes) wrote :

Hi Renne,

The python-redfish was installed from source, master branch HEAD.

Changed in python-redfish:
milestone: none → 0.6
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.