title: ./manage.py shell > update_db.py deletes the contents of the file
body: <p>In my Django project I have a couple of methods I manually call time to time for testing purposes, but lately something strange is happening. Whenever I try to run a function in the context of my Django app:</p>
  
  <pre><code>./manage.py shell &gt; scraper/update_db.py
  </code></pre>
  
  <p>it overwrites the contents of "update_db.py" with this:</p>
  
  <pre><code>&gt;&gt;&gt;
  </code></pre>
  
  <p>I've tried creating arbitrary python files with simple print statements, but same happens to all of them. My current update_db.py looks like this:</p>
  
  <pre><code>def consistency_check():
      # removed my code with print statement
      print('Hello')
  
  consistency_check()
  </code></pre>
  
  <p>Any ideas what is happening? I guess it's worth mentioning that I'm working in Pycharm and when I import my functions in python console, it's working just fine in there:</p>
  
  <pre><code>from scraper import update_db
  update_db.consistency_check()
  # Runs smoothly
  </code></pre>
  
  <p><strong>Update:</strong>
  Contents of manage.py</p>
  
  <pre><code>#!/usr/bin/env python
  import os
  import sys
  
  if __name__ == "__main__":
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Enigma.settings")
      try:
          from django.core.management import execute_from_command_line
      except ImportError as exc:
          raise ImportError(
              "Couldn't import Django. Are you sure it's installed and "
              "available on your PYTHONPATH environment variable? Did you "
              "forget to activate a virtual environment?"
          ) from exc
      execute_from_command_line(sys.argv)
  </code></pre>