Repository navigation
Description
Describe the bug
Error "TypeError: cannot serialize None" in sample login.py.
Versions
Details of your environment, including:
- Tableau Server OnPremise, version: 2021.2.2, CentOS Linux release 7.9.2009, with AD auth and SAML configured.
- Python version: 3.6.8
- TSC library version: ## 0.17.0 (20 October 2021)
To Reproduce
Run the command: "python3 login.py -s http://localhost -u schaffer" without quotes.
Results
[schaffer@tableau-srv samples]$ python3 login.py -s http://localhost -u schaffer
Password:
Signing in...
Server: http://localhost
Site: None
Username: schaffer
Traceback (most recent call last):
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 1079, in _escape_attrib
if "&" in text:
TypeError: argument of type 'NoneType' is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "login.py", line 59, in
main()
File "login.py", line 43, in main
with server.auth.sign_in(tableau_auth):
File "/home/tableauadmin/.local/lib/python3.6/site-packages/tableauserverclient/server/endpoint/endpoint.py", line 163, in wrapper
return func(self, *args, **kwargs)
File "/home/tableauadmin/.local/lib/python3.6/site-packages/tableauserverclient/server/endpoint/auth_endpoint.py", line 28, in sign_in
signin_req = RequestFactory.Auth.signin_req(auth_req)
File "/home/tableauadmin/.local/lib/python3.6/site-packages/tableauserverclient/server/request_factory.py", line 68, in signin_req
return ET.tostring(xml_request)
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 1135, in tostring
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 776, in write
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 941, in _serialize_xml
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 941, in _serialize_xml
short_empty_elements=short_empty_elements)
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 933, in _serialize_xml
v = _escape_attrib(v)
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 1102, in _escape_attrib
_raise_serialization_error(text)
File "/usr/lib64/python3.6/xml/etree/ElementTree.py", line 1057, in _raise_serialization_error
"cannot serialize %r (type %s)" % (text, type(text).name)
TypeError: cannot serialize None (type NoneType)
[schaffer@tableau-srv samples]$
Activity
Accept `None` as parameter for the `site_id` of `TableauAuth` and `Pe…
vogelsgesang commentedon Oct 22, 2021
well, that was an unnecessary regression in our sample scripts 😢
Turns out that currently, if you don't pass in a
--siteparameter, the script doesn't work.I didn't notice, though, because I always tested against Tableau Online and Tableau Online always uses sites.
For the time being you should be able to work around this by passing in a
--siteparameter until we get the fix shippedschaffer-gb commentedon Oct 22, 2021
Hi Adrian,
Thank you for the reply, you guys that collaborate to this project are legends.
Unfortunately I cannot login passing a --site value, as my server does not have any site. Passing value Default or None returns auth error.
For what I understood, you already fixed it applying the changes in this link : vogelsgesang@2e953ce
Looks pretty simple. If I do it locally, will it allow me to skip --site parameter?
schaffer-gb commentedon Oct 22, 2021
I tried it and it didn't solve... I'll wait for the shipped fix. Thanks.
vogelsgesang commentedon Oct 22, 2021
It should have solved the issue. I am surprised it did not... Seems we will have to take another look.
An alternative fix would be to change
to
directly in
login.pyAccept `None` as parameter for the `site_id` of `TableauAuth` and `Pe…
Accept `None` as parameter for the `site_id` of `TableauAuth` and `Pe…