vb's cDate equivalent with COM

Hoon yelled at yahoo.com
Thu Sep 27 22:59:49 EDT 2001


Hi,

  I have following ActiveX control that takes VB's cDate as argument.
For some reason, I cannot get it to work. I tried COM dates using
DateTime and also pywintypes.Time, which crashes the whole COM with
one of those unintelligiable memory access violation error msgs. Does
anyone have any idea? This is Bloomberg Data control (as you may know
the NYC mayor hopeful).
  Thanks,

Hoon,

Gen_Py output:---------------------------------------------------------------
	def Subscribe(self, Security=defaultNamedNotOptArg,
cookie=defaultNamedNotOptArg, Fields=defaultNamedNotOptArg,
OverrideFields=defaultNamedOptArg, Overrides=defaultNamedOptArg,
Results=defaultNamedOptArg, Monitor=defaultNamedOptArg):
		"""method Subscribe"""
		return self._ApplyTypes_(0x1, 1, (24, 0), ((12, 1), (3, 1),
(12, 1), (12, 17), (12, 17), (16396, 18), (12, 17)), 'Subscribe',
None,Security, cookie, Fields, OverrideFields, Overrides, Results, 
Monitor)


VB Prog:----------------------------------------------------------------
dtStart = CDate((Year(Date) - 1) & "/" & Month(Date) & "," &
Day(Date))
dtEnd = Date
aryFields(0) = 1376
For i = 0 To UBound(vSyms)
    sym$ = vSyms(i) & " Index"
    'sym$ = "IBM Equity"
    BlpData1.GetHistoricalData sym, i + 1, aryFields, dtStart, dtEnd
Next i

Python:----------------------------------------------------------------
	#BLP.Subscribe(vSyms[i], i, aryFields, )
	#BLP.GetHistoricalData(vSyms[i], i,
aryFields,D.DateTime(2000,12,12).COMDate(),
D.DateTime(2000,12,22).COMDate())
	#bt = pythoncom.MakeTime(time.time()-3000000)
	#et = pythoncom.MakeTime(time.time())
	bt = pywintypes.Time(time.time()-3000000)
	et = pywintypes.Time(time.time())
	print bt,et
	BLP.Subscribe(vSyms[i], i, aryFields, bt, et) # CRASH!
	BLP.Flush()



More information about the Python-list mailing list