Skip to content

AttributeError: module 'tableauserverclient' has no attribute 'ExcelRequestOptions' #1122

Closed

Description

@jtsai01-bsc

Describe the bug
AttributeError: module 'tableauserverclient' has no attribute 'ExcelRequestOptions'

Versions
Details of your environment, including:

  • Tableau Server version 2022.1.6
  • Python version v.3.9
  • TSC library version 0.20

To Reproduce
python C:\Users\jxxxx01\Downloads\Tableau\Tidal\server-client-python-master\samples\export.v.1.0.py -s http://tabxxxx.mybsc.com --site "" -u svcUser --xlsx -f “C:\Users\jxxxx01\Downloads\Tableau\Installation_and_Billing\LEP-python.xlsx” 8834ac6b-xxxx-xxxx-xxxx-xxxx

Results
Signing in...
Server: http://tabxxxx.mybsc.com
Site:
Username: svcUser
Connected
Item found: Group Calpers LEP Dashboard
Traceback (most recent call last):
File "C:\Users\jxxxx01\Downloads\Tableau\Tidal\server-client-python-master\samples\export.v.1.0.py", line 127, in
main()
File "C:\Users\jxxxx01\Downloads\Tableau\Tidal\server-client-python-master\samples\export.v.1.0.py", line 105, in main
option_factory = getattr(TSC, option_factory_name)
AttributeError: module 'tableauserverclient' has no attribute 'ExcelRequestOptions'

Activity

  1. bcantoni commented on Sep 25, 2022

    @bcantoni
    Contributor

    @jtsai01-bsc could you show the code in your export.v.1.0.py script that's failing? The library version of export.py doesn't include an Excel option, so I'm assuming you've added that.

  2. jtsai01-bsc commented on Sep 26, 2022

    @jtsai01-bsc
    Author

    @jtsai01-bsc could you show the code in your export.v.1.0.py script that's failing? The library version of export.py doesn't include an Excel option, so I'm assuming you've added that.

    1. The class ExcelRequestOptions(RequestOptionsBase) is in C:\Tableau\Tidal\server-client-python-master\tableauserverclient\server\request_options.py,
    2. The populate_excel(self, view_item: ViewItem, req_options: Optional["ExcelRequestOptions"] = None) and _get_view_excel(self, view_item: ViewItem, req_options: Optional["ExcelRequestOptions"]) are in C:\Tableau\Tidal\server-client-python-master\tableauserverclient\server\endpoint\views_endpoint.py,
    3. Please see the attached export.v.1.0.txt.
      export.v.1.0.txt
  3. bcantoni commented on Sep 26, 2022

    @bcantoni
    Contributor

    Did a little more digging here. Support for populate_excel for views was added in #968. It looks like it's not fully functional because ExcelRequestOptions isn't included in the proper init places:

    $ python
    Python 3.9.7 (default, Aug 31 2021, 14:25:50)
    [Clang 12.0.0 (clang-1200.0.32.21)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tableauserverclient as TSC
    >>> TSC.CSVRequestOptions
    <class 'tableauserverclient.server.request_options.CSVRequestOptions'>
    >>> TSC.ExcelRequestOptions
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: module 'tableauserverclient' has no attribute 'ExcelRequestOptions'

    @jorwoods would you mind taking a look at this? I notice the test you added also had a copy/paste error where it was still referencing the CSV request options, so that's probably why this was missed.

  4. jtsai01-bsc commented on Sep 26, 2022

    @jtsai01-bsc
    Author

    Did a little more digging here. Support for populate_excel for views was added in #968. It looks like it's not fully functional because ExcelRequestOptions isn't included in the proper init places:

    $ python
    Python 3.9.7 (default, Aug 31 2021, 14:25:50)
    [Clang 12.0.0 (clang-1200.0.32.21)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tableauserverclient as TSC
    >>> TSC.CSVRequestOptions
    <class 'tableauserverclient.server.request_options.CSVRequestOptions'>
    >>> TSC.ExcelRequestOptions
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: module 'tableauserverclient' has no attribute 'ExcelRequestOptions'

    @jorwoods would you mind taking a look at this? I notice the test you added also had a copy/paste error where it was still referencing the CSV request options, so that's probably why this was missed.

    Thank you, Brian and Jorwoods!

    Please let me know when i can download the new version of TSC library and try the ExcelRequestOptions.

  5. jorwoods commented on Sep 26, 2022

    @jorwoods
    Contributor

    @jtsai01-bsc Technically, you can use it now if you import it directly, manually.

    from tableauserverclient.server.request_options import ExcelRequestOptions
  6. jtsai01-bsc commented on Sep 26, 2022

    @jtsai01-bsc
    Author
    TSC.ExcelRequestOptions

    Sorry, Jorwoods. Can you please add more detail and step.
    I add this to export.py; however i am getting the same error.

    import argparse
    import logging

    import tableauserverclient as TSC
    from tableauserverclient.server.request_options import ExcelRequestOptions

  7. jorwoods commented on Sep 27, 2022

    @jorwoods
    Contributor

    Nevermind. I forgot it was an internal reference error and not that you were trying to access it, but couldn't.

  8. jorwoods commented on Sep 28, 2022

    @jorwoods
    Contributor

    0.23 was released that contains the fix.

  9. jtsai01-bsc commented on Sep 28, 2022

    @jtsai01-bsc
    Author

    Awesome. Thank you so much! I will wait for v.0.23.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions