old_contents: import io
  import os
  
  from ConfigParser import RawConfigParser
  
  
  def apply_env():
      """
      Read the `.env` file and apply it to os.environ just like using `foreman
      run` would.
      """
      env = '[root]\n' + io.open('.env', 'r').read()
  
      config = RawConfigParser(allow_no_value=True)
  
      # Use `str` instead of the regular option transform to preserve option case
      config.optionxform = str
      config.readfp(io.StringIO(env), '.env')
  
      os.environ.update(config.items('root'))
  
new_contents: import io
  import os
  
  from ConfigParser import RawConfigParser
  
  
  def apply_env():
      """
      Read the `.env` file and apply it to os.environ just like using `foreman
      run` would.
      """
      try:
          env = '[root]\n' + io.open('.env', 'r').read()
      except IOError:
          return
  
      config = RawConfigParser(allow_no_value=True)
  
      # Use `str` instead of the regular option transform to preserve option case
      config.optionxform = str
      config.readfp(io.StringIO(env), '.env')
  
      os.environ.update(config.items('root'))
  
subject: Fix crash if .env does not exist