I am working in python based on a Java code.
I have this in Java:
public static byte[] datosOEM = new byte[900000];
public static byte x1=0,x2=0,x3=0,x4=0,x5=0,x6=0;
I wrote this in Python following some documents that I found:
datosOEM=bytes([0x90, 0x00, 0x00])
x1=bytes([0x00])
x2=bytes([0x00])
x3=bytes([0x00])
x4=bytes([0x00])
x5=bytes([0x00])
x6=bytes([0x00])
When I run my program it shows me this:
Traceback (most recent call last):
File "test.py", line 63, in <module>
x1=datosOEM[k];
IndexError:string index out of range
How I can fix this problem? Any help is well received.
Part of my code is this:
...
response=port.read(8)
print(response)
k=0
C=0
conexion=True
if(conexion):
while(response>200):
while(C==0):
x1=datosOEM[k];
if(x1=1):
x2=datosOEM[k+1];
...
Also, what can I do to not repeat that mistake again?
Thank you in advance for your help
This post was editated by JasonMArcher, thank you much for this.