Google Python gdata 库安装失败

发布于 2024-10-11 13:36:22 字数 25682 浏览 8 评论 0原文

[注意,我删除了一些信息,例如我的用户名和 我的电子表格的 ID] 你好!我在 Mac 上,正在尽力为 google python 安装 gdata。 在继续之前,我在这里使用本教程: http://code.google.com/apis/gdata/articles/python_client_lib.html 我的python版本是:2.6.1,所以我按照指示跳过了安装依赖项。

终端看起来像:

Last login: Sat Jan  1 11:28:47 on ttys000 
Users-MacBook-Pro:~ user$ python -V 
Python 2.6.1 
Users-MacBook-Pro:~ user$ 

我启动了 python 解释器并尝试导入 xml 树。 没有发生任何事情,所以我尝试进口香蕉。 终端看起来像:

Last login: Sat Jan  1 11:30:26 on ttys000 
Users-MacBook-Pro:~ user$ python 
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from xml.etree import ElementTree 
>>> from ninjas import banannas 

Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
ImportError: No module named ninjas 

这让我基本确定我有 xmltree,尽管我不记得了 曾经安装过它。 此时,我下载了gdata库,我的mac 自动解压它。 然后我运行安装命令,并运行测试命令。我的终端看起来像这样:

 Last login: Sat Jan  1 11:31:21 on ttys000 
    Users-MacBook-Pro:~ user$ cd /Users/User/Downloads/gdata-2-1.0.13 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ ./setup.py install 
    /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ 
    distutils/dist.py:266: UserWarning: Unknown distribution option: 
    'install_requires' 
      warnings.warn(msg) 
    running install 
    running build 
    running build_py 
    creating build 
    creating build/lib 
    creating build/lib/atom 
    copying src/atom/__init__.py -> build/lib/atom 
    copying src/atom/auth.py -> build/lib/atom 
    copying src/atom/client.py -> build/lib/atom 
    copying src/atom/core.py -> build/lib/atom 
    copying src/atom/data.py -> build/lib/atom 
    copying src/atom/http.py -> build/lib/atom 
    copying src/atom/http_core.py -> build/lib/atom 
    copying src/atom/http_interface.py -> build/lib/atom 
    copying src/atom/mock_http.py -> build/lib/atom 
    copying src/atom/mock_http_core.py -> build/lib/atom 
    copying src/atom/mock_service.py -> build/lib/atom 
    copying src/atom/service.py -> build/lib/atom 
    copying src/atom/token_store.py -> build/lib/atom 
    copying src/atom/url.py -> build/lib/atom 
    creating build/lib/gdata 
    copying src/gdata/__init__.py -> build/lib/gdata 
    copying src/gdata/apps_property.py -> build/lib/gdata 
    copying src/gdata/auth.py -> build/lib/gdata 
    copying src/gdata/client.py -> build/lib/gdata 
    copying src/gdata/core.py -> build/lib/gdata 
    copying src/gdata/data.py -> build/lib/gdata 
    copying src/gdata/gauth.py -> build/lib/gdata 
   --Various copying, migration, and creation printouts exactly the same to the above and below, asides from path, removed to save space--
    migration 
    copying src/gdata/apps/migration/service.py -> build/lib/gdata/apps/ 
    migration 
    creating build/lib/gdata/apps/organization 
    copying src/gdata/apps/organization/__init__.py -> build/lib/gdata/ 
    apps/organization 
    copying src/gdata/apps/organization/service.py -> build/lib/gdata/apps/ 
    organization 
    creating build/lib/gdata/base 
    copying src/gdata/base/__init__.py -> build/lib/gdata/base 
    copying src/gdata/base/service.py -> build/lib/gdata/base 
    creating build/lib/gdata/blogger 
    copying src/gdata/blogger/__init__.py -> build/lib/gdata/blogger 
    copying src/gdata/blogger/client.py -> build/lib/gdata/blogger 
    copying src/gdata/blogger/data.py -> build/lib/gdata/blogger 
    copying src/gdata/blogger/service.py -> build/lib/gdata/blogger 
    creating build/lib/gdata/books 
    copying src/gdata/books/__init__.py -> build/lib/gdata/books 
    copying src/gdata/books/data.py -> build/lib/gdata/books 
    copying src/gdata/books/service.py -> build/lib/gdata/books 
    creating build/lib/gdata/calendar 
    copying src/gdata/calendar/__init__.py -> build/lib/gdata/calendar 
    copying src/gdata/calendar/data.py -> build/lib/gdata/calendar 
    copying src/gdata/calendar/service.py -> build/lib/gdata/calendar 
    creating build/lib/gdata/calendar_resource 
    copying src/gdata/calendar_resource/__init__.py -> build/lib/gdata/ 
    calendar_resource 
    copying src/gdata/calendar_resource/client.py -> build/lib/gdata/ 
    calendar_resource 
    copying src/gdata/calendar_resource/data.py -> build/lib/gdata/ 
    calendar_resource 
    creating build/lib/gdata/codesearch 
    copying src/gdata/codesearch/__init__.py -> build/lib/gdata/codesearch 
    copying src/gdata/codesearch/service.py -> build/lib/gdata/codesearch 
    creating build/lib/gdata/contacts 
    copying src/gdata/contacts/__init__.py -> build/lib/gdata/contacts 
    copying src/gdata/contacts/client.py -> build/lib/gdata/contacts 
    copying src/gdata/contacts/data.py -> build/lib/gdata/contacts 
    copying src/gdata/contacts/service.py -> build/lib/gdata/contacts 
    creating build/lib/gdata/docs 
    copying src/gdata/docs/__init__.py -> build/lib/gdata/docs 
    copying src/gdata/docs/client.py -> build/lib/gdata/docs 
    copying src/gdata/docs/data.py -> build/lib/gdata/docs 
    copying src/gdata/docs/service.py -> build/lib/gdata/docs 
    creating build/lib/gdata/dublincore 
    copying src/gdata/dublincore/__init__.py -> build/lib/gdata/dublincore 
    copying src/gdata/dublincore/data.py -> build/lib/gdata/dublincore 
    creating build/lib/gdata/exif 
    copying src/gdata/exif/__init__.py -> build/lib/gdata/exif 
    creating build/lib/gdata/finance 
    copying src/gdata/finance/__init__.py -> build/lib/gdata/finance 
    copying src/gdata/finance/data.py -> build/lib/gdata/finance 
    copying src/gdata/finance/service.py -> build/lib/gdata/finance 
    creating build/lib/gdata/geo 
    copying src/gdata/geo/__init__.py -> build/lib/gdata/geo 
    copying src/gdata/geo/data.py -> build/lib/gdata/geo 
    creating build/lib/gdata/health 
    copying src/gdata/health/__init__.py -> build/lib/gdata/health 
    copying src/gdata/health/service.py -> build/lib/gdata/health 
    creating build/lib/gdata/maps 
    copying src/gdata/maps/__init__.py -> build/lib/gdata/maps 
    copying src/gdata/maps/client.py -> build/lib/gdata/maps 
    copying src/gdata/maps/data.py -> build/lib/gdata/maps 
    creating build/lib/gdata/media 
    copying src/gdata/media/__init__.py -> build/lib/gdata/media 
    copying src/gdata/media/data.py -> build/lib/gdata/media 
    creating build/lib/gdata/notebook 
    copying src/gdata/notebook/__init__.py -> build/lib/gdata/notebook 
    copying src/gdata/notebook/data.py -> build/lib/gdata/notebook 
    creating build/lib/gdata/oauth 
    copying src/gdata/oauth/__init__.py -> build/lib/gdata/oauth 
    copying src/gdata/oauth/rsa.py -> build/lib/gdata/oauth 
    creating build/lib/gdata/opensearch 
    copying src/gdata/opensearch/__init__.py -> build/lib/gdata/opensearch 
    copying src/gdata/opensearch/data.py -> build/lib/gdata/opensearch 
    creating build/lib/gdata/photos 
    copying src/gdata/photos/__init__.py -> build/lib/gdata/photos 
    copying src/gdata/photos/service.py -> build/lib/gdata/photos 
    creating build/lib/gdata/projecthosting 
    copying src/gdata/projecthosting/__init__.py -> build/lib/gdata/ 
    projecthosting 
    copying src/gdata/projecthosting/client.py -> build/lib/gdata/ 
    projecthosting 
    copying src/gdata/projecthosting/data.py -> build/lib/gdata/ 
    projecthosting 
    creating build/lib/gdata/sites 
    copying src/gdata/sites/__init__.py -> build/lib/gdata/sites 
    copying src/gdata/sites/client.py -> build/lib/gdata/sites 
    copying src/gdata/sites/data.py -> build/lib/gdata/sites 
    creating build/lib/gdata/spreadsheet 
    copying src/gdata/spreadsheet/__init__.py -> build/lib/gdata/ 
    spreadsheet 
    copying src/gdata/spreadsheet/service.py -> build/lib/gdata/ 
    spreadsheet 
    copying src/gdata/spreadsheet/text_db.py -> build/lib/gdata/ 
    spreadsheet 
    creating build/lib/gdata/spreadsheets 
    copying src/gdata/spreadsheets/__init__.py -> build/lib/gdata/ 
    spreadsheets 
    copying src/gdata/spreadsheets/client.py -> build/lib/gdata/ 
    spreadsheets 
    copying src/gdata/spreadsheets/data.py -> build/lib/gdata/spreadsheets 
    creating build/lib/gdata/tlslite 
    copying src/gdata/tlslite/__init__.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/api.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/BaseDB.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/Checker.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/constants.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/errors.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/FileObject.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/HandshakeSettings.py -> build/lib/gdata/ 
    tlslite 
    copying src/gdata/tlslite/mathtls.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/messages.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/Session.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/SessionCache.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/SharedKeyDB.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/TLSConnection.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/TLSRecordLayer.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/VerifierDB.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/X509.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/X509CertChain.py -> build/lib/gdata/tlslite 
    creating build/lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/__init__.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/AsyncStateMachine.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/ClientHelper.py -> build/lib/ 
    gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/HTTPTLSConnection.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/IMAP4_TLS.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/IntegrationHelper.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/POP3_TLS.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/SMTP_TLS.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/TLSAsyncDispatcherMixIn.py -> 
    build/lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/TLSSocketServerMixIn.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/TLSTwistedProtocolWrapper.py -> 
    build/lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/XMLRPCTransport.py -> build/lib/ 
    gdata/tlslite/integration 
    creating build/lib/gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/__init__.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/AES.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/ASN1Parser.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/cipherfactory.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/codec.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/compat.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/Cryptlib_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Cryptlib_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Cryptlib_TripleDES.py -> build/lib/ 
    gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/cryptomath.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/dateFuncs.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/hmac.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/jython_compat.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/keyfactory.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_RSAKey.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_TripleDES.py -> build/lib/ 
    gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_RSAKey.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_TripleDES.py -> build/lib/ 
    gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/Python_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Python_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Python_RSAKey.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/RC4.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/rijndael.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/RSAKey.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/TripleDES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/xmltools.py -> build/lib/gdata/tlslite/ 
    utils 
    creating build/lib/gdata/webmastertools 
    copying src/gdata/webmastertools/__init__.py -> build/lib/gdata/ 
    webmastertools 
    copying src/gdata/webmastertools/data.py -> build/lib/gdata/ 
    webmastertools 
    copying src/gdata/webmastertools/service.py -> build/lib/gdata/ 
    webmastertools 
    creating build/lib/gdata/youtube 
    copying src/gdata/youtube/__init__.py -> build/lib/gdata/youtube 
    copying src/gdata/youtube/client.py -> build/lib/gdata/youtube 
    copying src/gdata/youtube/data.py -> build/lib/gdata/youtube 
    copying src/gdata/youtube/service.py -> build/lib/gdata/youtube 
    running install_lib 
    running install_egg_info 
    Removing /Library/Python/2.6/site-packages/gdata-2.0.13-py2.6.egg-info 
    Writing /Library/Python/2.6/site-packages/gdata-2.0.13-py2.6.egg-info 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ 
    I then ran the first test mentioned: 
    Last login: Sat Jan  1 11:38:03 on ttys000 
    Users-MacBook-Pro:~ user$ ./tests/run_data_tests.py 
    -bash: ./tests/run_data_tests.py: No such file or directory 
    Users-MacBook-Pro:~ user$ cd /Users/user/Downloads/gdata-2-1.0.13 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ ./tests/run_data_tests.py 
    Running all tests in module gdata_test 
    ..................... 
    ---------------------------------------------------------------------- 
    Ran 21 tests in 0.085s 
    OK 
    Running all tests in module atom_test 
    ............................................... 
    ---------------------------------------------------------------------- 
    Ran 47 tests in 0.019s 
    OK 
    Running all tests in module atom_tests.url_test 
    .... 
    ---------------------------------------------------------------------- 
    Ran 4 tests in 0.001s 
    OK 
    Running all tests in module atom_tests.http_interface_test 
    . 
    ---------------------------------------------------------------------- 
    Ran 1 test in 0.000s 
    OK 
    Running all tests in module atom_tests.mock_http_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.729s 
    OK 
    Running all tests in module atom_tests.core_test 
    ................ 
    ---------------------------------------------------------------------- 
    Ran 16 tests in 0.008s 
    OK 
    Running all tests in module atom_tests.token_store_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.001s 
    OK 
    Running all tests in module gdata_tests.client_test 
    ............... 
    ---------------------------------------------------------------------- 
    Ran 15 tests in 0.006s 
    OK 
    Running all tests in module gdata_tests.apps_test 
    ............................................... 
    ---------------------------------------------------------------------- 
    Ran 47 tests in 0.028s 
    OK 
    Running all tests in module gdata_tests.apps.emailsettings.data_test 
    ................................. 
    ---------------------------------------------------------------------- 
    Ran 33 tests in 0.009s 
    OK 
    Running all tests in module gdata_tests.auth_test 
    ............................. 
    ---------------------------------------------------------------------- 
    Ran 29 tests in 0.109s 
    OK 
    Running all tests in module gdata_tests.base_test 
    ..................... 
    ---------------------------------------------------------------------- 
    Ran 21 tests in 0.028s 
    OK 
    Running all tests in module gdata_tests.books_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.001s 
    OK 
    Running all tests in module gdata_tests.calendar_test 
    ............................................................ 
    ---------------------------------------------------------------------- 
    Ran 60 tests in 0.361s 
    OK 
    Running all tests in module gdata_tests.docs_test 
    ....F... 
    ====================================================================== 
    FAIL: testToAndFromStringWithData 
    (gdata_tests.docs_test.DocumentListEntryTest) 
    ---------------------------------------------------------------------- 
    Traceback (most recent call last): 
      File "/Users/user/Downloads/gdata-2-1.0.13/tests/gdata_tests/ 
    docs_test.py", line 39, in testToAndFromStringWithData 
        'spreadsheet%3Asupercalifragilisticexpealidocious') 
    AssertionError: 'https://docs.google.com/feeds/documents/private/full/ 
    spreadsheet%3Asupercalifragilisticexpealidocious' != 'http:// 
    docs.google.com/feeds/documents/private/full/spreadsheet 
    %3Asupercalifragilisticexpealidocious' 
    ---------------------------------------------------------------------- 
    Ran 8 tests in 0.012s 
    FAILED (failures=1) 
    Running all tests in module gdata_tests.health_test 
    ............... 
    ---------------------------------------------------------------------- 
    Ran 15 tests in 0.195s 
    OK 
    Running all tests in module gdata_tests.spreadsheet_test 
    ........... 
    ---------------------------------------------------------------------- 
    Ran 11 tests in 0.012s 
    OK 
    Running all tests in module gdata_tests.photos_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.007s 
    OK 
    Running all tests in module gdata_tests.codesearch_test 
    . 
    ---------------------------------------------------------------------- 
    Ran 1 test in 0.004s 
    OK 
    Running all tests in module gdata_tests.contacts_test 
    ....... 
    ---------------------------------------------------------------------- 
    Ran 7 tests in 0.009s 
    OK 
    Running all tests in module gdata_tests.youtube_test 
    ................ 
    ---------------------------------------------------------------------- 
    Ran 16 tests in 0.019s 
    OK 
    Running all tests in module gdata_tests.blogger_test 
    ...... 
    ---------------------------------------------------------------------- 
    Ran 6 tests in 0.002s 
    OK 
    Running all tests in module gdata_tests.webmastertools_test 
    ............................. 
    ---------------------------------------------------------------------- 
    Ran 29 tests in 0.016s 
    OK 
    Running all tests in module gdata_tests.calendar_resource.data_test 
    .. 
    ---------------------------------------------------------------------- 
    Ran 2 tests in 0.003s 
    OK 
    Running all tests in module gdata_tests.oauth.data_test 
    ............../Library/Python/2.6/site-packages/gdata/oauth/ 
    __init__.py:16: DeprecationWarning: BaseException.message has been 
    deprecated as of Python 2.6 
      self.message = message 
    ......................... 
    ---------------------------------------------------------------------- 
    Ran 39 tests in 0.038s 
    OK 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ 
    Worried by the FAILURE up there, I ran the next test mentioned: 
    Last login: Sat Jan  1 11:42:38 on ttys000 
    Users-MacBook-Pro:~ user$ cd /Users/user/Downloads/gdata-2-1.0.13 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ ./samples/docs/docs_example.py 
    NOTE: Please run these tests only with a test account. 
    Please enter your username: User 
    Password: 
    Document List Sample 
    1) List your documents. 
    2) Search your documents. 
    3) Upload a document. 
    4) Download a document. 
    5) List a document's permissions. 
    6) Add/change a document's permissions. 
    7) Exit. 
    > 1 

    Retrieve (all/document/folder/presentation/spreadsheet/pdf): 
    Enter a category: spreadsheets 
    No entries in feed. 
    TITLE              TYPE         RESOURCE ID 
    Document List Sample 
    1) List your documents. 
    2) Search your documents. 
    3) Upload a document. 
    4) Download a document. 
    5) List a document's permissions. 
    6) Add/change a document's permissions. 
    7) Exit. 
    > 1 

    Retrieve (all/document/folder/presentation/spreadsheet/pdf): 
    Enter a category: all 
    TITLE              TYPE         RESOURCE ID 
    Whirld             spreadsheet  spreadsheet:--removed ID-- 
    Whirld Stats       spreadsheet  spreadsheet:--removed ID-- 
    Document List Sample 
    1) List your documents. 
    2) Search your documents. 
    3) Upload a document. 
    4) Download a document. 
    5) List a document's permissions. 
    6) Add/change a document's permissions. 
    7) Exit.

除了神秘的故障之外,一切似乎都还好,所以我 尝试运行一些代码,只是为了看看我是否能达到 初始化 DocsService:

import cgi 
from google.appengine.ext import webapp 
from google.appengine.ext.webapp.util import run_wsgi_app 
import gdata.docs 
import gdata.docs.service 
class MainPage(webapp.RequestHandler): 
    def post(self): 
        self.Test = self.request.get('Test') 
        self.respond(bool(1)) 
    def get(self): 
        self.respond(bool(0)) 
    def respond(self,isPost): 
        if isPost: 
                self.response.out.write("""Greetings. The value of Test is""" + 
self.Test) 
        else: 
                self.response.out.write("""ERROR -- Post data not given!""") 
        #gd_client = gdata.docs.service.DocsService(source='[removed]') 
        self.response.out.write("""Hahahahaha""") 
application = webapp.WSGIApplication([  ('/', MainPage) ], debug=True) 
#Run the basic code: 
def main(): 
    run_wsgi_app(application) 
if __name__ == "__main__": 
    main() 

但是,当从谷歌应用程序引擎启动该代码时,然后 在 Safari 中查看它,我受到欢迎:

Traceback (most recent call last): 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 3245, in _HandleRequest 
    self._Dispatch(dispatcher, self.rfile, outfile, env_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 3186, in _Dispatch 
    base_env_dict=env_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 531, in Dispatch 
    base_env_dict=base_env_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 2410, in Dispatch 
    self._module_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 2320, in ExecuteCGI 
    reset_modules = exec_script(handler_path, cgi_path, hook) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 2216, in 
ExecuteOrImportScript 
    exec module_code in script_module.__dict__ 
  File "/Users/user/Documents/Web Projects/Python/HelloWorld/ 
HelloWorld.py", line 4, in <module> 
    import gdata.docs 
ImportError: No module named gdata.docs

我不确定这里出了什么问题,但任何帮助都将是深刻的 赞赏。

[Note, I have removed some information, such as my username, and the
IDs to my spreadsheets]
Hi! I'm on a mac, and I'm trying my best to install gdata for google python.
Before I go on, I'm using this tutorial here:
http://code.google.com/apis/gdata/articles/python_client_lib.html
I have python version: 2.6.1, so I skipped to installing dependencies as instructed.

Terminal looked like:

Last login: Sat Jan  1 11:28:47 on ttys000 
Users-MacBook-Pro:~ user$ python -V 
Python 2.6.1 
Users-MacBook-Pro:~ user$ 

I fired up the python interpreter and tried importing xml tree.
Nothing happened, so I tried importing banannas.
Terminal looked like:

Last login: Sat Jan  1 11:30:26 on ttys000 
Users-MacBook-Pro:~ user$ python 
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from xml.etree import ElementTree 
>>> from ninjas import banannas 

Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
ImportError: No module named ninjas 

This makes me mostly sure I have xmltree, though I do not remember
ever having installed it.
At this point, I downloaded the gdata library, and my mac
automagically decompressed it.
I then ran the install command, and ran the test commands. My terminal looked like this:

 Last login: Sat Jan  1 11:31:21 on ttys000 
    Users-MacBook-Pro:~ user$ cd /Users/User/Downloads/gdata-2-1.0.13 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ ./setup.py install 
    /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ 
    distutils/dist.py:266: UserWarning: Unknown distribution option: 
    'install_requires' 
      warnings.warn(msg) 
    running install 
    running build 
    running build_py 
    creating build 
    creating build/lib 
    creating build/lib/atom 
    copying src/atom/__init__.py -> build/lib/atom 
    copying src/atom/auth.py -> build/lib/atom 
    copying src/atom/client.py -> build/lib/atom 
    copying src/atom/core.py -> build/lib/atom 
    copying src/atom/data.py -> build/lib/atom 
    copying src/atom/http.py -> build/lib/atom 
    copying src/atom/http_core.py -> build/lib/atom 
    copying src/atom/http_interface.py -> build/lib/atom 
    copying src/atom/mock_http.py -> build/lib/atom 
    copying src/atom/mock_http_core.py -> build/lib/atom 
    copying src/atom/mock_service.py -> build/lib/atom 
    copying src/atom/service.py -> build/lib/atom 
    copying src/atom/token_store.py -> build/lib/atom 
    copying src/atom/url.py -> build/lib/atom 
    creating build/lib/gdata 
    copying src/gdata/__init__.py -> build/lib/gdata 
    copying src/gdata/apps_property.py -> build/lib/gdata 
    copying src/gdata/auth.py -> build/lib/gdata 
    copying src/gdata/client.py -> build/lib/gdata 
    copying src/gdata/core.py -> build/lib/gdata 
    copying src/gdata/data.py -> build/lib/gdata 
    copying src/gdata/gauth.py -> build/lib/gdata 
   --Various copying, migration, and creation printouts exactly the same to the above and below, asides from path, removed to save space--
    migration 
    copying src/gdata/apps/migration/service.py -> build/lib/gdata/apps/ 
    migration 
    creating build/lib/gdata/apps/organization 
    copying src/gdata/apps/organization/__init__.py -> build/lib/gdata/ 
    apps/organization 
    copying src/gdata/apps/organization/service.py -> build/lib/gdata/apps/ 
    organization 
    creating build/lib/gdata/base 
    copying src/gdata/base/__init__.py -> build/lib/gdata/base 
    copying src/gdata/base/service.py -> build/lib/gdata/base 
    creating build/lib/gdata/blogger 
    copying src/gdata/blogger/__init__.py -> build/lib/gdata/blogger 
    copying src/gdata/blogger/client.py -> build/lib/gdata/blogger 
    copying src/gdata/blogger/data.py -> build/lib/gdata/blogger 
    copying src/gdata/blogger/service.py -> build/lib/gdata/blogger 
    creating build/lib/gdata/books 
    copying src/gdata/books/__init__.py -> build/lib/gdata/books 
    copying src/gdata/books/data.py -> build/lib/gdata/books 
    copying src/gdata/books/service.py -> build/lib/gdata/books 
    creating build/lib/gdata/calendar 
    copying src/gdata/calendar/__init__.py -> build/lib/gdata/calendar 
    copying src/gdata/calendar/data.py -> build/lib/gdata/calendar 
    copying src/gdata/calendar/service.py -> build/lib/gdata/calendar 
    creating build/lib/gdata/calendar_resource 
    copying src/gdata/calendar_resource/__init__.py -> build/lib/gdata/ 
    calendar_resource 
    copying src/gdata/calendar_resource/client.py -> build/lib/gdata/ 
    calendar_resource 
    copying src/gdata/calendar_resource/data.py -> build/lib/gdata/ 
    calendar_resource 
    creating build/lib/gdata/codesearch 
    copying src/gdata/codesearch/__init__.py -> build/lib/gdata/codesearch 
    copying src/gdata/codesearch/service.py -> build/lib/gdata/codesearch 
    creating build/lib/gdata/contacts 
    copying src/gdata/contacts/__init__.py -> build/lib/gdata/contacts 
    copying src/gdata/contacts/client.py -> build/lib/gdata/contacts 
    copying src/gdata/contacts/data.py -> build/lib/gdata/contacts 
    copying src/gdata/contacts/service.py -> build/lib/gdata/contacts 
    creating build/lib/gdata/docs 
    copying src/gdata/docs/__init__.py -> build/lib/gdata/docs 
    copying src/gdata/docs/client.py -> build/lib/gdata/docs 
    copying src/gdata/docs/data.py -> build/lib/gdata/docs 
    copying src/gdata/docs/service.py -> build/lib/gdata/docs 
    creating build/lib/gdata/dublincore 
    copying src/gdata/dublincore/__init__.py -> build/lib/gdata/dublincore 
    copying src/gdata/dublincore/data.py -> build/lib/gdata/dublincore 
    creating build/lib/gdata/exif 
    copying src/gdata/exif/__init__.py -> build/lib/gdata/exif 
    creating build/lib/gdata/finance 
    copying src/gdata/finance/__init__.py -> build/lib/gdata/finance 
    copying src/gdata/finance/data.py -> build/lib/gdata/finance 
    copying src/gdata/finance/service.py -> build/lib/gdata/finance 
    creating build/lib/gdata/geo 
    copying src/gdata/geo/__init__.py -> build/lib/gdata/geo 
    copying src/gdata/geo/data.py -> build/lib/gdata/geo 
    creating build/lib/gdata/health 
    copying src/gdata/health/__init__.py -> build/lib/gdata/health 
    copying src/gdata/health/service.py -> build/lib/gdata/health 
    creating build/lib/gdata/maps 
    copying src/gdata/maps/__init__.py -> build/lib/gdata/maps 
    copying src/gdata/maps/client.py -> build/lib/gdata/maps 
    copying src/gdata/maps/data.py -> build/lib/gdata/maps 
    creating build/lib/gdata/media 
    copying src/gdata/media/__init__.py -> build/lib/gdata/media 
    copying src/gdata/media/data.py -> build/lib/gdata/media 
    creating build/lib/gdata/notebook 
    copying src/gdata/notebook/__init__.py -> build/lib/gdata/notebook 
    copying src/gdata/notebook/data.py -> build/lib/gdata/notebook 
    creating build/lib/gdata/oauth 
    copying src/gdata/oauth/__init__.py -> build/lib/gdata/oauth 
    copying src/gdata/oauth/rsa.py -> build/lib/gdata/oauth 
    creating build/lib/gdata/opensearch 
    copying src/gdata/opensearch/__init__.py -> build/lib/gdata/opensearch 
    copying src/gdata/opensearch/data.py -> build/lib/gdata/opensearch 
    creating build/lib/gdata/photos 
    copying src/gdata/photos/__init__.py -> build/lib/gdata/photos 
    copying src/gdata/photos/service.py -> build/lib/gdata/photos 
    creating build/lib/gdata/projecthosting 
    copying src/gdata/projecthosting/__init__.py -> build/lib/gdata/ 
    projecthosting 
    copying src/gdata/projecthosting/client.py -> build/lib/gdata/ 
    projecthosting 
    copying src/gdata/projecthosting/data.py -> build/lib/gdata/ 
    projecthosting 
    creating build/lib/gdata/sites 
    copying src/gdata/sites/__init__.py -> build/lib/gdata/sites 
    copying src/gdata/sites/client.py -> build/lib/gdata/sites 
    copying src/gdata/sites/data.py -> build/lib/gdata/sites 
    creating build/lib/gdata/spreadsheet 
    copying src/gdata/spreadsheet/__init__.py -> build/lib/gdata/ 
    spreadsheet 
    copying src/gdata/spreadsheet/service.py -> build/lib/gdata/ 
    spreadsheet 
    copying src/gdata/spreadsheet/text_db.py -> build/lib/gdata/ 
    spreadsheet 
    creating build/lib/gdata/spreadsheets 
    copying src/gdata/spreadsheets/__init__.py -> build/lib/gdata/ 
    spreadsheets 
    copying src/gdata/spreadsheets/client.py -> build/lib/gdata/ 
    spreadsheets 
    copying src/gdata/spreadsheets/data.py -> build/lib/gdata/spreadsheets 
    creating build/lib/gdata/tlslite 
    copying src/gdata/tlslite/__init__.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/api.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/BaseDB.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/Checker.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/constants.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/errors.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/FileObject.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/HandshakeSettings.py -> build/lib/gdata/ 
    tlslite 
    copying src/gdata/tlslite/mathtls.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/messages.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/Session.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/SessionCache.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/SharedKeyDB.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/TLSConnection.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/TLSRecordLayer.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/VerifierDB.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/X509.py -> build/lib/gdata/tlslite 
    copying src/gdata/tlslite/X509CertChain.py -> build/lib/gdata/tlslite 
    creating build/lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/__init__.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/AsyncStateMachine.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/ClientHelper.py -> build/lib/ 
    gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/HTTPTLSConnection.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/IMAP4_TLS.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/IntegrationHelper.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/POP3_TLS.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/SMTP_TLS.py -> build/lib/gdata/ 
    tlslite/integration 
    copying src/gdata/tlslite/integration/TLSAsyncDispatcherMixIn.py -> 
    build/lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/TLSSocketServerMixIn.py -> build/ 
    lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/TLSTwistedProtocolWrapper.py -> 
    build/lib/gdata/tlslite/integration 
    copying src/gdata/tlslite/integration/XMLRPCTransport.py -> build/lib/ 
    gdata/tlslite/integration 
    creating build/lib/gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/__init__.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/AES.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/ASN1Parser.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/cipherfactory.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/codec.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/compat.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/Cryptlib_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Cryptlib_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Cryptlib_TripleDES.py -> build/lib/ 
    gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/cryptomath.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/dateFuncs.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/hmac.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/jython_compat.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/keyfactory.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_RSAKey.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/OpenSSL_TripleDES.py -> build/lib/ 
    gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_RSAKey.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/PyCrypto_TripleDES.py -> build/lib/ 
    gdata/tlslite/utils 
    copying src/gdata/tlslite/utils/Python_AES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Python_RC4.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/Python_RSAKey.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/RC4.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/rijndael.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/RSAKey.py -> build/lib/gdata/tlslite/ 
    utils 
    copying src/gdata/tlslite/utils/TripleDES.py -> build/lib/gdata/ 
    tlslite/utils 
    copying src/gdata/tlslite/utils/xmltools.py -> build/lib/gdata/tlslite/ 
    utils 
    creating build/lib/gdata/webmastertools 
    copying src/gdata/webmastertools/__init__.py -> build/lib/gdata/ 
    webmastertools 
    copying src/gdata/webmastertools/data.py -> build/lib/gdata/ 
    webmastertools 
    copying src/gdata/webmastertools/service.py -> build/lib/gdata/ 
    webmastertools 
    creating build/lib/gdata/youtube 
    copying src/gdata/youtube/__init__.py -> build/lib/gdata/youtube 
    copying src/gdata/youtube/client.py -> build/lib/gdata/youtube 
    copying src/gdata/youtube/data.py -> build/lib/gdata/youtube 
    copying src/gdata/youtube/service.py -> build/lib/gdata/youtube 
    running install_lib 
    running install_egg_info 
    Removing /Library/Python/2.6/site-packages/gdata-2.0.13-py2.6.egg-info 
    Writing /Library/Python/2.6/site-packages/gdata-2.0.13-py2.6.egg-info 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ 
    I then ran the first test mentioned: 
    Last login: Sat Jan  1 11:38:03 on ttys000 
    Users-MacBook-Pro:~ user$ ./tests/run_data_tests.py 
    -bash: ./tests/run_data_tests.py: No such file or directory 
    Users-MacBook-Pro:~ user$ cd /Users/user/Downloads/gdata-2-1.0.13 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ ./tests/run_data_tests.py 
    Running all tests in module gdata_test 
    ..................... 
    ---------------------------------------------------------------------- 
    Ran 21 tests in 0.085s 
    OK 
    Running all tests in module atom_test 
    ............................................... 
    ---------------------------------------------------------------------- 
    Ran 47 tests in 0.019s 
    OK 
    Running all tests in module atom_tests.url_test 
    .... 
    ---------------------------------------------------------------------- 
    Ran 4 tests in 0.001s 
    OK 
    Running all tests in module atom_tests.http_interface_test 
    . 
    ---------------------------------------------------------------------- 
    Ran 1 test in 0.000s 
    OK 
    Running all tests in module atom_tests.mock_http_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.729s 
    OK 
    Running all tests in module atom_tests.core_test 
    ................ 
    ---------------------------------------------------------------------- 
    Ran 16 tests in 0.008s 
    OK 
    Running all tests in module atom_tests.token_store_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.001s 
    OK 
    Running all tests in module gdata_tests.client_test 
    ............... 
    ---------------------------------------------------------------------- 
    Ran 15 tests in 0.006s 
    OK 
    Running all tests in module gdata_tests.apps_test 
    ............................................... 
    ---------------------------------------------------------------------- 
    Ran 47 tests in 0.028s 
    OK 
    Running all tests in module gdata_tests.apps.emailsettings.data_test 
    ................................. 
    ---------------------------------------------------------------------- 
    Ran 33 tests in 0.009s 
    OK 
    Running all tests in module gdata_tests.auth_test 
    ............................. 
    ---------------------------------------------------------------------- 
    Ran 29 tests in 0.109s 
    OK 
    Running all tests in module gdata_tests.base_test 
    ..................... 
    ---------------------------------------------------------------------- 
    Ran 21 tests in 0.028s 
    OK 
    Running all tests in module gdata_tests.books_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.001s 
    OK 
    Running all tests in module gdata_tests.calendar_test 
    ............................................................ 
    ---------------------------------------------------------------------- 
    Ran 60 tests in 0.361s 
    OK 
    Running all tests in module gdata_tests.docs_test 
    ....F... 
    ====================================================================== 
    FAIL: testToAndFromStringWithData 
    (gdata_tests.docs_test.DocumentListEntryTest) 
    ---------------------------------------------------------------------- 
    Traceback (most recent call last): 
      File "/Users/user/Downloads/gdata-2-1.0.13/tests/gdata_tests/ 
    docs_test.py", line 39, in testToAndFromStringWithData 
        'spreadsheet%3Asupercalifragilisticexpealidocious') 
    AssertionError: 'https://docs.google.com/feeds/documents/private/full/ 
    spreadsheet%3Asupercalifragilisticexpealidocious' != 'http:// 
    docs.google.com/feeds/documents/private/full/spreadsheet 
    %3Asupercalifragilisticexpealidocious' 
    ---------------------------------------------------------------------- 
    Ran 8 tests in 0.012s 
    FAILED (failures=1) 
    Running all tests in module gdata_tests.health_test 
    ............... 
    ---------------------------------------------------------------------- 
    Ran 15 tests in 0.195s 
    OK 
    Running all tests in module gdata_tests.spreadsheet_test 
    ........... 
    ---------------------------------------------------------------------- 
    Ran 11 tests in 0.012s 
    OK 
    Running all tests in module gdata_tests.photos_test 
    ... 
    ---------------------------------------------------------------------- 
    Ran 3 tests in 0.007s 
    OK 
    Running all tests in module gdata_tests.codesearch_test 
    . 
    ---------------------------------------------------------------------- 
    Ran 1 test in 0.004s 
    OK 
    Running all tests in module gdata_tests.contacts_test 
    ....... 
    ---------------------------------------------------------------------- 
    Ran 7 tests in 0.009s 
    OK 
    Running all tests in module gdata_tests.youtube_test 
    ................ 
    ---------------------------------------------------------------------- 
    Ran 16 tests in 0.019s 
    OK 
    Running all tests in module gdata_tests.blogger_test 
    ...... 
    ---------------------------------------------------------------------- 
    Ran 6 tests in 0.002s 
    OK 
    Running all tests in module gdata_tests.webmastertools_test 
    ............................. 
    ---------------------------------------------------------------------- 
    Ran 29 tests in 0.016s 
    OK 
    Running all tests in module gdata_tests.calendar_resource.data_test 
    .. 
    ---------------------------------------------------------------------- 
    Ran 2 tests in 0.003s 
    OK 
    Running all tests in module gdata_tests.oauth.data_test 
    ............../Library/Python/2.6/site-packages/gdata/oauth/ 
    __init__.py:16: DeprecationWarning: BaseException.message has been 
    deprecated as of Python 2.6 
      self.message = message 
    ......................... 
    ---------------------------------------------------------------------- 
    Ran 39 tests in 0.038s 
    OK 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ 
    Worried by the FAILURE up there, I ran the next test mentioned: 
    Last login: Sat Jan  1 11:42:38 on ttys000 
    Users-MacBook-Pro:~ user$ cd /Users/user/Downloads/gdata-2-1.0.13 
    Users-MacBook-Pro:gdata-2-1.0.13 user$ ./samples/docs/docs_example.py 
    NOTE: Please run these tests only with a test account. 
    Please enter your username: User 
    Password: 
    Document List Sample 
    1) List your documents. 
    2) Search your documents. 
    3) Upload a document. 
    4) Download a document. 
    5) List a document's permissions. 
    6) Add/change a document's permissions. 
    7) Exit. 
    > 1 

    Retrieve (all/document/folder/presentation/spreadsheet/pdf): 
    Enter a category: spreadsheets 
    No entries in feed. 
    TITLE              TYPE         RESOURCE ID 
    Document List Sample 
    1) List your documents. 
    2) Search your documents. 
    3) Upload a document. 
    4) Download a document. 
    5) List a document's permissions. 
    6) Add/change a document's permissions. 
    7) Exit. 
    > 1 

    Retrieve (all/document/folder/presentation/spreadsheet/pdf): 
    Enter a category: all 
    TITLE              TYPE         RESOURCE ID 
    Whirld             spreadsheet  spreadsheet:--removed ID-- 
    Whirld Stats       spreadsheet  spreadsheet:--removed ID-- 
    Document List Sample 
    1) List your documents. 
    2) Search your documents. 
    3) Upload a document. 
    4) Download a document. 
    5) List a document's permissions. 
    6) Add/change a document's permissions. 
    7) Exit.

Everything seemed okay, other than the mysterious failure, so I
tried to run some code, just to see if I could get as far as to
initialize a DocsService:

import cgi 
from google.appengine.ext import webapp 
from google.appengine.ext.webapp.util import run_wsgi_app 
import gdata.docs 
import gdata.docs.service 
class MainPage(webapp.RequestHandler): 
    def post(self): 
        self.Test = self.request.get('Test') 
        self.respond(bool(1)) 
    def get(self): 
        self.respond(bool(0)) 
    def respond(self,isPost): 
        if isPost: 
                self.response.out.write("""Greetings. The value of Test is""" + 
self.Test) 
        else: 
                self.response.out.write("""ERROR -- Post data not given!""") 
        #gd_client = gdata.docs.service.DocsService(source='[removed]') 
        self.response.out.write("""Hahahahaha""") 
application = webapp.WSGIApplication([  ('/', MainPage) ], debug=True) 
#Run the basic code: 
def main(): 
    run_wsgi_app(application) 
if __name__ == "__main__": 
    main() 

However, when launching that code from the google app engine, and then
viewing it in safari, I am greeted to:

Traceback (most recent call last): 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 3245, in _HandleRequest 
    self._Dispatch(dispatcher, self.rfile, outfile, env_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 3186, in _Dispatch 
    base_env_dict=env_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 531, in Dispatch 
    base_env_dict=base_env_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 2410, in Dispatch 
    self._module_dict) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 2320, in ExecuteCGI 
    reset_modules = exec_script(handler_path, cgi_path, hook) 
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/ 
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/ 
google/appengine/tools/dev_appserver.py", line 2216, in 
ExecuteOrImportScript 
    exec module_code in script_module.__dict__ 
  File "/Users/user/Documents/Web Projects/Python/HelloWorld/ 
HelloWorld.py", line 4, in <module> 
    import gdata.docs 
ImportError: No module named gdata.docs

I'm not sure what's going wrong here, but any help would be deeply
appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半山落雨半山空 2024-10-18 13:36:22
sudo mv /usr/local/lib/python2.6/dist-packages/* /usr/lib/python2.6/dist-packages
sudo mv /usr/local/lib/python2.6/dist-packages/* /usr/lib/python2.6/dist-packages
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文