python - 如何通过在 python 中使用 rawgpy 包装器通过流派获取游戏名称?
问题描述
这是我获取与赛车类型相关的游戏列表的代码我试图在 python 中使用 jupyter 访问游戏名称我已经使用 anaconda 提示安装了库但是当我运行代码时出现此错误。
import rawgpy
from rawgpy import data_classes
results= data_classes.charts.GenreChart("racing")
game = results[0]
game.populate()`
AttributeError: module 'rawgpy.data_classes' has no attribute 'charts'
Can someone please help mw with this error
解决方案
您可以在此处查看包的源代码。
我不熟悉这个库,但只要阅读您的问题并浏览代码,我可以肯定地说 python 模块data_classes
中没有调用符号/变量charts
。导入依赖项的方式是尝试导入__init__.py
导入符号文件中的所有内容,但遗憾的是,维护者似乎不知道如何使用这些文件;如果该变量存在,它将在data_classes模块的 init 文件中,而事实并非如此。
您应该能够通过执行以下操作来解决您的问题:
import rawgpy
from rawgpy.data_classes.charts import GenreChart
results= GenreChart("racing")
game = results[0]
game.populate()
推荐阅读
- libgdx - 如何避免Stage中的ScollPane和GestureListerner同时抛出
- excel - 使用 MS Excel 驱动程序连接 odbc 后打开 excel 文件时出错
- go - 为什么 map[]interface{} 不采用 map[]SpecificInterface
- java - 如果使用 Android 后台服务,Flutter 会卡在“等待天文台端口可用”
- java - camunda 拦截业务流程执行
- google-bigquery - 子查询中case语句后的BigQuery连接表
- python - 是否可以从 python 代码中删除所有 __future__ 语句,而不影响其使用 python 3.7.1 的功能?
- angular - Angular 前端显示 Laravel 后端存储的图像
- css - 有没有办法对齐
在 HTML5 中?
- excel - 在不移动单元格的情况下删除重复项