python - Plotly file permission error in production
问题描述
I recently moved a plotly chart in flask environment to production using gunicorn
.
For some reason I get the following error:
return _bootstrap._gcd_import(name[level:], package, level)
File "/var/www/html/dir/flask-gentelella/app/home/routes.py", line 27, i
n <module>
plotly.tools.set_credentials_file(username='users', api_key='abc4')
File "/home/ec2-user/anaconda3/lib/python3.7/site-packages/plotly/tools.py", l
ine 130, in set_credentials_file
raise exceptions.PlotlyError("You don't have proper file permissions "
plotly.exceptions.PlotlyError: You don't have proper file permissions to run this function.
I'm not able to rectify it since this is does not happen in virtual environment
Please guide
解决方案
该函数set_credentials_file
尝试将凭据写入以下文件:~/.plotly_credentials
.
主文件夹 ( ~
) 的权限可能不正确,python 进程无法在此位置写入。
查看进程运行的用户主文件夹的权限。
推荐阅读
- python - 根据 std 过滤多索引 df
- android - 连接充电器时运行代码后台
- amazon-web-services - 需要为 3 个云提供商 AWS、GCP、阿里巴巴创建集中式 DNS/LDAP
- google-apps-script - 将一行内容导出到具有一定结构的文本文件中
- robotframework - 无法从测试用例运行 shell 脚本
- python - 将表导入 DataFrame 并将列组设置为列表
- python - 使用 BeautifulSoup 抓取 Tripadvisor 评论时出现 ValueError
- postgresql - 不接受嵌入对象的空值
- php - 按用户评论过滤 - SQL 参数数量必须在 0 到 65535 之间
- android - 如何创建以 JSON 格式提供响应的 API