List limitations?

Daley, MarkX markx.daley at
Thu Mar 23 17:10:55 CET 2000

As a follow up, I did figure out that when the second server is queried, the
familynames used are not the original names in the list, but the characters
in one of the names in the original list.  I have no idea why this is

- Mark

OK, here's a good one:

I am using this glorious little piece of code, which I will explain in

def collect():
	familyname = ['name1', 'name2', 'name3', 'name4', 'name5', 'name6',
'name7', 'name8', 'name9', 'name10', 'name11', 'name12']
	servername = ['server1', 'server2']
	sql_date = time.strftime('%Y'+"-"+'%m'+"-"+'%d
%H'+":"+'%M'+":"+'%S', time.localtime(time1[0]))
	current_date = time.strftime('%Y'+"-"+'%m'+"-"+'%d
%H'+":"+'%M'+":"+'%S', time.localtime(time2[0]))
	file_date = time.strftime('%m'+"_"+'%d'+"_"+'%Y',
	for index in servername:
		dbc = odbc.odbc(index+'/username/password')
		crsr = dbc.cursor()
		for name in familyname:
			crsr.execute("""select * from subtestlist\n\
where (errorcode<>'null'\n\
AND familyname='"""+name+"""'\n\
AND Packagestarttime>'"""+sql_date+"""'\n\
AND Packagestarttime<='"""+current_date+"""');""")
			result = crsr.fetchall()
			for item in range(len(result)):
				data1, data2, data3, data4, data5, data6,
data7, data8, data9, data10, data11, data12, data13, data14, data15, data16,
data17 = result[item]
				data10 = time.ctime(data10)
				data11 = time.ctime(data11)
				result[item] = (data1, data2, data3, data4,
data5, data6, data7, data8, data9, data10, data11, data12, data13, data14,
data15, data16, data17)
			mylist = result[:]
			f = open(index+'_'+name+'_'+file_date+'.txt','a')
			for item in mylist:

What this does is connect to a server and pull data from it based on each
family name in the familyname list, using an SQL query.  Conceivably, this
code should connect to server1 and pull data for all familynames and write
that data to a file, server_familyname_date.  Then it should connect to
server2 and do the same.  However, when it connects to server 2, it isn't
pulling the familynames from the familyname list correctly.  Instead, it is
pulling single character strings, like a, b, e, g, h, r, S (these are the
actual strings, which may or may not have some bearing on one of my
familyname entries, I haven't been able to verify).  Has anyone else seen
problem remotely related to this?  Any help is appreciated.



Mark Daley
Test Engineer

More information about the Python-list mailing list