amc pyw script subprocess.run error

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
aktersnurra95
Posts: 17
Joined: 11 May 2019, 11:13

amc pyw script subprocess.run error

Post by aktersnurra95 »

Hi, I get an error when trying to run my rename script, I believe it use to work before though I got most of it from a backup of my script since I lost my original one so I don't remember if I had to change something for it to work.
This is my script.

Code: Select all

import sys
import subprocess

# configuration
output = 'D:/Plex Media Server'

# custom formats (use / instead of \ as directory separator)
movieFormat  = "D:/Plex Media Server/Movies/{n.replaceTrailingBrackets().colon(' - ')}{' ('+y+')'}/{n.replaceTrailingBrackets().colon(' - ')}{' ('+y+')'}{' (Part '+pi+')'}{' ['+{source+'-'+vf}+{' '+vc}+{' '+ac}+{' '+bitdepth+'bit'}+']'}{'.'+lang}"
seriesFormat = "D:/Plex Media Server/Series/{n.replaceTrailingBrackets().colon(' - ')}{' ('+y+')'}{' [tvdb-'+id+']'}/{'Season ' + s}/{n.replaceTrailingBrackets().colon(' - ')}{' ('+y+')'}{' - '+s00e00.lower()}{' - '+t.colon(' - ')}{' ['+{source+'-'+vf}+{' '+vc}+{' '+ac}+{' '+bitdepth+'bit'}+']'}{' ['+group+']'}{'.'+lang}"
animeFormat  = "D:/Plex Media Server/Anime/{primarytitle.colon(' - ')}{' [anidb-'+id+']'}/{primarytitle.colon(' - ')}{' - S' + special.pad(3)}{' - E' + absolute.pad(3)}{' - '+t.colon(' - ')}{audioLanguages =~ ',' ? ' [Dual Audio]' : null}{' ['+vf+' '+bitdepth+'bit'+']'}{' ['+group+']'}"

# required args
label, state, title, kind, file, directory = sys.argv[1:7]

command = [
	'filebot', '-script', 'fn:amc',
	'--output', output,
	'--action', 'duplicate',
	'--conflict', 'index',
	'-non-strict',
	'--log-file', 'D:/Other/Filebot-amc.log',
	'--def',
		'unsorted=y',
		'movieFormat='  + movieFormat,
		'seriesFormat=' + seriesFormat,
		'animeFormat='  + animeFormat,
		'ut_label=' + label,
		'ut_state=' + state,
		'ut_title=' + title,
		'ut_kind='  + kind,
		'ut_file='  + file,
		'ut_dir='   + directory
]

# execute command only for certain conditions (disabled by default)
if label == "Anime" or label == "TV" or label == "Movie":
    # execute command (and hide cmd window)
    subprocess.run(command, creationflags=0x08000000)
else:
    print('Aborting due to label: ' + label)
    sys.exit(0)
And the error I get when running in cmd.

Code: Select all

Microsoft Windows [Version 10.0.19041.450]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Python\Python37>python "D:\Other\Filebot-qBittorrent.pyw" "Movie" "5" "Avatar" "multi" "" "X:\Files\Avatar"
Traceback (most recent call last):
  File "D:\Other\Filebot-qBittorrent.pyw", line 35, in <module>
    subprocess.run(command)
  File "C:\Python\Python37\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Python\Python37\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

C:\Python\Python37>
would appreciate some guidance as I can't get it work with different python versions or editing my script.
aktersnurra95
Posts: 17
Joined: 11 May 2019, 11:13

Re: amc pyw script subprocess.run error

Post by aktersnurra95 »

Just realized the unedited script from the amc post won't work either, so someething is wrong elsewere...
any idea what might becausing it?
aktersnurra95
Posts: 17
Joined: 11 May 2019, 11:13

Re: amc pyw script subprocess.run error

Post by aktersnurra95 »

Jeeeesus christ I'm so f**** stupid.
I had forgot to install filebot

Thanks anyway!!!! xD
User avatar
rednoah
The Source
Posts: 22994
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: amc pyw script subprocess.run error

Post by rednoah »

Code: Select all

...
File "C:\Python\Python37\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
This error message probably means to say that it can't execute the specified executable, because the specified executable does not exist. :lol:
:idea: Please read the FAQ and How to Request Help.
Post Reply