title: Python - IOError: [Errno 2] No such file or directory: u'lastid.py' for file in same directory. Works locally, doesn't on Heroku
body: <p>I suspect this is a very newbie question but I can't find any solutions that are helping :( 
  I've been trying to get started with Python by building a simple Twitter bot which replies to people who tweet at it. It worked locally, and it doesn't work on Heroku.</p>
  
  <p>A quick rundown: Each time the bot tweets, it uses a script called mainscript.py which writes the ID of the last tweet replied to into a separate file called lastid.py. The next time the script runs, it opens lastid.py, checks the number inside against the current list of tweets, and only responds to those with a larger ID number than the one stored in lastid.py.</p>
  
  <pre><code>fp = open("lastid.py", 'r')  
  last_id_replied = fp.read()
  fp.close()
  
  #(snipped - the bot selects the tweet and sends it here...)
  
  fp = open("lastid.py", 'w')
  fp.write(str(status.id))
  fp.close()
  </code></pre>
  
  <p>This works great locally. Runs fine. However, when I upload it to Heroku I get this error:</p>
  
  <pre><code>Traceback (most recent call last):                                                                                                                                 
    File "/app/workspace/mainscript.py", line 60, in &lt;module&gt;                                                                                                        
      fp = open("lastid.py", 'r')                                                                                                                                    
  IOError: [Errno 2] No such file or directory: u'lastid.py'  
  </code></pre>
  
  <p>I am absolutely 100% positive lastid.py and mainscript.py are on the server and inside the same directory - I have triple-checked this by running bash on heroku. My .gitignore file is blank so it isn't anything to do with that. </p>
  
  <p>I don't understand why such a simple command as 'open a file in the same directory and read it' doesn't work on the server. What on earth have I done wrong? </p>
  
  <p>(I realise I should have worked through some tutorials before trying to build something custom in a new language, but now I've started this I'd really love to finish it - any help anyone can offer would be very much appreciated.)</p>