Running python data function on Python service returns error "Error from Remote Service: Bad Request (400) - Data Function was not Trusted"

Running python data function on Python service returns error "Error from Remote Service: Bad Request (400) - Data Function was not Trusted"

book

Article ID: KB0073322

calendar_today

Updated On:

Products

Spotfire Service for Python Spotfire Analyst Spotfire Web Player

Description

Running a Python Data Function on Python Service, either through Spotfire Web Player or on the Spotfire Analyst desktop client with the data function's Run Location set to "Force Server", returns below errors:
------------------------------- 
Error from Remote Service: Bad Request (400) - Data Function was not Trusted

at Spotfire.Dxp.Data.DataFunctions.Executors.RemoteServiceClient.RunFunction(DataFunctionInvocation invocation)
at Spotfire.Dxp.Data.DataFunctions.Executors.PythonScriptExecutor.<ExecuteFunction>d__11.MoveNext()
at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__8.MoveNext()
------------------------------- 

Below error entries are shown in the Python Service logs:
------------------------------------------
INFO 2021-02-16T09:55:24,560 +0100 [5feca3c3-8e00-4b1a-a752-2e39118592b7] topology.engine.EngineQueueHandler: Retrieved pythonsrv-62005-7950a from the queue.
INFO 2021-02-16T09:55:24,582 +0100 [5feca3c3-8e00-4b1a-a752-2e39118592b7] topology.engine.EngineSessionHandler: Opened session 5feca3c3-8e00-4b1a-a752-2e39118592b7 with engine pythonsrv-62005. There are 1 active sessions.
WARN 2021-02-16T09:55:24,840 +0100 [5feca3c3-8e00-4b1a-a752-2e39118592b7] spotfire.topology.PythonTssTrustHandler: The submitted Data Function was not trusted.
---------------------------------

Issue/Introduction

This article provides information on how to resolve the following issue: 'Running python data function on Python service returns error "Error from Remote Service: Bad Request (400) - Data Function was not Trusted"'

Environment

All supported OS

Resolution

To resolve the data function trust issue, you need to trust the data function in Spotfire Analyst, save the trusted data function and the analysis dxp file to the Spotfire library, and open the analysis dxp from the library to run the trusted data functions with the python service.

=================================
1) Open Spotfire Analyst with admin rights >> Tools Menu >> Administration Manager.
2) Groups & Licenses >> Script Author >> Edit Members >> Add your Spotfire User in it.
3) Relaunch the Spotfire Analyst and load the report/analysis file in it and now trust all the data function(s) from File Menu >> Manage trust and Scripts >> Trust All.
4) Now save the trusted data functions and the analysis file to your Spotfire library.
5) Open the analysis dxp from library and run it with your Python Service through Web Player or in Spotfire Analyst with data function "Run Location" as "Force Server".
================================================

You need to make sure the Spotfire user who is going to trust the data function is a member of the "Script Author" group.

Spotfire Administrator by default is NOT a Script Author.

If a Spotfire Administrator user wants to trust the data functions, you also need to add that Spotfire Administrator user to the "Script Author" group.