question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Script exited with code: 1

See original GitHub issue

Describe the bug Somehow I can’t connect the postSonar.py and postRadarr script to my Sonarr and Radarr respectively. I created a postSonar.bat script to pass postSonar.py as an argument, but I keep getting Script exited with code: 1 error. The manual.py is working as expected, so I don’t think is my autoProcess.ini config fault

Yes, I’ve read all related issues and tried them, but couldn’t find a way to solve it.

Command or context you are trying to run The postSonar.bat script is as it follows:

"C:\Users\Home Server\AppData\Local\Programs\Python\Python311\python.exe" "C:\Users\Home Server\Downloads\sickbeard_mp4_automator-master\sickbeard_mp4_automator-master\postSonarr.py"

autoProcess.ini settings

[Converter]
ffmpeg = C:\Users\Home Server\Downloads\ffmpeg-master-latest-win64-gpl\ffmpeg-master-latest-win64-gpl\bin\ffmpeg.exe
ffprobe = C:\Users\Home Server\Downloads\ffmpeg-master-latest-win64-gpl\ffmpeg-master-latest-win64-gpl\bin\ffprobe.exe
threads = 0
hwaccels = 
hwaccel-decoders = 
hwdevices = 
hwaccel-output-format = 
output-directory = 
output-directory-space-ratio = 0.0
output-format = mp4
output-extension = mp4
temp-extension = 
minimum-size = 0
ignored-extensions = nfo, ds_store,mp4
copy-to = 
move-to = 
delete-original = True
process-same-extensions = False
bypass-if-copying-all = True
force-convert = False
post-process = False
wait-post-process = False
detailed-progress = False
opts-separator = ,
preopts = 
postopts = 
regex-directory-replace = [^\w\-_\. ]

[Permissions]
chmod = 0644
uid = -1
gid = -1

[Metadata]
relocate-moov = True
full-path-guess = True
tag = False
tag-language = 
download-artwork = False
sanitize-disposition = 
strip-metadata = False
keep-titles = True

[Video]
codec = h264, x264
max-bitrate = 0
bitrate-ratio = 
crf = -1
crf-profiles = 
preset = 
codec-parameters = 
dynamic-parameters = False
max-width = 0
profile = 
max-level = 0.0
pix-fmt = 
prioritize-source-pix-fmt = True
filter = 
force-filter = False

[HDR]
codec = 
pix-fmt = 
space = bt2020nc
transfer = smpte2084
primaries = bt2020
preset = 
codec-parameters = 
filter = 
force-filter = False
profile = 

[Audio]
codec = ac3
languages = 
default-language = 
include-original-language = True
first-stream-of-language = False
channel-bitrate = 128
variable-bitrate = 0
max-bitrate = 0
max-channels = 2
filter = 
profile = 
force-filter = False
sample-rates = 
sample-format = 
copy-original = False
aac-adtstoasc = False
ignored-dispositions = 
force-default = False
unique-dispositions = False
stream-codec-combinations = 

[Audio.Sorting]
sorting = language, channels.d, map, d.comment
default-sorting = channels.d, map, d.comment
codecs = 

[Universal Audio]
codec = aac
channel-bitrate = 128
variable-bitrate = 0
first-stream-only = False
filter = 
profile = 
force-filter = False

[Audio.ChannelFilters]

[Subtitle]
codec = mov_text
codec-image-based = 
languages = eng,por
default-language = 
include-original-language = False
first-stream-of-language = False
encoding = 
burn-subtitles = False
burn-dispositions = 
embed-subs = True
embed-image-subs = False
embed-only-internal-subs = False
filename-dispositions = forced
ignore-embedded-subs = False
ignored-dispositions = 
force-default = False
unique-dispositions = False
attachment-codec = 
remove-bitstream-subs = False

[Subtitle.Sorting]
sorting = language, d.comment, d.default.d, d.forced.d
codecs = 
burn-sorting = language, d.comment, d.default.d, d.forced.d

[Subtitle.CleanIt]
enabled = False
config-path = 
tags = 

[Subtitle.FFSubsync]
enabled = False

[Subtitle.Subliminal]
download-subs = False
download-forced-subs = False
include-hearing-impaired-subs = False
providers = 

[Subtitle.Subliminal.Auth]

[Sonarr]
host = localhost
port = 8989
apikey = *********
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False

[Radarr]
host = localhost
port = 7878
apikey = *********
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False

[Sickbeard]
host = localhost
port = 8081
ssl = False
apikey = 
webroot = 
username = 
password = 

[Sickrage]
host = localhost
port = 8081
ssl = False
apikey = 
webroot = 
username = 
password = 

[SABNZBD]
convert = True
sickbeard-category = sickbeard
sickrage-category = sickrage
sonarr-category = sonarr
radarr-category = radarr
bypass-category = bypass
output-directory = 
path-mapping = 

[Deluge]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
host = localhost
port = 58846
username = 
password = 
output-directory = 
remove = False
path-mapping = 

[qBittorrent]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
action-before = 
action-after = 
host = localhost
port = 8080
ssl = False
username = *********
password = *********
output-directory = 
path-mapping = 

[uTorrent]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
webui = False
action-before = 
action-after = 
host = localhost
ssl = False
port = 8080
username = 
password = 
output-directory = 
path-mapping = 

[Plex]
host = localhost
port = 32400
refresh = False
token = 


Log files

2022-11-28 10:16:31.5|Debug|Api|[GET] /api/v3/command: 200.OK (0 ms)
2022-11-28 10:16:31.6|Debug|Api|[GET] /api/v3/command: 200.OK (0 ms)
2022-11-28 10:16:51.7|Debug|Api|[GET] /api/v3/filesystem?path=C%3A%5CUsers%5CHome%20Server%5CDownloads%5CpostSonarr.bat&allowFoldersWithoutTrailingSlashes=true&includeFiles=true: 200.OK (34 ms)
2022-11-28 10:17:01.5|Debug|Api|[GET] /api/v3/command: 200.OK (0 ms)
2022-11-28 10:17:44.7|Debug|CustomScript|Executing external script: C:\Users\(removed)\Downloads\postSonarr.bat
2022-11-28 10:17:44.7|Debug|cmd.exe|Starting cmd.exe /c C:\Users\(removed)\Downloads\postSonarr.bat 
2022-11-28 10:17:44.8|Error|cmd.exe|'C:\Users\(removed)
2022-11-28 10:17:44.8|Error|cmd.exe|operable program or batch file.
2022-11-28 10:17:44.8|Debug|CustomScript|Executed external script: C:\Users\(removed)\Downloads\postSonarr.bat - Status: 1
2022-11-28 10:17:44.8|Debug|CustomScript|Script Output: 
11/28/2022 11:17:44 AM - Error - 'C:\Users\(removed)
2022-11-28 10:17:44.8|Warn|SonarrErrorPipeline|Invalid request Validation failed: 
 -- : Script exited with code: 1
2022-11-28 10:17:44.8|Debug|Api|[POST] /api/v3/notification/test: 400.BadRequest (220 ms)
2022-11-28 10:17:55.9|Debug|Api|[GET] /api/v3/health: 200.OK (0 ms)

FFMpeg headers

ffmpeg version N-109235-g1009396953-20221127 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20221127
  libavutil      57. 43.100 / 57. 43.100
  libavcodec     59. 54.100 / 59. 54.100
  libavformat    59. 34.102 / 59. 34.102
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 50.101 /  8. 50.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Hyper fast Audio and Video encoder

System Information

  • OS: Windows 10 Pro
  • Python version 3.11

Expected behavior A successful connection between postSonarr.py/postRadarr.py and with Sonarr and Radarr. From what I’ve read, postSonarr/postRadarr is suposed to send code 0 in order to pass the testing function and be able to be saved.

Additional context I’ve checked all the dependencies, and they seam to work fine

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mdhigginscommented, Nov 30, 2022

I’d say based on that and your Sonarr logs the batch file isn’t running.

2022-11-28 10:17:44.7|Debug|cmd.exe|Starting cmd.exe /c C:\Users\(removed)\Downloads\postSonarr.bat 
2022-11-28 10:17:44.8|Error|cmd.exe|'C:\Users\(removed)
2022-11-28 10:17:44.8|Error|cmd.exe|operable program or batch file.

Does that folder that you’re censoring here have a space in it? It almost seems like Sonarr isn’t handling that space in the path well and its failing to open

Can you try moving the batch file to somewhere without a space in the path? I wouldn’t think Sonarr should have any issues with this but the way the error is displayed kind of suggests that

The other thought if that’s not the case, is this a weird permission issue? You’re running things from a users download directory but maybe Sonarr isn’t being run by the same user or can’t access that folder for whatever reason

Edit: Actually it might be Sonarr that’s censoring that folder name cause it looks like “Home Server” is the folder from earlier in your post, in which case my theory about the space remains

0reactions
B1NT0Ncommented, Nov 30, 2022

Yes, indeed, the space in the path was the problem. The easiest solution I found was to create a symbolic link as indicated in this answer

Thanks for helping me troubleshoot this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix 'Terminated With Exit Code 1' Error - Komodor
Exit Code 1 indicates that a container shut down, either because of an application failure or because the image pointed to an invalid...
Read more >
Receiving Script exit code: 1 and U... - Jamf Nation Community
Script exit code: 1 means that one of the commands returned an error when attempting to complete. The error: Script result: No matching...
Read more >
Meaning of exit status 1 returned by linux command
The only general convention is that a zero exit status signifies success, whereas any non-zero exit status is a failure.
Read more >
What is the meaning of exit 0, exit 1, and exit 2 in a bash script?
Any return code greater than 0 indicates an error of some sort, though sometimes the error isn't critical, for each command it should...
Read more >
Script failed with exit code: 1 - Microsoft Q&A
I am using the following Azure CLI to deploy a web App deploy command is timing out with error ##[error]Script failed with exit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found