i'm trying import json file command : mongoimport -c collection -d db < file.json
. when call command shell, every documents imported. however, when try call python script module subprocess : subprocess.call('mongoimport -c collection -d db < file.json', shell=true)
, have following error: failed: error processing document #37: unexpected eof
. can explain me why work shell not when called script please?
thanks in advance.
i thing because subprocess.popen constructor accepts list of args, not string, this:
p = subprocess.popen(['mongoimport', '--db', 'autoprivilege', '-c','cars', 'stockvo.json', '--jsonarray', '--upsert','--drop'])...
Comments
Post a Comment