Forum >> Programmazione Python >> Files e Directory >> problemi con subprocess

Pagina: 1

Non riesco a capire dov'è l'errore nel seguente codice:



import os

import xml.etree.ElementTree as ET

import glob

import subprocess


folder = os.getcwd()+'/scaricati'

os.chdir(folder)


files = glob.glob('*.xml.p7m', recursive = False)

for file in files:

#print('*********************************************************')

nomeFile = file

print(nomeFile)

print(folder)



#res = subprocess.run('openssl smime -decrypt -verify -inform DER -in %s -noverify' % file, stdout=subprocess.PIPE)

#s = res.stdout



filea=subprocess.run("openssl smime -verify -inform DER -in %s -noverify -no_attr_verify" %file, stdout=subprocess.PIPE)


fileXML = ET.parse(filea)

myroot = fileXML.getroot()

codice = myroot.find('.//FatturaElettronicaHeader/DatiTrasmissione/IdTrasmittente/IdCodice').text

print(codice)








e il terminale visualizza:




IT01879020517A2023 aXN6n.xml.p7m
/home/utente/Desktop/p7mExtr/scaricati
Traceback (most recent call last):
File "/home/utente/Desktop/p7mExtr/leggiXML.py", line 19, in <module>
filea=subprocess.run("openssl smime -verify -inform DER -in %s -noverify -no_attr_verify" %file, stdout=subprocess.PIPE)
File "/usr/lib/python3.10/subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'openssl smime -verify -inform DER -in IT01879020517A2023 aXN6n.xml.p7m -noverify -no_attr_verify'




Per favore, qualcuno, mi può aiutare ?



Pagina: 1



Esegui il login per scrivere una risposta.