hello! everything was working fine until a couple of days ago and now.. Obviously I have no exact traceback of what was done on the machine, but I updated my gentoo box by emerging some apps (nothing apparently involving plone/zope/python/mysql...) :-( Now I really do not know where to bang my head..perhaps on re module?? thanks.. Stefano. when I call the external method zope returns this weird 'error 41': ... IndexError Value 41 details: Request URL http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_i... Exception Type IndexError Exception Value 41 Traceback (innermost last): Module ZPublisher.Publish, line 115, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 41, in call_object Module Products.ExternalMethod.ExternalMethod, line 225, in __call__ __traceback_info__: ((<Folder at /bibliosafety/admins_home/cabi_mgmt/import_tools>, <HTTPRequest, URL=http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_import>), {}, None) Module /var/lib/zope/zope-inst01/Extensions/cabi_import_em.py, line 38, in cabi_import IndexError: 41 Display traceback as text REQUEST form cabi_local_path '/home/stefano/biosafe200810.tag' cookies __ac 'dTAwMDAwMDE6dTAwMDAwMDE%3D' tree-s 'eJzT0MgpMOQKVneEA1dbda4CI67EkgJjLj0AeGcHew' lazy items SESSION <bound method SessionDataManager.getSessionData of <SessionDataManager at /session_data_manager>> other TraversalRequestNameStack [] AUTHENTICATED_USER <PloneUser 'u0000001'> URL 'http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_i...' SERVER_URL 'http://localhost:8081' AUTHENTICATION_PATH 'bibliosafety' __ac 'dTAwMDAwMDE6dTAwMDAwMDE%3D' PUBLISHED <ExternalMethod at /bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_import> cabi_local_path '/home/stefano/biosafe200810.tag' ACTUAL_URL 'http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_i...' URL0 http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_i... URL1 http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools URL2 http://localhost:8081/bibliosafety/admins_home/cabi_mgmt URL3 http://localhost:8081/bibliosafety/admins_home URL4 http://localhost:8081/bibliosafety URL5 http://localhost:8081 BASE0 http://localhost:8081 BASE1 http://localhost:8081 BASE2 http://localhost:8081/bibliosafety BASE3 http://localhost:8081/bibliosafety/admins_home BASE4 http://localhost:8081/bibliosafety/admins_home/cabi_mgmt BASE5 http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools BASE6 http://localhost:8081/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_i... environ HTTP_COOKIE '__ac="dTAwMDAwMDE6dTAwMDAwMDE%3D"; tree-s="eJzT0MgpMOQKVneEA1dbda4CI67EkgJjLj0AeGcHew"' SERVER_SOFTWARE 'Zope/(Zope 2.9.8-final, python 2.4.4, linux2) ZServer/1.1 Plone/2.5.5' SCRIPT_NAME '' REQUEST_METHOD 'GET' PATH_INFO '/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_import' SERVER_PROTOCOL 'HTTP/1.1' QUERY_STRING 'cabi_local_path=/home/stefano/biosafe200810.tag' channel.creation_time 1225111356 CONNECTION_TYPE 'Keep-Alive' HTTP_ACCEPT_CHARSET 'iso-8859-1, utf-8;q=0.5, *;q=0.5' HTTP_USER_AGENT 'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.9 (like Gecko)' HTTP_REFERER 'http://localhost:8081/bibliosafety/admins_home/index_html' SERVER_NAME '0.0.0.0' REMOTE_ADDR '127.0.0.1' PATH_TRANSLATED '/bibliosafety/admins_home/cabi_mgmt/import_tools/cabi_import' SERVER_PORT '8081' HTTP_PRAGMA 'no-cache' HTTP_HOST 'localhost:8081' HTTP_CACHE_CONTROL 'no-cache' HTTP_ACCEPT 'text/html, image/jpeg, image/png, text/*, image/*, */*' GATEWAY_INTERFACE 'CGI/1.1' HTTP_ACCEPT_LANGUAGE 'it, en' HTTP_ACCEPT_ENCODING 'x-gzip, x-deflate, gzip, deflate' lines: 01 import re 02 def cabi_import(self, REQUEST): ... 30 for cabi_data_record in cabi_data_recordset: 31 temp_dict_row = {} 32 fieldpos = 0 33 counter = 0 34 """ calculate the total number of fields of the record """ 35 fieldmax = self.sql_queries.query_05() 36 """ take each field content until the end of the record """ 37 while fieldpos < fieldmax[0]["col_count"]: 38 cabi_data_field = cabi_data_record[fieldpos] 39 """ strips excess whitespaces """ 40 re_pattern = re.compile('\s+') 41 cabi_data_field = re_pattern.sub(' ', cabi_data_field) ... """ other regexps """ ... query_05 = SELECT COUNT(*) AS 'col_count' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'cabi_data'
The traceback tells you where the error occurs: On 27.10.2008 14:04 Uhr, Peace&Love wrote:
37 while fieldpos< fieldmax[0]["col_count"]: 38 cabi_data_field = cabi_data_record[fieldpos]
Further investigations are up to you - we have no idea what's in your database or what has changed. The only thing that the traceback tells us: you're accessing data at index position 41 that does not exist. Take pdb for debugging or add print statement for making your code more verbose but the investigations must happen on your side. -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535 Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK ------------------------------------------------------------------------ E-Publishing, Python, Zope & Plone development, Consulting
participants (2)
-
Andreas Jung -
Peace&Love