what's wrong with the code below:
command_assembly = f'{self.INPUT_ASSEMBLY_SRC}{self.file} ' \
f'{self.ASSEMBLER} {self.ONLY_ASSEMBLY} {self.MIN_PARAMS} ' \
f'{self.CUT_OFF} {cutoff} '\
f'-o out'
result = subprocess.run([self.APP_ASSEMBLY, command_assembly], capture_output=True, text=True)`
In my tests, the run method seems to only capture one parameter and not the entire string that contains multiple parameters. Remembering that running in the terminal everything works perfectly with the string above.
If your code was as follows:
command_assembly = f'{a} {b} {c}'
result = subprocess.run([self.APP_ASSEMBLY, command_assembly], capture_output=True, text=True)`
You would be calling self.APP_ASSEMBLY
with only one argument, which would be the values of a
, b
and c
separated by spaces.
This is different from what you almost certainly want, 3 arguments, which would be accomplished like this:
command_assembly = [f'{a}', f'{b}', f'{c}']
result = subprocess.run([self.APP_ASSEMBLY, ...command_assembly], capture_output=True, text=True)`
The code you provided, once corrected, would then look like this:
command_assembly = [f'{self.INPUT_ASSEMBLY_SRC}{self.file}',
f'{self.ASSEMBLER}', f'{self.ONLY_ASSEMBLY}', f'{self.MIN_PARAMS}',
f'{self.CUT_OFF}', f'{cutoff}',
'-o', 'out']
result = subprocess.run([self.APP_ASSEMBLY, *command_assembly], capture_output=True, text=True)`
Further explanation can be found here.