I first open a cmd window, then run the script. The lines are not truncated. Everything lives on a single line.
It works if I copy/paste/run each line manually.
As a work-around, I’ll just use a second Python script to launch each line.
Thank you.
Edit: I think I found what it is: Filenames must not contain accented characters (“é”, “à”, etc.), or if they do, they must be in ASCII not ANSI/UTF8 or cmd won’t find them because it does no conversion on the fly.
Also, if it fails loading a file on one line because it didn’t find it/couldn’t load because of the accents, it looks like the rest won’t be loaded
For some reason, commands run fine when running each line manually. So the issue occurs specifically when ran from a cmd file.
Edit: Here’s the Python script to read the list of files, and launch SumatraPDF:
import os
import sys
import subprocess
APP = "C:\Program Files\SumatraPDF\SumatraPDF.exe"
arguments = len(sys.argv) - 1
if arguments != 1:
print ("Must pass file with list of files to open.")
sys.exit()
with open(sys.argv[1]) as reader:
for line in reader:
command = f'"{APP}" -reuse-instance "{line}"'
print(subprocess.run(f"{command}", shell=True))