Still trying to learn

Arinté jamarijr at hotmail.com
Tue Apr 18 09:05:49 EDT 2000


I have this code here

	def IOCTL(self, comm, args):
		command1 = long(0)
		try:
			if type(comm)==type(2):
				poss.alert("Totally")
		except:
			command1 = comm
			print sys.exc_type
			print sys.exc_value
			return -1
		if type(comm)==type(long(2)):
			print "IOCTL was int"
			command1 = long(comm)
			print "IOCTL Set to Long"
		else:
			if type(comm) == type("  "):
				print "IOCTL was a string"
				command1 = comm
			else:
				if type(comm)!=type(2L):
					print "IOCTL fail"
					return -1
		poss.IOCtl(self.devname,command1,args)
		return 0

The poss object is going to my c\c++ app and I have traced thru it and
it seems to pass back valid values everytime.  The problem I am having
is on the 2nd call to this function the try..except fails with this
error:

exceptions.TypeError
len() of unsized object

Here is how I make the call
for i in range(10000):
	res = nex.IOCTL("POS_SYS_ACQUIRE_DEVICE",0)
	if res <0:
		break
	else:
		poss.alert("OK")

Thanx and sorry for the long post.




Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list