3

I have an app the uses python shell module from Node.js to run a python script. Works on my local and everything. However when I run it on heroku the path to the python executable is throwing an error where it can't find Python.

I used type -a python on the Heroku console and it returned /usr/bin/python and /app/.heroku/python/bin/python

When I use either of these paths in the python shell options[pythonPath] object key, it doens't work and throws error Error: spawn /app/.heroku/python/bin/python ENOENT

I have the python and nodejs buildpack running.

1 Answer 1

3

create a config var under heroku app settings like,

PYTHONPATH = /usr/bin/python

then use it in your app by,

process.env.PYTHONPATH

where you need it

Hope this helps you

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.