[SOLVED] Episode Trimmer Script - Sonarr Permissions Error?

I’m running sonarr in an Ubuntu 16.04 container and recently added spoatacus’ sonarr-episode-trimmer script to sonarr. The issues page seems abondoned so I thought I’d try my luck here since I understand very little about Python arguments.

Sonarr is running as the root user, but when the script is triggered, I get this in my sonarr log:

Unable to send OnGrab notification to Daily Series Cleaner: ApplicationName='/home/sonarr-trimmer/sonarr-episode-trimmer.py', CommandLine='--config /home/sonarr-trimmer/config --custom-script', 
CurrentDirectory='', Native error= Access denied

It went on to list the Exception:

System.ComponentModel.Win32Exception (0x80004005): ApplicationName='/home/sonarr-trimmer/sonarr-episode-trimmer.py', CommandLine='--config /home/sonarr-trimmer/config --custom-script', CurrentDirectory='', Native error= Access denied
  at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in <2b0d86369d72459baed0cee98a8e578a>:0 
  at System.Diagnostics.Process.Start () [0x0003a] in <2b0d86369d72459baed0cee98a8e578a>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
  at NzbDrone.Common.Processes.ProcessProvider.Start (System.String path, System.String args, System.Collections.Specialized.StringDictionary environmentVariables, System.Action`1[T] onOutputDataReceived, System.Action`1[T] onErrorDataReceived) [0x00194] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Common\Processes\ProcessProvider.cs:186 
  at NzbDrone.Common.Processes.ProcessProvider.StartAndCapture (System.String path, System.String args, System.Collections.Specialized.StringDictionary environmentVariables) [0x00011] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Common\Processes\ProcessProvider.cs:218 
  at NzbDrone.Core.Notifications.CustomScript.CustomScript.ExecuteScript (System.Collections.Specialized.StringDictionary environmentVariables) [0x0001b] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Core\Notifications\CustomScript\CustomScript.cs:139 
  at NzbDrone.Core.Notifications.CustomScript.CustomScript.OnGrab (NzbDrone.Core.Notifications.GrabMessage message) [0x002d7] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Core\Notifications\CustomScript\CustomScript.cs:60 
  at NzbDrone.Core.Notifications.NotificationService.Handle (NzbDrone.Core.Download.EpisodeGrabbedEvent message) [0x000b9] in M:\BuildAgent\work\b69c1fe19bfc2c38\src\NzbDrone.Core\Notifications\NotificationService.cs:108

Using the readme documentation for the script, these are my inputs for the script fields in sonarr
Path: /home/sonarr-trimmer/sonarr-episode-trimmer.py
Arguments: --config /home/sonarr-trimmer/config --custom-script

Can Sonarr access that file?
Is the python file executable?
Have you tried setting the path to execute python and the arguments to be the script + script arguments?

I feel bad using your help here, I was hoping another user had perhaps used the script in Linux :frowning:

I realize it’s a horribly in-advised practice, but the only user I use on my Linux container is root. Sonarr was installed as root, my smb share (where Sonarr’s media is located) is mounted as root, and the python script was added as root.

Based on my limited knowledge of Python I’d assume its executable, but I’m not sure hot to confirm that. The “test” button in sonarr comes back succesful, so I assumed that meant it was executable.

That was actually my original thought of how it should work, since that’s what you would do in Windows, but instead I followed the readme documentation from the git page, and copied the examples in the screen shot.

Is Linux smart enough to know where to find a Python interpreter by virtue of seeing a .py file? The actual Python executable is not currently called anywhere on the path/arguments settings.

It ended up being the url base that I was missing:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.