Terrtiary
Terrtiary

Reputation: 191

Path to Python Executable on Heroku

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.

Upvotes: 3

Views: 649

Answers (1)

adibro500
adibro500

Reputation: 171

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

Upvotes: 3

Related Questions