How to run python script without arguments?

I was using Sonarr v2 and with “path” and “arguments” fields, my scripts runs ok.
Now, on version 3 beta without arguments field, I can’t make it run.
I’ve tried so many things, but it didin’t works at all.
I got this error

Invalid request Validation failed: 
-- : Script exited with code: 255

My script haven’t #! line. When I add, I got some others errors (can’t find path, file; errors 127, 2).
I think my problem is so simple, but I can’t figure out a solution.

Running latest V3 beta, on seedbox.

I’m poiting “path” directly to script, following:

Create a .bat/.sh file with your Python location and script in. ie:

Path (on Sonarr): C:\plex_conversions\sickbeard_mp4_automator\sonarrv3.bat

Then in that .bat: "C:\Python3\python.exe" "C:\plex_conversions\sickbeard_mp4_automator\"

Thanks for all those details.
I tried but it only runs via Gentoo ssh, when I execute on sonarr I receive the same error 255.

That’s my file
python /home/username/Archive/

Tried this and works also
/usr/bin/python /home/username/Archive/

My py file have shebang, but if I remove it works anyway.

Followed all those guides

Have you set the script to handle env sonarr_eventtype=“test”?

Here you can view what I’m doing.
My logging trace:
My script:

All that my script do is copy all subtitles from torrent folder or subfolder and rename them with (language) or to same folder of video.mkv file which sonarr copied.

EventType = environ.get('sonarr_eventtype')
#fileSubs.write("\nEventType: "+EventType)
#Event type: Download ##Download or Upgrade, same answer
if EventType == "Test":
    sys.exit("Test event ok")

But before the code reach this part, one file .txt should be created.
I also tested clean code only with creating txt

Shouldn’t that be just sys.exit() because putting a string in there basically returns error code 1.


EventType = environ.get('sonarr_eventtype')
#fileSubs.write("\nEventType: "+EventType)
#Event type: Download ##Download or Upgrade, same answer
if EventType == "Test":

Not working even doing this change.
I’ll try few things, see if there’s something with seedbox.
If I solve this, I’ll come back with the solution, else I’ll revert back to v2.
I appreciate both your helps.

I solved it.

“I have seen this issue when creating scripts in Windows env and then porting over to run on a Unix environment.”

As we can see here:

But I followed the second answer:

Nivin V Joseph
Run following command in terminal

sed -i -e 's/\r$//'

Then try


It should work.

At the end:
That’s my file (which I pointed on “path” field sonarr v3

python ~/Archive/ file didn’t have shebang, directly my code.

Everything works fine!

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