By Lotusv , 26 April, 2022 Forums Gurux.DLMS When using the function GXDateTime.toUnixTime GXDT = GXDLMSClient.changeType(Var1, DataType.DATETIME) DT = GXDT.toUnixTime(GXDT) Got an error in the module: "GXDateTime.toUnixTime isinstance() arg 2 must be a type or tuple of types" I propose to change isinstance(value, (datetime)) on isinstance(value, type(datetime)) @classmethod def toUnixTime(cls, value): ___if isinstance(value, type(datetime)): ______return value.utctimetuple() ___if isinstance(value, (GXDateTime)): ______return value.value.utctimetuple() ___return int(value.value / 1000) And check the reverse conversion. I haven't used or tested it... Hi, Hi, You are right. There is an issue on toUnixTime. It should be like this: if isinstance(value, (datetime.datetime)): This is fixed and the new version is released today. BR, Mikko
Hi, Hi, You are right. There is an issue on toUnixTime. It should be like this: if isinstance(value, (datetime.datetime)): This is fixed and the new version is released today. BR, Mikko
Hi,
Hi,
You are right. There is an issue on toUnixTime. It should be like this:
if isinstance(value, (datetime.datetime)):
This is fixed and the new version is released today.
BR,
Mikko