Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error occurred while communicating with predictive service message. #19

Closed
dablacknerd opened this issue Feb 9, 2017 · 4 comments

Comments

@dablacknerd
Copy link

I deployed a function that performs sentiment analysis to the tabpy server via the tabpy client and i am able to query it, with it returning the expected result via the client using the query method. But when i try to do the same via a calculated field in Tableau:

SCRIPT_REAL("return ('polarity',_arg1)['response']",ATTR([F1]))

I get this error message:

Error processing script
Error when POST /evaluate: Traceback
Traceback (most recent call last):
File "tabpy.py", line 467, in post
result = yield self.call_subprocess(function_to_evaluate, arguments)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "tabpy.py", line 488, in call_subprocess
ret = yield future
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 400, in result
return self.__get_result()
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 359, in __get_result
reraise(self._exception, self.traceback)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_compat.py", line 107, in reraise
exec('raise exc_type, exc_value, traceback', {}, locals
)
File "C:\Users\toguntuga\Anaconda\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures\thread.py", line 61, in run
result = self.fn(*self.args, **self.kwargs)
File "", line 2, in _user_script
KeyError: 'response'
Error type : KeyError
Error message : 'response'

Am i doing something wrong with how i have the calculated field written in tableau?

@BBeran
Copy link
Contributor

BBeran commented Feb 16, 2017

SCRIPT_REAL("return tabpy.query('polarity',_arg1)['response']",ATTR([F1])) is more likely to return results if you have a published endpoint named polarity.

Thank you,

Bora

@BBeran BBeran closed this as completed Feb 16, 2017
@dablacknerd
Copy link
Author

Hi Bora,
I did publish an end point called polarity, following this tutorial https://github.com/tableau/TabPy/blob/master/client.md). After deploying, i tested that i could reach the end point using the query method in a ipython notebook and ipython on the command line. But when i try to reach the end point from within a calculated field in Tableau, i get the error message in my first post.
I have also tried just directly embedding python script in the calculated field and i get the following error:

An error occurred while communicating with the Predictive Service.
Error processing script
Error when POST /evaluate: Traceback
Traceback (most recent call last):
File "tabpy.py", line 467, in post
result = yield self.call_subprocess(function_to_evaluate, arguments)
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\tornado\concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1014, in run
yielded = self.gen.throw(*exc_info)
File "tabpy.py", line 488, in call_subprocess
ret = yield future
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run
value = future.result()
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 400, in result
return self.__get_result()
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_base.py", line 359, in __get_result
reraise(self._exception, self.traceback)
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures_compat.py", line 107, in reraise
exec('raise exc_type, exc_value, traceback', {}, locals
)
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\concurrent\futures\thread.py", line 61, in run
result = self.fn(*self.args, **self.kwargs)
File "", line 3, in _user_script
File "C:\ProgramData\Anaconda2\envs\Tableau-Python-Server\lib\site-packages\textblob-0.11.1-py2.7.egg\textblob\blob.py", line 344, in init
'must be a string, not {0}'.format(type(text)))
TypeError: The text argument passed to __init__(text) must be a string, not <type 'NoneType'>
Error type : TypeError
Error message : The text argument passed to __init__(text) must be a string, not <type 'NoneType'>

Thanks,

Tom

@BBeran
Copy link
Contributor

BBeran commented Feb 18, 2017

Three questions

  1. Were you still getting the error after fixing your calculated field to be
    SCRIPT_REAL("return tabpy.query('polarity',_arg1)['response']",ATTR([F1]))
  2. And what addressing/partitioning settings were you using for the table calculation in either scenario (calling the published endpoint and embedding the code into Tableau)?
  3. What do you see if you drag ATTR(F1) into the view by itself

The issue could be that you are passing a column of Nulls to Python because ATTR() returns *.

@dablacknerd
Copy link
Author

Looks like you were right, when i dragged ATTR(F1) onto the sheet and then the calculated fields, it worked fine. Pardon my user error and thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants