title: Cannot access a file from worker, but works in the view - [Errno 2] No such file or directory
body: <p>I have followed the tutorial on <a href="https://devcenter.heroku.com/articles/python-rq" rel="nofollow">https://devcenter.heroku.com/articles/python-rq</a></p>
  
  <p>Let's say I have a function that converts PDF Files to JPG and stores them in the app's tmp/file/ and that it later uploads it to S3.</p>
  
  <p>However, since the request timeout is 30s on heroku, I am not able to put this in a View, so I decided to use a background worker to execute the task. So I moved the code to the task but the worker is not able to find the right path.</p>
  
  <p><code>[Errno 2] No such file or directory</code>. I tried printing without luck, but I'm able to print in the function.</p>
  
  <p>The function I tried calling that gives an empty string in the task but gives the right value in the view is<code>sorted(os.listdir('tmp/file/')</code></p>
  
  <p>I searched around and thought that maybe PYTHONPATH variable could be wrong, but everything works via the manage.py</p>
  
  <p>My worker.py looks like this.</p>
  
  <pre><code>import os
  import redis
  import sys
  from rq import Worker, Queue, Connection
  
  listen = ['high', 'default', 'low']
  os.environ['DJANGO_SETTINGS_MODULE'] = 'cinnamon_rest.settings'
  
  redis_url = os.getenv('REDISTOGO_URL', 'redis://localhost:6379')
  
  conn = redis.from_url(redis_url)
  
  if __name__ == '__main__':
      with Connection(conn):
          worker = Worker(map(Queue, listen))
          worker.work()
  </code></pre>
  
  <p>And my manage.py looks like this.</p>
  
  <pre><code>#!/usr/bin/env python
  import os
  import sys
  
  if __name__ == "__main__":
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cinnamon_rest.settings")
  
      from django.core.management import execute_from_command_line
  
      execute_from_command_line(sys.argv)
  </code></pre>