4

I'm doing the Heroku walkthrough: https://devcenter.heroku.com/articles/django#prerequisites for python developers, and I get an error when trying to run "git push heroku master", which can be found under the "Deploy to Heroku" section about 1/3 of the way down the page. I get the following traceback:

Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (11/11), 3.71 KiB, done.
Total 11 (delta 0), reused 0 (delta 0)
-----> Python/Django app detected
-----> Preparing Python interpreter (2.7.2)
-----> Creating Virtualenv (1.8.4)
       Also creating executable in .heroku/venv/bin/python
       Installing distribute...done.
       Installing pip...done.
       Running virtualenv with interpreter /usr/local/bin/python2.7
-----> Installing dependencies using pip (1.1)
       Exception:
       Traceback (most recent call last):
         File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py",
line 104, in main
           status = self.run(options, args)
         File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.
py", line 219, in run
           for req in parse_requirements(filename, finder=finder, options=options):
         File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 128
8, in parse_requirements
           req = InstallRequirement.from_line(line, comes_from)
         File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 85,
 in from_line
           elif os.path.isdir(path) and (os.path.sep in name or name.startswith('.')):
         File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/genericpath.py", line 41, in isdir
           st = os.stat(s)
       TypeError: must be encoded string without NULL bytes, not str

       Storing complete log in /app/.pip/pip.log
 !     Heroku push rejected, failed to compile Python/django app

To git@heroku.com:stark-fortress-9694.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:stark-fortress-9694.git'

Everything else had worked successfully to this point. Any insight? I'm completely new to this. Thanks for any help in advance.

Here is what requirements.txt looks like:

Django==1.4.3
distribute==0.6.31
dj-database-url==0.2.1
psycopg2==2.4.5
GetItDone
  • 566
  • 7
  • 22
  • Seems like one of your requirements is failing to install. Could you provide your requirements.txt file? – Thomas Orozco Dec 15 '12 at 23:20
  • 1. Have you run it locally? 2. Have you run it through a linting tool? 3. What sort of test coverage do you have going so far? – bitcycle Dec 15 '12 at 23:22
  • I added Django tag, to bee seen by Django people too .. – Vahid Rafiei Dec 16 '12 at 00:23
  • I edited above to include requirements.txt – GetItDone Dec 16 '12 at 00:58
  • bitcycle... I have run it locally, and I do not know about your other two questions to be honest. Sorry, this is my first project ever worked on (no experience with server ever), just started learning programming a few months ago (learnpythonthehardway.org -> django book ->My own project), self-taught and still not really good. Sorry I can't be of more help for my own question. – GetItDone Dec 16 '12 at 01:08

1 Answers1

12

I think the problem is in the encoding of your requirements.txt file. Probably, you unknowingly saved it in Unicode format. You should save it in ANSI format. See this link for more details: http://georgik.sinusgear.com/2012/08/20/problems-with-deploying-heroku-django-app-from-windows/

Nilanjan Basu
  • 828
  • 9
  • 20
  • I didn't have a problem in my encoding, but I had a package installed from a GitHub repository, and its line in `requirements.txt` was throwing the error. – Aylen Oct 02 '14 at 16:25
  • It solved it for me too. Tip: don't forget to commit again after this fix, I was sure it didn't work because I was pushing without committing the fixed file :) – syonip Nov 25 '15 at 20:30