Skip to content

"TypeError: cannot serialize None" in login.py #924

Closed

Description

@schaffer-gb

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

  1. added a commit that references this issue on Oct 22, 2021
    2e953ce
  2. vogelsgesang commented on Oct 22, 2021

    @vogelsgesang
    Collaborator

    well, that was an unnecessary regression in our sample scripts 😢

    Turns out that currently, if you don't pass in a --site parameter, 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 --site parameter until we get the fix shipped

  3. schaffer-gb commented on Oct 22, 2021

    @schaffer-gb
    Author

    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?

  4. schaffer-gb commented on Oct 22, 2021

    @schaffer-gb
    Author

    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?

    I tried it and it didn't solve... I'll wait for the shipped fix. Thanks.

  5. vogelsgesang commented on Oct 22, 2021

    @vogelsgesang
    Collaborator

    Looks pretty simple. If I do it locally, will it allow me to skip --site parameter?

    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

    parser.add_argument('--site', '-S', help='site name')
    

    to

    parser.add_argument('--site', '-S', help='site name', default='')
    

    directly in login.py

  6. added
    in-progress
    on Nov 9, 2021
  7. added a commit that references this issue on Jan 28, 2022
    ce781da
  8. added a commit that references this issue on Mar 30, 2022
    31554c5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfixedin-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions