简体   繁体   English

Dropbox Python API导入Dropbox语法错误

[英]dropbox python api import dropbox syntax error

Using Python 2.6.6 使用Python 2.6.6

Trying to install dropbox python api.. 尝试安装Dropbox Python API。

Tried both ' pip install dropbox ' and ' python setup.py install ' 尝试了'pip install dropbox'和'python setup.py install'

Got this error... on import dropbox 在导入保管箱上出现此错误...

Traceback (most recent call last):

    File "<stdin>", line 1, in <module>
    File "/usr/lib/python2.6/site-packages/dropbox/__init__.py", line 3, in <module>
    from . import client, rest, session
    File "/usr/lib/python2.6/site-packages/dropbox/client.py", line 22, in <module>
    from .rest import ErrorResponse, RESTClient, params_to_urlencoded
    File "/usr/lib/python2.6/site-packages/dropbox/rest.py", line 415
    utf8_params = {encode(k): encode(v) for k, v in params.iteritems()}
                                      ^
SyntaxError: invalid syntax

am i doing anything wrong..? 我做错什么了吗?

It appears the code in the dropbox API uses dictionary comprehensions , which were not introduced until Python 2.7. 似乎dropbox API中的代码使用字典理解 ,直到Python 2.7才引入。 This can also be seen on the PyPI page for this module, which lists 2.7 as the Python version needed. 也可以在此模块的PyPI页面上看到, 该页面列出了2.7作为所需的Python版本。 You will not be able to use this module unless you upgrade to Python 2.7. 除非升级到Python 2.7,否则将无法使用此模块。 (According to this question it must be Python 2.7, as the API doesn't yet support Python 3.) (根据这个问题,它必须是Python 2.7,因为API尚不支持Python3。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM