In einem Script, das mit aller Regelmäßigkeit gestartet wird, starte ich eine Javaprozess um eine CSV an ein URL hochzuladen. Dazu starte ich den Prozess wie folgt
Code: Alles auswählen
out = subprocess.run(['java', '-jar', 'uploadtool.jar', '-H', 'https://URL.de/', '-U',
user_name, '-P', passwort , '-M', 'Listen', '-p', '"Infos"', '-v',
doc_id, file_name], check=True, stdout=subprocess.PIPE, universal_newlines=True)
Ich sehe dann halt nur
Code: Alles auswählen
"INFO de.uploadtool - have 1 projects\nINFO de.uploadtool - have 1 files\nERROR d... "
Hier mal die vollständige Ausgabe
Code: Alles auswählen
subprocess.CalledProcessError: Command '['java', '-jar', 'uploadtool.jar', '-H', 'https://url.de/', '-U', 'username', '-P', 'geheimespasswort', '-M', 'Liste', '-p', '"System"', '-v', 'docf964671', 'liste_26_1_2021_11_25.csv']' returned non-zero exit status 2.
2021-01-26T11:26:43.204343+0100 An error has been caught in function '<module>', process 'MainProcess' (1), thread 'MainThread' (140533234947968):
Traceback (most recent call last):
> File "//listenexport.py", line 439, in <module>
main()
└ <function main at 0x7fd066bb8158>
File "//listenexport.py", line 426, in main
upload_code = upload_to_host(file_name, args.pos)
│ │ │ └ 'musterstadt'
│ │ └ Namespace(output='/', pos='musterstadt')
│ └ '/liste_26_1_2021_11_25.csv'
└ <function upload_to_host at 0x7fd066bb5400>
File "//listenexport.py", line 297, in upload_to_host
doc_id, file_name], check=True, stdout=subprocess.PIPE, universal_newlines=True)
│ │ │ └ -1
│ │ └ <module 'subprocess' from '/opt/rh/rh-python36/root/usr/lib64/python3.6/subprocess.py'>
│ └ 'liste_26_1_2021_11_25.csv'
└ 'docf964671'
File "/opt/rh/rh-python36/root/usr/lib64/python3.6/subprocess.py", line 438, in run
output=stdout, stderr=stderr)
│ └ None
└ 'INFO de.uploadtool - have 1 projects\nINFO de.uploadtool - have 1 files\nERROR d...
subprocess.CalledProcessError: Command '['java', '-jar', 'uploadtool.jar', '-H', 'https://url/', '-U', 'username', '-P', 'geheimespasswort', '-M', 'liste', '-p', '"System"', '-v', 'docf964671', 'liste_26_1_2021_11_25.csv']' returned non-zero exit status 2.