#NEWLINE# def _ndarray_to_variant_array( value ) : #NEWLINE# #INDENT# ' Convert an ndarray to VARIANT_dtype array ' #NEWLINE# if ( npsupport . VARIANT_dtype is None ) : #NEWLINE# #INDENT# msg = 'VARIANT ndarrays require NumPy 1.7 or newer.' #NEWLINE# raise RuntimeError ( msg ) #NEWLINE# #UNINDENT# if numpy . issubdtype ( value . dtype , npsupport . datetime64 ) : #NEWLINE# #INDENT# return _datetime64_ndarray_to_variant_array ( value ) #NEWLINE# #UNINDENT# from comtypes.automation import VARIANT #NEWLINE# varr = numpy . zeros ( value . shape , npsupport . VARIANT_dtype , order = 'F' ) #NEWLINE# varr . flat = [ VARIANT ( v ) for v in value . flat ] #NEWLINE# return varr