PHP exec/passthru/system produces different result than executing manually from command line, why?

I am currently trying to launch a print from localhost/php by doing an exec/passthru/system on a python script

php part:


<?php
passthru('C:UsersUserAppDataLocalProgramsPythonPython38python.exe C:gsprint.py', $output); 
?> 

python part:


#!/usr/bin/env python
import win32print
import win32api
import requests

PDFXC = "C:Program FilesTracker SoftwarePDF ViewerPDFXCview.exe"

LOCAL_FILE = "C:/gs/label.pdf"
currentprinter = "BIXOLON SRP-770II"
url='https://www.myserver.com/mydata/label.pdf'
r = requests.get(url, stream=True)
with open(LOCAL_FILE, 'wb') as f:
    f.write(r.content)
params = ' /printto "'+currentprinter+'" "'+LOCAL_FILE+'"'
print(params);
win32api.ShellExecute(0, 'open', PDFXC, params, '.',0) 

xampp / windows

And now to the weird part, executing the python script from **windows cmd ** everything prints as it should, executing it from PHP no matter if by exec, passthru or system. The print is missing parts or with a different document 3 empty pages are “printed” after each page.

WHY? Basically PHP shouldn’t do anything else than me executing the python script manually from command line ?