python - How to spawn Python process from Heroku Node
问题描述
Am trying to execute a Python script from node. It's hitting the endpoint, and runs fine locally but when I try deploy from Heroku, I get the following error log:
```
2018-10-10T01:00:14.689410+00:00 app[web.1]: events.js:183
2018-10-10T01:00:14.689416+00:00 app[web.1]: throw er; // Unhandled 'error' event
2018-10-10T01:00:14.689417+00:00 app[web.1]: ^
2018-10-10T01:00:14.689419+00:00 app[web.1]:
2018-10-10T01:00:14.689421+00:00 app[web.1]: Error: spawn python3.6 ENOENT
2018-10-10T01:00:14.689424+00:00 app[web.1]: at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
2018-10-10T01:00:14.689426+00:00 app[web.1]: at onErrorNT (internal/child_process.js:362:16)
2018-10-10T01:00:14.689428+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:139:11)
```
I tried setting the Python runtime in runtime.txt in the root directory:
```
$ cat runtime.txt
python-3.6.0
```
解决方案
To answer my own question, the reason was I needed to add the Python buildpack alongside the NodeJS buildback. Discussed here: https://stackoverflow.com/a/39947385/3268182
推荐阅读
- javascript - material-ui-dropzone,DropzoneAreaBase 不显示添加的文件预览
- r - 从 Shiny 应用程序生成可下载的报告
- javascript - JavaScript:根据对象属性中的空间拆分数组中的对象
- sql - 加密 SQL Server 中视图列(非表)中的数据
- python - 有人知道如何一次下载一个文件吗
- powershell - 多个文件名称中的Powershell偏移数,由常量表示
- java - Java] 如何按科目计算平均分(使用 ArrayList)
- php - 从角度检索多部分/表单数据到laravel php RESTfull api
- javascript - 质数检查 (JavaScript)
- oracle - 我应该如何编写用于使用 sqlldr 命令将文本文件数据加载到 Mysql 表中的控制文件?