首页 > 解决方案 > 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

标签: pythonflaskplotlygunicornplotly-dash

解决方案


该函数set_credentials_file尝试将凭据写入以下文件:~/.plotly_credentials.

主文件夹 ( ~) 的权限可能不正确,python 进程无法在此位置写入。

查看进程运行的用户主文件夹的权限。


推荐阅读