Jul-08-2023, 05:05 PM
Hi,
this is my first attempt to execute something via CLI using python - I'm totally unexperienced with "subprocesses"...
I'm trying to execute a concatenation of 2 pngs into 1 pdf via python using the commandline.
Therefore I'm using naps2.
Executing it manually it works...
Here is the example:
Here is the python code:
https://stackoverflow.com/questions/1167...-arguments
I'm trying to avoid "shell=True" because of security problems, which could occur.
What can I do?
It would be great, if you could help me out...
Thanks...
this is my first attempt to execute something via CLI using python - I'm totally unexperienced with "subprocesses"...
I'm trying to execute a concatenation of 2 pngs into 1 pdf via python using the commandline.
Therefore I'm using naps2.
Executing it manually it works...
Here is the example:
C:\Program Files\NAPS2>naps2.console -i "D:\Daten\aktuell\test\1.png;D:\Daten\aktuell\test\2.png" -n 0 --output "D:\Daten\aktuell\test\gut.pdf"But when launching over cli it is said "An unexpected error occurs."
Here is the python code:
import subprocess subprocess.run(["C://Program Files//NAPS2//naps2.console.exe", "-i", '"D://Daten//aktuell//test//1.png;D://Daten//aktuell//test//2.png"', "-n", "0", "--output", '"D://Daten//aktuell//test//gut3.pdf"'], shell=False)I read online that you have to pass the arguments as single strings (shell=false).
https://stackoverflow.com/questions/1167...-arguments
I'm trying to avoid "shell=True" because of security problems, which could occur.
What can I do?
It would be great, if you could help me out...
Thanks...