google gdata External Method doesn't work script does
I am using the gdata library from google and my script works as a standalone but when I try to use it as an External Method I get an error: ssl() argument 1 must be _socket.socket, not _socketobject I suspect it is from the python socket library but I don't know why I am getting this error or how to avoid it. ######################## Zope Version (Zope 2.10.3-final, python 2.4.3, linux2) Python Version 2.4.3 (#1, Mar 14 2007, 18:51:08) [GCC 4.1.1 20070105 (Red Hat 4.1.1-52)] System Platform linux2 ######################## Exception Type TypeError Exception Value ssl() argument 1 must be _socket.socket, not _socketobject Traceback (innermost last): Module ZPublisher.Publish, line 119, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 42, in call_object Module OFS.DTMLMethod, line 144, in __call__ <DTMLMethod at /calendar/scheduling/addevent> URL: http://www.library.appstate.edu/calendar/scheduling/addevent/manage_main Physical Path:/calendar/scheduling/addevent Module DocumentTemplate.DT_String, line 476, in __call__ Module Products.ExternalMethod.ExternalMethod, line 238, in __call__ __traceback_info__: ((), {}, None) Module /var/zope/Extensions/gdata_add2_421.py, line 59, in add2google421 Module gdata.service, line 289, in ProgrammaticLogin Module httplib, line 798, in endheaders Module httplib, line 679, in _send_output Module httplib, line 646, in send Module httplib, line 1073, in connect Module socket, line 74, in ssl TypeError: ssl() argument 1 must be _socket.socket, not _socketobject Below is my script with logins and passwords changed public view here. When I use it as an External Method I have a "def add2gcal(self):" and indent everything 2 spaces. ***************************Script import psycopg2 import psycopg2.extensions import psycopg2.extras from elementtree import ElementTree import gdata.calendar.service import gdata.service import atom.service import gdata.calendar import atom import getopt import sys import string import time import datetime DSN = "dbname='MY_calendar' user='myuser' port='1234' host='127.0.0.1' password='"my_password" conn = psycopg2.connect(DSN) curs = conn.cursor(cursor_factory=psycopg2.extras.DictCursor) curs.execute("SELECT last_value from cal_xxx_cal_xxx_recnum_seq;") lastrec=curs.fetchone() curs.execute("SELECT summary,submitter,description,location,start_date,start_time,end_date,end_time,cal_421_recnum from cal_421 where cal_ 421_recnum=%s;"%lastrec[0]) mit=curs.fetchall() curs.close() calendar_id="YOUR ID HERE" calendar_service = gdata.calendar.service.CalendarService() calendar_service.email = 'my_email@my.server' calendar_service.password = 'my_password' calendar_service.source = 'My Calendar' calendar_service.ProgrammaticLogin() for myrec in mit: title = '%s' %myrec[2] author = '%s' %myrec[1] content = '%s' %myrec[2] where = '%s' %myrec[3] endtime = '%s' %myrec[7] enddate ='%s' %myrec[6] start_time = '%sT%s' %(myrec[4],myrec[5]) end_time = '%sT%s' %(myrec[6],myrec[7]) event = gdata.calendar.CalendarEventEntry() event.title = atom.Title(text=title) event.author = atom.Author(text=author) event.content = atom.Content(text=content) event.where.append(gdata.calendar.Where(value_string=where)) event.when.append(gdata.calendar.When(start_time=start_time, end_time=end_time)) # INSERT ENTRY INTO GOOGLE CALENDAR new_event = calendar_service.InsertEvent(event, '/calendar/feeds/'+calendar_id+'/private/full') Thanks for any help. Thomas -- ==================================================================== Thomas McMillan Grant Bennett Appalachian State University Operations & Systems Analyst P O Box 32026 University Library Boone, North Carolina 28608 (828) 262 6587 They say a picture is worth a thousand words. As videos could be 25 pictures per second and might last several minutes, how many words is that? - Linux Journal, July 2007 Library Systems Help Desk: http://www.library.appstate.edu/help/ ====================================================================
Thomas Bennett wrote at 2008-2-4 10:33 -0500:
... Traceback (innermost last): ... Module /var/zope/Extensions/gdata_add2_421.py, line 59, in add2google421 Module gdata.service, line 289, in ProgrammaticLogin Module httplib, line 798, in endheaders Module httplib, line 679, in _send_output Module httplib, line 646, in send Module httplib, line 1073, in connect Module socket, line 74, in ssl TypeError: ssl() argument 1 must be _socket.socket, not _socketobject
Below is my script with logins and passwords changed public view here. When I use it as an External Method I have a "def add2gcal(self):" and indent everything 2 spaces.
***************************Script ... calendar_id="YOUR ID HERE" calendar_service = gdata.calendar.service.CalendarService() calendar_service.email = 'my_email@my.server' calendar_service.password = 'my_password' calendar_service.source = 'My Calendar' calendar_service.ProgrammaticLogin() ...
I fear this is a difficult problem. It looks like a problem local to "httplib" (the sockets used by "httplib" are created only by "httplib" itself). On the other hand, it is unclear why "httplib" should have problems with its sockets. As with all difficult problems, the help of a debugger may be necessary.... -- Dieter
participants (2)
-
Dieter Maurer -
Thomas Bennett