Home > database >  /app/.heroku/python/bin/python: /app/.heroku/python/bin/python: cannot execute binary file
/app/.heroku/python/bin/python: /app/.heroku/python/bin/python: cannot execute binary file

Time:03-10

When I tried running

heroku run bash python manage.py migrate --app appName

from my terminal using the Heroku CLI, I get below error/response;

/app/.heroku/python/bin/python: /app/.heroku/python/bin/python: cannot execute binary file

CodePudding user response:

I was finally able to get around this by first getting into bash on heroku, then running the command I wish to. Steps are listed below;

  1. I open my terminal and using the heroku-cli, I ran heroku run bash --app appName
  2. You should see the bash shell loaded if this execute successfully, looking something like ~ $
  3. Now go ahead and manually enter your command, in this case python manage.py migrate which should work.
  4. Just a tip -- if that doesn't still work (or you're just curious to see your file directory) you can go ahead and list out the different dirs to see where your manage.py file is before going into that correct dir and running your command again. Use ls -l $(ls) or find . -maxdepth 3 -type d -ls or simply ls -l

CodePudding user response:

This command doesn't make sense:

heroku run bash python manage.py migrate --app appName

Let's break it down:

  • heroku run ... --app appName tells Heroku to run the stuff in ... on the app appName
  • python manage.py migrate is the command you want to run on your dyno:
    • python is the executable
    • manage.py is the file Python executes
    • migrate is an argument passed to manage.py
  • bash... doesn't do anything useful here

In fact, you are telling Heroku to run bash python manage.py migrate, where you run bash and pass it python manage.py migrate as arguments. Since python is not a shell script, bash cannot execute it.

Lose the bash:

heroku run python manage.py migrate --app appName
  • Related