If a script is not working when run from SAFR Actions, its always a good idea to test the script outside of SAFR Actions.  This enables an easier means of debugging script issues.  If you have done this and the script works fine when when run at the command prompt, then there are a few possible reasons:

  • Arguments passed by SAFR Actions are different than expected
  • Differences in user permissions
  • Command PATH results in different executable than expected 

Below provides some recommendations for troubleshooting each possibility.


Arguments

Make sure the arguments that SAFR Actions is passing are the same as you expect.  A good way to find this out is to look at the SAFR Actions log file.  There you will find the command that SAFR Actions has executed.  Try to copy and paste that command and run it directly on the command line.

SAFR Actions Log File Location:

Windows: C:\ProgramData\RealNetworks\SAFR\ares\logs\ares.log
Linux: /opt/RealNetworks/SAFR/ares/logs/ares.log
macOS: /Library/RealNetworks/SAFR/ares/ares.log


In the log file you will see a line like this:

--> 2020-08-01 13:51:34 0.41sec id: 2D07BA32-7EEB-4442-A51C-17B3D3E8FBB5 Building1 FaceTime HD Camera (Built-in) staff Steve m 50 -> ./scripts/check_activity.py 2D07BA32-7EEB-4442-A51C-17B3D3E8FBB5 "Steve"

You should ensure that the command is properly quoted and can run correctly at the command prompt by copying and pasting it to your terminal or command window.


User Permissions

SAFR Actions will run scripts as Administrator while you may be running your scripts under a specific user account. That difference may result in files not being accessible due to permissions for other reasons.


Try writing output to public shared locations such as C:\Users\Public or /tmp or inside the SAFR Actions directory (i.e. no path).


Command PATH Issues

When running commands in a terminal or script, if an absolute path is not specified, then the shell will find the command by searching thru the PATH.  If you have multiple versions or copies of a command installed you may end up running a different version of that command from SAFR Actions than when you run the same command from the terminal.


You should confirm that the command that is found when run from SAFR Actions is the same as the one you get when you run the script from the terminal.  


If you are using Python, check that the same modules are installed when run from each user.  You can do this by printing the following from your script and logging the output to a file.


pip freeze > requirements.txt