Forums

Installing and using Tableau Hyper API on pythonanywhere

I am hoping to use a web app or website on pythonanywhere to updata a tableau datasource on Tableau Online. Tableau has two API's that are necessary for this Tableau Rest API and Tableau Hyper API. I am new to Python and pythonanywhere.

Here are some links which discuss this - https://help.tableau.com/current/api/hyper_api/en-us/docs/hyper_api_examples.html and https://medium.com/snake-charmer-python-and-analytics/building-and-publishing-tableau-hyper-extracts-with-python-6ad096e7f3f3.

I wasn't making progress in loading and using api's from the general folders, so I create a virtual environment for Python 3.6 following these instructions - https://help.pythonanywhere.com/pages/Virtualenvs. In the virtual environment in the Bash Console I was able to run the pip commands: pip install tableau-api-lib and pip install tableauhyperapi.

But, from there I am unsure how to use any of the sample programs and access the api modules. I tried copying .py files to my environment folder and running them. I also tried creating a notebook in my environment folder and running it. Both times the run got stuck at the from tableau_api_lib import command with the error that it could not find the module.

Here is the command from a cell in the notebook - from tableau_api_lib import TableauServerConnection.

I was following the steps on this page - https://medium.com/snake-charmer-python-and-analytics/tableau-server-on-tap-getting-started-89bc5f0095fa - but using a pythonanywhere notebook rather than a Jupyter Lab notebook.

Thanks for any help.

How are you running the .py file that you copied over? You should make sure that the python you installed tableau into is the same python you are using to run your .py file. See this if you are using the PythonAnywhere editor save and run buttons.

Thank you, that link helped and I was able to get the program to run without any errors.

Great, thanks for confirming it!

Hello, Unfortunately, when I expanded my program, I started getting more errors.

I am using a virtual environment in pythonanywhere. I've uploaded/added the Tableau Hyper API and Rest API modules, as well as the Panda module.

I'm following the code on this page - https://help.tableau.com/current/api/hyper_api/en-us/docs/hyper_api_create_update.html.

The line of code " with Connection(hyper.endpoint, 'TrivialExample.hyper', CreateMode.CREATE_AND_REPLACE) as connection: " is generating an "Exit during startup" with a code 6, no such file or directory.

When I search Google on the issue it list issues like anti-virus software not allowing access to the Temp folder. The hyperd.log file also seems to indicate that it is trying to access the tmp folder. I've added a tmp folder to my virtual environment, but that did not seem to help.

Any thoughts on what the issue might be?

Your account has a tmp folder in /tmp, so it seems unlikely that not having access to the tmp folder would be the issue. Just because an issue has a similar error message does not mean it is necessarily caused by the same thing.