Hi. I am trying to read a meter using tcp / ip using the gurux_dlms and gurux_net libraries in python2.7. Python 2.7 is the version that I have available in my system. But, when I run my script it shows me the following error.
Traceback (most recent call last):
File "readRMSMeter.py", line 40, in <module>
client.authentication = Authentication["LOW"]
TypeError: 'type' object has no attribute '__getitem__'
I am assigning the necessary information for the connection directly, as follows
from gurux_common.enums import TraceLevel
from gurux_dlms.secure import GXDLMSSecureClient
from gurux_common.io import Parity, StopBits
from gurux_common import ReceiveParameters, TimeoutException
from gurux_dlms import GXByteBuffer, GXReplyData, GXDLMSTranslator, GXDLMSException
from gurux_dlms.enums import InterfaceType, ObjectType, Authentication, DataType, Security
from gurux_dlms.objects import GXDLMSObject, GXDLMSRegister, GXDLMSDemandRegister, GXDLMSProfileGeneric, GXDLMSObjectCollection
from gurux_net.enums import NetworkType
from gurux_net import GXNet
Can someone help me please to identify why this error happens, since in GXDLMSClient and Authentication, I don't see this '__getitem__' parameter or method.
Thanks for your collaboration, I really appreciate it. The problem was corrected, but I can't connect yet with the meter. My script work in python 3.5, so I try again with the the example given in the gurux github in python2.7. And I'm giving the follow parameters:
Authentication: 1
ClientAddress: 0x1
ServerAddress: 0x91
DisconnectRequest
Traceback (most recent call last):
File "main.py", line 80, in main
reader.readAll()
File "/home/dev/rms/GXDLMSReader.py", line 423, in readAll
self.initializeConnection()
File "/home/dev/rms/GXDLMSReader.py", line 241, in initializeConnection
self.client.parseAareResponse(reply.data)
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/GXDLMSClient.py", line 522, in parseAareResponse
self.isAuthenticationRequired = _GXAPDU.parsePDU(self.settings, self.settings.cipher, reply, None) == SourceDiagnostic.AUTHENTICATION_REQUIRED
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/_GXAPDU.py", line 641, in parsePDU
ret = _GXAPDU.parsePDU2(settings, cipher, buff, xml)
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/_GXAPDU.py", line 792, in parsePDU2
_GXAPDU.updateAuthentication(settings, buff)
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/_GXAPDU.py", line 959, in updateAuthentication
settings.authentication = Authentication(ch)
TypeError: object() takes no parameters
Ended. Press any key to continue.
Thank you very much for your help. The errors that I had were fixed. Im working with two linux distros, openSuSE Tumbleweed and an Openwrt, in the last is where I will leave it running at the end. Again Thanks.
Hi,
Hi,
I belive that reason for this is this line:
client.authentication = Authentication["LOW"]
Try to use this:
client.authentication = Authentication.LOW
BR,
Mikko
Thanks for your collaboration
Thanks for your collaboration, I really appreciate it. The problem was corrected, but I can't connect yet with the meter. My script work in python 3.5, so I try again with the the example given in the gurux github in python2.7. And I'm giving the follow parameters:
$> python main.py -h 127.0.0.1 -p 8082 -c 1 -s 145 -P ABCDEFGH -a Low -i
and show me this error:
Authentication: 1
ClientAddress: 0x1
ServerAddress: 0x91
DisconnectRequest
Traceback (most recent call last):
File "main.py", line 80, in main
reader.readAll()
File "/home/dev/rms/GXDLMSReader.py", line 423, in readAll
self.initializeConnection()
File "/home/dev/rms/GXDLMSReader.py", line 241, in initializeConnection
self.client.parseAareResponse(reply.data)
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/GXDLMSClient.py", line 522, in parseAareResponse
self.isAuthenticationRequired = _GXAPDU.parsePDU(self.settings, self.settings.cipher, reply, None) == SourceDiagnostic.AUTHENTICATION_REQUIRED
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/_GXAPDU.py", line 641, in parsePDU
ret = _GXAPDU.parsePDU2(settings, cipher, buff, xml)
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/_GXAPDU.py", line 792, in parsePDU2
_GXAPDU.updateAuthentication(settings, buff)
File "/home/dev/lib/python2.7/site-packages/gurux_dlms/_GXAPDU.py", line 959, in updateAuthentication
settings.authentication = Authentication(ch)
TypeError: object() takes no parameters
Ended. Press any key to continue.
Can help me, please?
Hi,
Hi,
Are you running this on Linux? What is your distro?
Can you modify the package? Change this line from :GXAPU.py:
settings.authentication = Authentication(ch)
to:
settings.authentication = ch
We'll change this and publish a new version on Monday.
BR,
Mikko
Thank you very much for your
Thank you very much for your help. The errors that I had were fixed. Im working with two linux distros, openSuSE Tumbleweed and an Openwrt, in the last is where I will leave it running at the end. Again Thanks.
Hi,
Hi,
We'll test this with OpenSuSE also on Monday.
BR,
Mikko
Hi,
Hi,
A new version (1.0.36) is released where this is fixed.
BR,
Mikko