[英]cannot import name 'bot_token' from 'authentication'
嗨,我在使用這個 python 腳本時遇到了問題 這是錯誤
PS C:\Users\betha\Downloads\Ghost-chan-main> & C:/Users/betha/AppData/Local/Microsoft/WindowsApps/python3.9.exe c:/Users/betha/Downloads/Ghost-chan-main/Ghost-chan-main/main.py
Traceback (most recent call last):
File "c:\Users\betha\Downloads\Ghost-chan-main\Ghost-chan-main\main.py", line 6, in <module>
from authentication import bot_token
ImportError: cannot import name 'bot_token' from 'authentication' (C:\Users\betha\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\authentication\__init__.py)
PS C:\Users\betha\Downloads\Ghost-chan-main>
這是 GitHub: https://github.com/vichannnnn/Ghost-chan我正在嘗試為我的朋友設置這個機器人
我認為問題是缺少帶有代碼的文件authentication.py
bot_token = your_token
作者沒有添加這個,因為他/她的令牌不應該被共享。
因為沒有authentication.py
所以import
找到了一些名稱為authentication
的模塊,它試圖從這個模塊中獲取bot_token
- 但這個模塊不能擁有它,因為它不是為此創建的。
你有兩個解決方案:
在帶有項目的文件夾中使用代碼bot_token = your_token
創建文件authentication.py
。
刪除線
from authentication import bot_token
放線
bot_token = your_token
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.