I need to run an external script (is not possible modify this) in order to manag a CLOB data and insert in table.
But if I use the os.system
in a loop, only 1 record is inserted in the table, if I add a time.sleep(20)
between call, all works fine.
I try to use a subprocess, but the instruction is very big and the command return Errno 36 filename too long
.
In this case only the last record has been inserted:
for element in list:
query = 'INSERT IN TABLE1 VALUES(<clob>)'
rc = os.system('externalScript.py -q "' + query.encode('utf-8') + '"')
In this case the subprocess return filename too long
:
for element in list:
query = 'INSERT IN TABLE1 VALUES(<clob>)'
proc = subprocess.Popen(['python', 'externalScript.py -q "' + query.encode('utf-8') + '"' ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
Is there a solution without adding time.sleep(20)
after os.system
?