FileNotFoundError: [WinError 2] The system cannot find the file specified -Mongo Import
<p>I want to import a large amounts of data using mongoimport (Anaconda -Windows platform).I built a mongoimport command and I used  subprocess.call to execute. </p>

<p>Here is my code</p>

<pre><code> # Build mongoimport command
 collection = cal_data[:cal_data.find(".")]
 #print collection
 working_directory = "/Users/"

 json_file = cal_data + ".json"
 #print json_file
 mongoimport_cmd = "mongoimport --db " + db_name + \
                  " --collection " + collection + \
                  " --file " + working_directory + json_file
 #print mongoimport_cmd 

 # Before importing, drop collection if it exists
  if collection in db.collection_names():
    print ("dropping collection")
    db[collection].drop()

 # Execute the command
 print ("Executing: " + mongoimport_cmd)
 subprocess.call(mongoimport_cmd.split())
</code></pre>

<hr>

<p>Here is the error I get </p>

<h2>Executing: mongoimport --db osm --collection chattanooga --file /Users/chattanooga.osm.json</h2>

<p>FileNotFoundError                         Traceback (most recent call last)
 in ()
     16 # Execute the command
     17 print ("Executing: " + mongoimport_cmd)
---> 18 subprocess.call(mongoimport_cmd.split())</p>

<p>C:\Users\MMedouani\AppData\Local\Continuum\Anaconda3\lib\subprocess.py in call(timeout, *popenargs, **kwargs)
    558     retcode = call(["ls", "-l"])
    559     """
--> 560     with Popen(*popenargs, **kwargs) as p:
    561         try:
    562             return p.wait(timeout=timeout)</p>

<p>C:\Users\MMedouani\AppData\Local\Continuum\Anaconda3\lib\subprocess.py in <strong>init</strong>(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds)
    948                                 c2pread, c2pwrite,
    949                                 errread, errwrite,
--> 950                                 restore_signals, start_new_session)
    951         except:
    952             # Cleanup if the child failed starting.</p>

<p>C:\Users\MMedouani\AppData\Local\Continuum\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1218                                          env,
   1219                                          cwd,
-> 1220                                          startupinfo)
   1221             finally:
   1222                 # Child is launched. Close the parent's copy of those pipe</p>

<p>FileNotFoundError: [WinError 2] The system cannot find the file specified</p>