存取雲端google試算表,必須要有credentials.json檔案,
程式中的位置大致如下
gc = pygsheets.authorize(service_account_file='credentials.json')
問題:
使用 pyinstaller 打包後,無法順利執行exe檔,
會顯示 FileNotFoundError:No such file or directory
解決:
pyinstaller.exe -F -w --onefile --collect-data pygsheets xxx.py
打包完後exe檔和credentials.json必須放在同個資料夾
ps.若使用windows任務排程,開始位置必須填入資料夾路徑。
沒有留言:
張貼留言