Closed jambeshmpt closed 7 years ago
Hi jambeshmpt, Your calculated field has a typo. It is missing the closing parentheses. The following should work.
SCRIPT_REAL( "import numpy as np return np.corrcoef(_arg1,_arg2)[0,1]",SUM([Sales]),SUM([Profit]))
Syntax error when placing the field sentiment score in row shelf .
Error says
An error occurred while communicating with the Predictive Service.
Error processing script
SyntaxError : invalid syntax (
SCRIPT_REAL("from vaderSentiment.vaderSentiment Import SentimentIntensityAnalyzer vs=[] analyzer = SentimentIntensityAnalyzer() for i in range(0,len(_arg1)): a = analyzer.polarity_scores(_arg1[i])['compound'] vs.append(a) return vs", ATTR([Body]))
I see two issues. 1) import should be lower case 2) When writing a loop in Python you need to indent items inside the loop
Can you try the following?
SCRIPT_REAL("from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer analyzer = SentimentIntensityAnalyzer() vs=[] for i in range(0,len(_arg1)): a = analyzer.polarity_scores(_arg1[i])['compound'] vs.append(a) return vs", ATTR([Body]))
Syntax Error after placing the calculated field into view.
1) I was able to setup the tabpy with instruction -worked well 2) I was able to connect to tabpy server from tableau Desktop 10.1 - Connection Successfull 3) Created a calculated field with below info as it is in Documentation - SCRIPT_REAL( "import numpy as np return np.corrcoef(_arg1,_arg2[0,1]",SUM([Sales]),SUM([Profit]))
I was able to create the above Calculated field without any Error.
4) When i drag drop the field into view getting the following error .. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Error processing script Error when POST /evaluate: Traceback Traceback (most recent call last): File "tabpy.py", line 468, in post result = yield self.call_subprocess(function_to_evaluate, arguments) File "C:\Users\ctsuser1\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 1008, in run value = future.result() File "C:\Users\ctsuser1\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\concurrent.py", line 232, in result raise_exc_info(self._exc_info) File "C:\Users\ctsuser1\Anaconda\envs\Tableau-Python-Server\lib\site-packages\tornado\gen.py", line 282, in wrapper yielded = next(result) File "tabpy.py", line 483, in call_subprocess exec(function_to_evaluate) File "", line 3
return np.corrcoef(_arg1,_arg2[0,1]
^
SyntaxError: invalid syntax
Error type : SyntaxError
Error message : invalid syntax (, line 3)
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Tried with all Example but none of the simple example is working and every thing throwing syntax error "An Error Occurred while communicating to predictive service" ... Syntax error in return ... blah blah .
End point Test: I am able to deploy end point no issue here is successful end point deployment