global name 'FileNotFoundError' is not defined
昨天在伺服器上執行python的時候發生這個錯誤
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/home/dev/bot-server/BotServer.py", line 17, in run
bot = Bot(cache_path=True)
File "/usr/local/lib/python2.7/dist-packages/wxpy/api/bot.py" , line 88, in __init__
except FileNotFoundError as e:
NameError: global name 'FileNotFoundError' is not defined
這個錯誤大致的意思是說找不到檔案(讀寫檔案,或者配置檔案)
於是查看了所需要的檔案和相關的配置都沒有問題,
最後想起來可能是許可權問題 給相關的檔案新增讀寫許可權之後就可以了
還有一種可能是你要寫的資料出現了問題,就是沒有資料可以寫
例如最近弄得微信,要儲存微信登入的資料,但是由於微訊號被封了,所以登入資料為null,所以出現這個錯誤!!!