我试图以png图像格式下载Tableau Workbook,并使用tableauserverclient使用来自GitHub的示例:https://github.com/tableau/server-client-python/blob/master/samples/download_view_image.py。但是我从上面得到了错误。我想我可能还需要导入更多内容,我只导入tableauserverclient。有人知道我做错了什么吗?
相关代码:
import argparse
import getpass
import logging
import tableauserverclient as TSC
image_req_option = TSC.ImageRequestOptions (imageresolution=TSC.ImageRequestOptions.Resolution.High)
server.views.populate_image(view_item, image_req_option)
with open(args.filepath, "wb") as image_file:
image_file.write(view_item.image)
print("View image saved to {0}".format(args.filepath))`
完整错误消息:
Traceback (most recent call last):
File "pdf2.test.py", line 69, in <module>
main()
File "pdf2.test.py", line 59, in main
image_req_option = TSC.ImageRequestOptions(imageresolution=TSC.ImageRequestO ptions.Resolution.High)
AttributeError: 'module' object has no attribute 'ImageRequestOptions'