I';我在使用Uber Python API时遇到了麻烦

I';我在使用Uber Python API时遇到了麻烦,python,api,import,uber-api,Python,Api,Import,Uber Api,我正在用python编写代码,使用2.6版,使用Uber API,当我尝试导入库Uber_rides.auth时,它会抛出以下错误: Traceback (most recent call last): File "C:\Inetpub\vhosts\underdevelopment.biz\httpdocs\web\webtemp3\uber\socket.py", line 4, in <module> from uber_rides.auth import

我正在用python编写代码,使用2.6版,使用Uber API,当我尝试导入库
Uber_rides.auth
时,它会抛出以下错误:

Traceback (most recent call last):
  File "C:\Inetpub\vhosts\underdevelopment.biz\httpdocs\web\webtemp3\uber\socket.py", line 4, in <module>    
    from uber_rides.auth import AuthorizationCodeGrant
  File "C:\Inetpub\vhosts\underdevelopment.biz\httpdocs\web\webtemp3\uber\uber_rides\auth.py", line 133
    query_params = [qp: query_params[qp][0] for qp in query_params]
                      ^
SyntaxError: invalid syntax

好像是图书馆的错误,但我还找不到

是的,这是无效的Python语法。然而,不清楚你是如何得到那个文件的

有人或某事改变了那个文件。这不是一行,它使用正确的语法来理解字典:

query_params = {qp: query_params[qp][0] for qp in query_params}
重新安装项目,错误不在上游

请注意,上述语法仅在Python2.7及更高版本中可用。您可以尝试将其替换为带有生成器表达式的
dict()
调用,请参见:


考虑到代码可能存在其他问题,升级到Python 2.7可能是更好的选择。

是的,错误在库中。他们使用了无效的语法。也许他们想用听写理解来代替。你从哪里得到这些文件的?看看这里的语法是正确的。它也从未出错,这是初始提交。我更改了代码,但再次抛出错误:回溯(上次的最新调用):文件“C:\Inetpub\vhosts\underdevelopment.biz\httpdocs\web\webtemp3\uber\socket.py”,第4行,来自uber\u rides.auth import AuthorizationCodeGrant文件“C:\Inetpub\vhosts\underdevelopment.biz\httpdocs\web\webtemp3\uber\uber\u-rides\auth.py”,第133行查询参数={qp:query\u-params[qp][0]用于查询参数中的qp}^语法错误:无效syntax@ArturoVasquez:您正在使用Python 2.6。该库需要Python 2.7或更高版本。
query_params = {qp: query_params[qp][0] for qp in query_params}
query_params = dict((qp, query_params[qp][0]) for qp in query_params)