title: FileNotFoundError: [WinError 2] The system cannot find the file specified: 'manage.py' IN PYTHON/DJANGO
body: <p>I have used below code in a thread running background.</p>
  
  <pre><code>os.chdir("MEDIA/" + str(email) + "/" + str(id) + "/")
  os.system("rscript DataSet.R " + str(filename) + " &gt;&gt;logfile.log")
  os.chdir(settings.BASE_DIR)
  </code></pre>
  
  <p>This Error comes sometimes whenever I run my server. I have no clue whats the issue here. Most of the time the code works. I have to use chdir to run my R scripts.</p>
  
  <pre><code>    Traceback (most recent call last):
    File "manage.py", line 22, in &lt;module&gt;
      execute_from_command_line(sys.argv)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\core\management\__init__.py", line 363, in execute_from_command_line
      utility.execute()
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\core\management\__init__.py", line 355, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
      self.execute(*args, **cmd_options)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\core\management\commands\runserver.py", line 62, in execute
      super(Command, self).execute(*args, **options)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\core\management\base.py", line 330, in execute
      output = self.handle(*args, **options)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\core\management\commands\runserver.py", line 101, in handle
      self.run(**options)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\core\management\commands\runserver.py", line 110, in run
      autoreload.main(self.inner_run, None, options)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\utils\autoreload.py", line 332, in main
      reloader(wrapped_main_func, args, kwargs)
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\utils\autoreload.py", line 298, in python_reloader
      reloader_thread()
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\utils\autoreload.py", line 276, in reloader_thread
      change = fn()
    File "C:\Users\MEXSON~1\Desktop\PROJEC~1\TOX2020\MAINWE~1\TOX202~1\lib\site-packages\django\utils\autoreload.py", line 206, in code_changed
      stat = os.stat(filename)
  FileNotFoundError: [WinError 2] The system cannot find the file specified: 'manage.py'
  </code></pre>