【问题标题】:How to get game names through genre by using rawgpy wrapper in python?如何通过在 python 中使用 rawgpy 包装器通过流派获取游戏名称?
【发布时间】:2020-05-18 11:47:09
【问题描述】:

这是我获取与赛车类型相关的游戏列表的代码我正在尝试在 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 api wrapper


    【解决方案1】:

    可以查看here包的源码。

    我不熟悉这个库,但只要阅读您的问题并浏览代码,我可以肯定地说 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()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-24
      • 2023-02-16
      • 2011-09-09
      • 1970-01-01
      • 1970-01-01
      • 2015-08-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多