我有以下 Python 脚本:import httpimport requestsfrom bs4 import BeautifulSoupimport urllib3import pyrebaseimport numpy as npimport yagmailimport timefrom datetime import datetime, timedeltaimport sysimport loggingimport coloramaimport csvfrom random import randintfrom numpy import genfromtxtimport sched, timeimport threadingimport http.clientimport firebase_adminfrom firebase_admin import credentialsfrom firebase_admin import db# Fetch the service account key JSON file contentscred = credentials.Certificate('service-account-credentials.json')# Initialize the app with a service account, granting admin privilegesfirebase_admin.initialize_app(cred, { 'databaseURL': 'https://werrwrrw-catalogue.firebaseio.com'})config = { "apiKey": "BiXzaSdwhjwrhwjjrhwr", "authDomain": "whjwrhwjjrhwr.firebaseapp.com", "databaseURL": "https://whjwrhwjjrhwr.firebaseio.com", "projectId": "whjwrhwjjrhwr", "storageBucket": "rewrrrrr.appspot.com", "messagingSenderId": "606543434441"}firebaseuser = pyrebase.initialize_app(config)auth = firebaseuser.auth()dbuser = firebaseuser.database()subref = db.reference('Subcribers').get()for key, val in subref.items(): subcriber_email = val['Email'] print(key,subcriber_email)我无法真正查明错误。我如何基于上述回溯读取修复错误?
3 回答
HUH函数
TA贡献1836条经验 获得超4个赞
可能是 Bs4 引发了异常,请在现有的一个中执行以下脚本验证 Bs4 导入工作正常
try:
from bs4 import BeautifulSoup
except Exception as err:
raise ImportError('Bs4 is not imported correctly. - {}'.format(err))
素胚勾勒不出你
TA贡献1827条经验 获得超9个赞
我自己也不是专家,但请尝试在第一行中进行此操作
import http as http_
因为我在错误消息中看到 python 试图client
从 http模块获取
我的猜测是因为有 http 模块和 http 文件夹,其中文件夹包含其他模块(如客户端)
添加回答
举报
0/150
提交
取消