I'm not familar with the module, but could you try
catching the exception and creating the object regardless
of the response?

Eric

On Dec 29 2008, 5:53 pm, Jim <[email protected]> wrote:
> yes ,but because of 503 response ,the database (database =
> client.CreateDatabase('My Text Database') ) will be NOT defined. And I
> couldn't use this variable and its method CreateTable
>
> how can I ?
> ------
> Sincerely!
> Jim
>
> On Tue, Dec 30, 2008 at 12:13 AM, Eric (Google) <[email protected]> wrote:
>
> > This is related to an outstanding bug:
> >http://code.google.com/p/gdata-issues/issues/detail?id=929
>
> > In most cases, the spreadsheet is created/updated even
> > though the response is 503.
>
> > Eric
>
> > On Dec 29, 7:59 am, Jim <[email protected]> wrote:
> > > OS:Windows XP SP3
> > > Python 2.5.2
> > > Python Gdata Lib 1.2.3
>
> > > my code is:
>
> > > import gdata.spreadsheet.text_db
> > > client = gdata.spreadsheet.text_db.DatabaseClient
> > > (username='[email protected]',
> > >     password='12345')
>
> > > database = client.CreateDatabase('My Text Database')
> > > table = database.CreateTable('addresses', ['name','email',
> > >     'phonenumber', 'mailingaddress'])
> > > record = table.AddRecord({'name':'Bob', 
> > > 'email':'[email protected]<email%27%3a%[email protected]>
> > ',
> > >     'phonenumber':'555-555-1234', 'mailingaddress':'900 Imaginary
> > > St.'})
>
> > > # Edit a record
> > > record.content['email'] = '[email protected]'
> >  > record.Push()
>
> > > # Delete a table
> > > table.Delete
>
> > > but the Python Runtime shows:
>
> > > Traceback (most recent call last):
> > >   File "1.py", line 11, in <module>
> > >     database = client.CreateDatabase('My Text Database')
> > >   File "/usr/lib/python2.5/site-packages/gdata/spreadsheet/
> > > text_db.py", line 146
> > > , in CreateDatabase
> > >     db_entry = self.__docs_client.UploadSpreadsheet
> > > (virtual_media_source, name)
> > >   File "/usr/lib/python2.5/site-packages/gdata/docs/service.py", line
> > > 168, in Up
> > > loadSpreadsheet
> > >     return self._UploadFile(media_source, title, category)
> > >   File "/usr/lib/python2.5/site-packages/gdata/docs/service.py", line
> > > 207, in _U
> > > ploadFile
> > >     extra_headers = {'Slug' : media_source.file_name })
> > >   File "/usr/lib/python2.5/site-packages/gdata/service.py", line 1136,
> > > in Post
> > >     media_source=media_source, converter=converter)
> > >   File "/usr/lib/python2.5/site-packages/gdata/service.py", line 1256,
> > > in PostOr
> > > Put
> > >     'reason': server_response.reason, 'body': result_body}
> > > gdata.service.RequestError: {'status': 503, 'body': 'An unknown error
> > > has occurr
> > > ed.', 'reason': 'Service Unavailable'}
>
> > > Why?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to