Closed Andreas-strg closed 5 months ago
Ok, this seems to be at least two problems at once.
The traceback you posted indicates an error in your script. last_error
is not a function but a variable. I checked and this is an error that is also present in the readme file. This will be corrected in the next version.
Debugging the original error based on only one error is a bit tricky. Can you maybe post a bit more detailed error log?
Sorry for the stupid question, but how can I easily get the logs that are relevant to you 🙈
last error:
ic| con.last_error.e_code: <LSV2StatusCode.T_ER_NON: -1>
ic| con.last_error.e_type: -1
ic| con.last_error.__doc__: 'data class for LSV2 errors'
ic| con.last_error.__module__: 'pyLSV2.dat_cls'
Loggin in python is, most of the time, done with the logging library. I you are new to python I would recommend to look into this library because with the different logging levels it makes it easy to get more detailed information while also not burdening the user with to many messages.
A quick and dirty way to get logging you can just add import logging
and logging.basicConfig(level=logging.DEBUG)
to your script. With this you should immediately get log messages in your terminal window. For example the line
con = pyLSV2.LSV2("192.168.56.100")
should print the following two lines:
DEBUG:LSV2 TCP:Socket successfully created, host 192.168.56.100 was resolved to IP 192.168.56.100
INFO:LSV2 Client:enabling safe mode. restricting functionality
These messages will let me analyze the problem. It would also be helpful if you could post the actual code you are running so I can make shure where the problem might be.
thank you for your patience I just used a simple file to illustrate, but tested it with different files pyLSV2 test.zip
binary_mode=True does not cause an error, but the file is not in the correct format on the controller
Testet one of the last iTNC530 606420 02 SP10 (HSCI Version)
DEBUG:LSV2 TCP:Socket successfully created, host 172.29.48.76 was resolved to IP 172.29.48.76
INFO:LSV2 Client:enabling safe mode. restricting functionality
DEBUG:LSV2 TCP:Connected to host 172.29.48.76 at port 19000
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LG payload length 8 bytes data: bytearray(b'\x00\x00\x00\x08A_LGINSPECT\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:login executed successfully for login INSPECT
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x01')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x02')
DEBUG:LSV2 TCP:received block of data with length 23
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x03')
DEBUG:LSV2 TCP:received block of data with length 25
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x04')
DEBUG:LSV2 TCP:received block of data with length 186
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x05')
DEBUG:LSV2 TCP:received block of data with length 21
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x07')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 24 'LSV2_ERROR_T_ER_WRONG_PARA'
DEBUG:LSV2 Client:got version info: iTNC530 / 606420 02 SP10
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_PR payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00R_PR')
DEBUG:LSV2 TCP:received block of data with length 132
DEBUG:LSV2 Client:expected response received: RSP.S_PR
DEBUG:LSV2 Client:got system parameters: <pyLSV2.dat_cls.SystemParameters object at 0x00000295CEBF3F80>
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x01')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_CI
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x02')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_CI
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x03')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_CI
DEBUG:LSV2 Client:setting connection settings for ControlType.MILL_OLD and block length 4096
DEBUG:LSV2 Client:use buffer size of 4096
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_CC payload length 2 bytes data: bytearray(b'\x00\x00\x00\x02C_CC\x00\x07')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_CC payload length 2 bytes data: bytearray(b'\x00\x00\x00\x02C_CC\x00\x13')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:secure file send is enabled
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LG payload length 5 bytes data: bytearray(b'\x00\x00\x00\x05A_LGFILE\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:login executed successfully for login FILE
INFO:LSV2 Client:successfully configured connection parameters and basic logins
iTNC530
606420 02 SP10
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_DC payload length 6 bytes data: bytearray(b'\x00\x00\x00\x06C_DCTNC:\\\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:changed working directory to TNC:\
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_DC payload length 5 bytes data: bytearray(b'\x00\x00\x00\x05C_DCTNC:\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:changed working directory to TNC:
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_DI payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00R_DI')
DEBUG:LSV2 TCP:received block of data with length 178
DEBUG:LSV2 Client:expected response received: RSP.S_DI
DEBUG:LSV2 Client:successfully received directory information for TNC:\
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_FI payload length 12 bytes data: bytearray(b'\x00\x00\x00\x0cR_FITNC:\\test.H\x00')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 32 'LSV2_ERROR_T_ER_NO_FILE'
DEBUG:LSV2 Client:file does not exist
DEBUG:LSV2 Client:ready to send file from H:\python\pyTNC\pyLSV2\test.H to TNC:\test.H
DEBUG:LSV2 Client:selecting non binary transfer mode
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_FL payload length 13 bytes data: bytearray(b'\x00\x00\x00\rC_FLTNC:\\test.H\x00\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 TCP:telegram to transmit: command RSP.S_FL payload length 3022 bytes data: bytearray(b'\x00\x00\x0b\xceS_FL0 BEGIN PGM uniFase MM \r\n1 CYCL DEF 25 KONTUR-ZUG ~\r\n Q1=+Q1 ;FRAESTIEFE ~\r\n Q3=+Q3 ;AUFMASS SEITE ~\r\n Q5=+Q5 ;KOOR. OBERFLAECHE
~\r\n Q7=+Q7 ;SICHERE HOEHE ~\r\n Q10=+Q10 ;ZUSTELL-TIEFE ~\r\n Q11=+Q11 ;VORSCHUB TIEFENZ. ~\r\n Q12=+Q12 ;VORSCHUB RAEUMEN ~\r\n Q15=+Q15 ;FRAESART\r\n2 Q6 = Q6 ;Sicherheits Abstand\r\n3 Q1403 = Q1403 ;Winkel\r\n4 Q1404 = Q1404 ;Breite Zeilflaech
e\r\n5 Q1405 = Q1405 ;Zeilrichtung (1/-1)\r\n6 Q1406 = Q1406 ;Fahren auf S.Hoehe?\r\n7 ;\r\n8 * - Fehlenden Wert Berrechnen\r\n9 FN 10: IF +Q1403 NE +0 GOTO LBL 20\r\n10 Q1403 = ATAN ( Q1404 / ABS Q1 ) ;Winkel\r\n11 LBL 20\r\n12 FN 10: IF +Q1404 NE +0 GOTO LBL 21\r\n
13 Q1404 = TAN Q1403 * ABS Q1 ;Breite\r\n14 LBL 21\r\n15 FN 10: IF +Q1 NE +0 GOTO LBL 22\r\n16 Q1 = 0 - ( Q1404 / TAN Q1403 ) ;Tiefe (negativer Wert)\r\n17 LBL 22\r\n18 ;\r\n19 * - ERROR\r\n20 FN 10: IF +Q6 NE +0 GOTO LBL 252\r\n21 Q6 = 0.0001 ;mindestwert\r\n22 LBL 252\r
\n23 FN 11: IF +0 GT +Q1 GOTO LBL 253\r\n24 FN 14: ERROR= 1077 ;VORZEICHEN FRAESTIEFE\r\n25 LBL 253\r\n26 ;\r\n27 * - Zyklusparameter sichern\r\n28 Q71 = Q1 ;FRAESTIEFE\r\n29 Q73 = Q3 ;AUFMASS SEITE\r\n30 Q77 = Q7 ;SICHERE HOEHE\r\n31 Q78 = Q10 ;ZUSTELL-TIEFE\r\n32 Q79 =
Q15 ;FRAESART\r\n33 ;\r\n34 * - Versatz fuer Kugelfraeser errechnen:\r\n35 FN 18: SYSREAD Q90 = ID20 NR1 ;WZ #\r\n36 FN 18: SYSREAD Q91 = ID20 NR11 ;WZ Index\r\n37 FN 18: SYSREAD Q92 = ID50 NR3 IDXQ90 .Q91 ;DR2\r\n38 FN 18: SYSREAD Q93 = ID50 NR6 IDXQ90 .Q91 ;Aufmass DR2\
r\n39 Q94 = Q92 + Q93 ;Aktiver DR2\r\n40 Q95 = - Q94 + ( Q94 * COS Q1403 ) ;Werkzeugversatz XY\r\n41 Q96 = - Q94 + ( Q94 * SIN Q1403 ) ;Werkzeugversatz Z\r\n42 ;\r\n43 * - Zeilschritte ermitteln\r\n44 Q80 = INT ( SQRT ( - Q1 ^ 2 + Q1404 ^ 2 ) / - Q10 + 0.5 ) ;Anzahl Schri
tte\r\n45 Q81 = - Q1 / Q80 ;Versatz Z inkremental\r\n46 Q82 = Q1404 / Q80 ;Versatz XZ inkremental\r\n47 ;\r\n48 * - Zyklusparameter beschreiben\r\n49 FN 18: SYSREAD Q39 = ID220 NR2 IDX3 ;Z-NPV Speichern\r\n50 Q40 = Q6 + Q96 + Q39 ;Aktueller wert Z\r\n51 Q1 = - Q6 ;Fraesti
efe\r\n52 Q3 = - Q1404 + Q95 + Q3 ;Zaehler XY\r\n53 Q7 = 0.0001 ;SICHERE HOEHE\r\n54 Q10 = - 100 ;Zustellung\r\n55 * - Zeilrichtung +1\r\n56 FN 10: IF +Q1405 NE +1 GOTO LBL 25\r\n57 Q40 = Q40 + Q71\r\n58 Q3 = Q3 + Q1404\r\n59 Q81 = - Q81\r\n60 Q82 = - Q82\r\n61 LBL 25\r
\n62 ;\r\n63 * - Zeilen\r\n64 FN 18: SYSREAD Q0 = ID270 NR1 IDX3 ;Z Pos.\r\n65 FN 11: IF +Q0 GT +Q77 GOTO LBL 1\r\n66 L Z+Q77 R0 FMAX\r\n67 LBL 1\r\n68 CYCL DEF 7.0 NULLPUNKT\r\n69 CYCL DEF 7.1 Z+Q40\r\n70 CYCL CALL\r\n71 FN 10: IF +Q1406 NE +1 GOTO LBL 28\r\n72 Q50 = A
BS Q40 + Q77 ;SICHERE HOEHE\r\n73 L Z+Q50 R0 FMAX\r\n74 LBL 28\r\n75 Q40 = Q40 - Q81 ;Z\r\n76 Q3 = Q3 + Q82 ;XY\r\n77 FN 10: IF +Q79 NE +0 GOTO LBL 30\r\n78 FN 12: IF +Q15 LT +0.1 GOTO LBL 29\r\n79 Q15 = - 1\r\n80 FN 9: IF +0 EQU +0 GOTO LBL 30\r\n81 LBL 29\r\n82 FN 11:
IF +Q15 GT +0 GOTO LBL 30\r\n83 Q15 = 1\r\n84 LBL 30\r\n85 CALL LBL 1 REPQ80\r\n86 CYCL DEF 7.0 NULLPUNKT\r\n87 CYCL DEF 7.1 Z+Q39\r\n88 ;\r\n89 * - Zyklusparameter wiederherstellen\r\n90 Q1 = Q71 ;FRAESTIEFE\r\n91 Q3 = Q73 ;AUFMASS SEITE\r\n92 Q7 = Q77 ;SICHERE HOEHE\r\
n93 Q10 = Q78 ;ZUSTELL-TIEFE\r\n94 Q15 = Q79 ;FRAESART\r\n95 END PGM uniFase MM \r\n')
DEBUG:LSV2 TCP:received block of data with length 10
WARNING:LSV2 Client:could not send data, received unexpected response 'RSP.T_BD'
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LO payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00A_LO')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
INFO:LSV2 Client:logout executed successfully for login None
DEBUG:LSV2 TCP:Connection to 172.29.48.76 closed
DEBUG:LSV2 Client:connection to host closed
On a "little" bit older iTNC530 Version, and the same programm another error occurs (here binary_mode=True/False makes no sense)
DEBUG:LSV2 TCP:Socket successfully created, host 172.29.48.16 was resolved to IP 172.29.48.16
INFO:LSV2 Client:enabling safe mode. restricting functionality
DEBUG:LSV2 TCP:Connected to host 172.29.48.16 at port 19000
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LG payload length 8 bytes data: bytearray(b'\x00\x00\x00\x08A_LGINSPECT\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:login executed successfully for login INSPECT
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x01')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x02')
DEBUG:LSV2 TCP:received block of data with length 18
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x03')
DEBUG:LSV2 TCP:received block of data with length 20
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x04')
DEBUG:LSV2 TCP:received block of data with length 26
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x05')
DEBUG:LSV2 TCP:received block of data with length 32
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x07')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 24 'LSV2_ERROR_T_ER_WRONG_PARA'
DEBUG:LSV2 Client:got version info: iTNC530 / 340422 13
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_PR payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00R_PR')
DEBUG:LSV2 TCP:received block of data with length 132
DEBUG:LSV2 Client:expected response received: RSP.S_PR
DEBUG:LSV2 Client:got system parameters: <pyLSV2.dat_cls.SystemParameters object at 0x0000017A43083FB0>
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x01')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 22 'LSV2_ERROR_T_ER_UNKNOWN_TELE'
WARNING:LSV2 Client:an error occurred while querying system information on turbo mode
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x02')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 22 'LSV2_ERROR_T_ER_UNKNOWN_TELE'
WARNING:LSV2 Client:an error occurred while querying system information on dnc mode
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x03')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 22 'LSV2_ERROR_T_ER_UNKNOWN_TELE'
WARNING:LSV2 Client:an error occurred while querying system information on axes samling rate
DEBUG:LSV2 Client:setting connection settings for ControlType.MILL_OLD and block length 4096
DEBUG:LSV2 Client:use buffer size of 4096
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_CC payload length 2 bytes data: bytearray(b'\x00\x00\x00\x02C_CC\x00\x07')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_CC payload length 2 bytes data: bytearray(b'\x00\x00\x00\x02C_CC\x00\x13')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 24 'LSV2_ERROR_T_ER_WRONG_PARA'
DEBUG:LSV2 Client:secure file transfer not supported? use fallback
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LG payload length 5 bytes data: bytearray(b'\x00\x00\x00\x05A_LGFILE\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:login executed successfully for login FILE
INFO:LSV2 Client:successfully configured connection parameters and basic logins
iTNC530
340422 13
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_DC payload length 6 bytes data: bytearray(b'\x00\x00\x00\x06C_DCTNC:\\\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:changed working directory to TNC:\
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_DC payload length 5 bytes data: bytearray(b'\x00\x00\x00\x05C_DCTNC:\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:changed working directory to TNC:
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_DI payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00R_DI')
DEBUG:LSV2 TCP:received block of data with length 178
DEBUG:LSV2 Client:expected response received: RSP.S_DI
DEBUG:LSV2 Client:successfully received directory information for TNC:\
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_FI payload length 12 bytes data: bytearray(b'\x00\x00\x00\x0cR_FITNC:\\test.H\x00')
DEBUG:LSV2 TCP:received block of data with length 35
DEBUG:LSV2 Client:expected response received: RSP.S_FI
DEBUG:LSV2 Client:received file information for TNC:\test.H DRV
DEBUG:LSV2 Client:remote path exists and points to file's
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_FD payload length 12 bytes data: bytearray(b'\x00\x00\x00\x0cC_FDTNC:\\test.H\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:successfully deleted file TNC:\test.H
DEBUG:LSV2 Client:ready to send file from H:\python\pyTNC\pyLSV2\test.H to TNC:\test.H
DEBUG:LSV2 Client:selecting non binary transfer mode
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_FL payload length 13 bytes data: bytearray(b'\x00\x00\x00\rC_FLTNC:\\test.H\x00\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 TCP:telegram to transmit: command RSP.S_FL payload length 3022 bytes data: bytearray(b'\x00\x00\x0b\xceS_FL0 BEGIN PGM uniFase MM \r\n1 CYCL DEF 25 KONTUR-ZUG ~\r\n Q1=+Q1 ;FRAESTIEFE ~\r\n Q3=+Q3 ;AUFMASS SEITE ~\r\n Q5=+Q5 ;KOOR. OBERFLAECHE
~\r\n Q7=+Q7 ;SICHERE HOEHE ~\r\n Q10=+Q10 ;ZUSTELL-TIEFE ~\r\n Q11=+Q11 ;VORSCHUB TIEFENZ. ~\r\n Q12=+Q12 ;VORSCHUB RAEUMEN ~\r\n Q15=+Q15 ;FRAESART\r\n2 Q6 = Q6 ;Sicherheits Abstand\r\n3 Q1403 = Q1403 ;Winkel\r\n4 Q1404 = Q1404 ;Breite Zeilflaech
e\r\n5 Q1405 = Q1405 ;Zeilrichtung (1/-1)\r\n6 Q1406 = Q1406 ;Fahren auf S.Hoehe?\r\n7 ;\r\n8 * - Fehlenden Wert Berrechnen\r\n9 FN 10: IF +Q1403 NE +0 GOTO LBL 20\r\n10 Q1403 = ATAN ( Q1404 / ABS Q1 ) ;Winkel\r\n11 LBL 20\r\n12 FN 10: IF +Q1404 NE +0 GOTO LBL 21\r\n
13 Q1404 = TAN Q1403 * ABS Q1 ;Breite\r\n14 LBL 21\r\n15 FN 10: IF +Q1 NE +0 GOTO LBL 22\r\n16 Q1 = 0 - ( Q1404 / TAN Q1403 ) ;Tiefe (negativer Wert)\r\n17 LBL 22\r\n18 ;\r\n19 * - ERROR\r\n20 FN 10: IF +Q6 NE +0 GOTO LBL 252\r\n21 Q6 = 0.0001 ;mindestwert\r\n22 LBL 252\r
\n23 FN 11: IF +0 GT +Q1 GOTO LBL 253\r\n24 FN 14: ERROR= 1077 ;VORZEICHEN FRAESTIEFE\r\n25 LBL 253\r\n26 ;\r\n27 * - Zyklusparameter sichern\r\n28 Q71 = Q1 ;FRAESTIEFE\r\n29 Q73 = Q3 ;AUFMASS SEITE\r\n30 Q77 = Q7 ;SICHERE HOEHE\r\n31 Q78 = Q10 ;ZUSTELL-TIEFE\r\n32 Q79 =
Q15 ;FRAESART\r\n33 ;\r\n34 * - Versatz fuer Kugelfraeser errechnen:\r\n35 FN 18: SYSREAD Q90 = ID20 NR1 ;WZ #\r\n36 FN 18: SYSREAD Q91 = ID20 NR11 ;WZ Index\r\n37 FN 18: SYSREAD Q92 = ID50 NR3 IDXQ90 .Q91 ;DR2\r\n38 FN 18: SYSREAD Q93 = ID50 NR6 IDXQ90 .Q91 ;Aufmass DR2\
r\n39 Q94 = Q92 + Q93 ;Aktiver DR2\r\n40 Q95 = - Q94 + ( Q94 * COS Q1403 ) ;Werkzeugversatz XY\r\n41 Q96 = - Q94 + ( Q94 * SIN Q1403 ) ;Werkzeugversatz Z\r\n42 ;\r\n43 * - Zeilschritte ermitteln\r\n44 Q80 = INT ( SQRT ( - Q1 ^ 2 + Q1404 ^ 2 ) / - Q10 + 0.5 ) ;Anzahl Schri
tte\r\n45 Q81 = - Q1 / Q80 ;Versatz Z inkremental\r\n46 Q82 = Q1404 / Q80 ;Versatz XZ inkremental\r\n47 ;\r\n48 * - Zyklusparameter beschreiben\r\n49 FN 18: SYSREAD Q39 = ID220 NR2 IDX3 ;Z-NPV Speichern\r\n50 Q40 = Q6 + Q96 + Q39 ;Aktueller wert Z\r\n51 Q1 = - Q6 ;Fraesti
efe\r\n52 Q3 = - Q1404 + Q95 + Q3 ;Zaehler XY\r\n53 Q7 = 0.0001 ;SICHERE HOEHE\r\n54 Q10 = - 100 ;Zustellung\r\n55 * - Zeilrichtung +1\r\n56 FN 10: IF +Q1405 NE +1 GOTO LBL 25\r\n57 Q40 = Q40 + Q71\r\n58 Q3 = Q3 + Q1404\r\n59 Q81 = - Q81\r\n60 Q82 = - Q82\r\n61 LBL 25\r
\n62 ;\r\n63 * - Zeilen\r\n64 FN 18: SYSREAD Q0 = ID270 NR1 IDX3 ;Z Pos.\r\n65 FN 11: IF +Q0 GT +Q77 GOTO LBL 1\r\n66 L Z+Q77 R0 FMAX\r\n67 LBL 1\r\n68 CYCL DEF 7.0 NULLPUNKT\r\n69 CYCL DEF 7.1 Z+Q40\r\n70 CYCL CALL\r\n71 FN 10: IF +Q1406 NE +1 GOTO LBL 28\r\n72 Q50 = A
BS Q40 + Q77 ;SICHERE HOEHE\r\n73 L Z+Q50 R0 FMAX\r\n74 LBL 28\r\n75 Q40 = Q40 - Q81 ;Z\r\n76 Q3 = Q3 + Q82 ;XY\r\n77 FN 10: IF +Q79 NE +0 GOTO LBL 30\r\n78 FN 12: IF +Q15 LT +0.1 GOTO LBL 29\r\n79 Q15 = - 1\r\n80 FN 9: IF +0 EQU +0 GOTO LBL 30\r\n81 LBL 29\r\n82 FN 11:
IF +Q15 GT +0 GOTO LBL 30\r\n83 Q15 = 1\r\n84 LBL 30\r\n85 CALL LBL 1 REPQ80\r\n86 CYCL DEF 7.0 NULLPUNKT\r\n87 CYCL DEF 7.1 Z+Q39\r\n88 ;\r\n89 * - Zyklusparameter wiederherstellen\r\n90 Q1 = Q71 ;FRAESTIEFE\r\n91 Q3 = Q73 ;AUFMASS SEITE\r\n92 Q7 = Q77 ;SICHERE HOEHE\r\
n93 Q10 = Q78 ;ZUSTELL-TIEFE\r\n94 Q15 = Q79 ;FRAESART\r\n95 END PGM uniFase MM \r\n')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 TCP:telegram to transmit: command RSP.T_FD payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00T_FD')
ERROR:LSV2 TCP:something went wrong while waiting for new data to arrive, buffer was set to 4096
Traceback (most recent call last):
File "h:\python\pyTNC\pyLSV2\pyLSV2 test.py", line 13, in <module>
con.send_file(local_path=("H:\\python\\pyTNC\\pyLSV2\\test.H"), remote_path="TNC:\\test.H", override_file=True, binary_mode=False)
File "C:\Users\bachan\AppData\Roaming\Python\Python312\site-packages\pyLSV2\client.py", line 1050, in send_file
if not self._send_recive(lc.RSP.T_FD, None, lc.RSP.NONE):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bachan\AppData\Roaming\Python\Python312\site-packages\pyLSV2\client.py", line 175, in _send_recive
lsv_content = self._llcom.telegram(command, bytes_to_send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bachan\AppData\Roaming\Python\Python312\site-packages\pyLSV2\low_level_com.py", line 190, in telegram
data_recived = self._tcpsock.recv(self.buffer_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: timed out
And on a iTNC530 340490 05 SP7 it simply works normal, without Problems
I was able to reproduce the exact same error that you are seeing. I actually found a general problem in reporting of error messages but it is not the source of what we are seeing here.
Going by the log messages it seems like two different situations:
Testing non binary file transfer with a programing station for iTNC530 340494 08 SP2 shows similar results as your test with iTNC530 606420 02 SP10. After finding the problem mentioned above I get a more detailed error message "error in program block". If I strip everything from the nc program besides the comment lines the transfer works as expected. It seems like the control doesn't like something about the syntax in the NC program which is why it is rejected.
The log from your test with iTNC530 340422 13 is a bit strange. The time out error indicates some hang up while waiting for a response from the control. I don't have access to a machine with such an old software version to do some testing. The oldest programming station I am able to find is iTNC 530 340494 02 but I haven't been able to get it working on Windows 10. I will set up a VM with an old version of Windows but this might take some time. Maybe the source of the problem in this case is the same as in the other case but the control does not report the error and just stops responding altogether.
Can you please check if the file transfer again this either a minimal NC program with only line blocks? Or you could first download a program from the control and upload it with a different name.
Thank you,
for iTNC530 606420:
Then I made a minimal program with only linear blocks and was able to narrow down the error. I think it has to do with the length of the program
this works:
0 BEGIN PGM test MM
1 L X+1 Y+2 Z+3
2 L X+1 Y+2 Z+3
3 L X+1 Y+2 Z+3
4 L X+1 Y+2 Z+3
5 L X+1 Y+2 Z+3
6 L X+1 Y+2 Z+3
7 L X+1 Y+2 Z+3
8 L X+1 Y+2 Z+3
9 L X+1 Y+2 Z+3
10 L X+1 Y+2 Z+3
11 L X+1 Y+2 Z+3
12 L X+1 Y+2 Z+3
13 L X+1 Y+2 Z+3
14 L X+1 Y+2 Z+3
15 L X+1 Y+2 Z+3
16 L X+1 Y+2 Z+3
17 L X+1 Y+2 Z+3
18 L X+1 Y+2 Z+3
19 L X+1 Y+2 Z+3
20 L X+1 Y+2 Z+3
21 L X+1 Y+2 Z+3
22 L X+1 Y+2 Z+3
23 END PGM test MM
and this not (only 1 line more):
0 BEGIN PGM test MM
1 L X+1 Y+2 Z+3
2 L X+1 Y+2 Z+3
3 L X+1 Y+2 Z+3
4 L X+1 Y+2 Z+3
5 L X+1 Y+2 Z+3
6 L X+1 Y+2 Z+3
7 L X+1 Y+2 Z+3
8 L X+1 Y+2 Z+3
9 L X+1 Y+2 Z+3
10 L X+1 Y+2 Z+3
11 L X+1 Y+2 Z+3
12 L X+1 Y+2 Z+3
13 L X+1 Y+2 Z+3
14 L X+1 Y+2 Z+3
15 L X+1 Y+2 Z+3
16 L X+1 Y+2 Z+3
17 L X+1 Y+2 Z+3
18 L X+1 Y+2 Z+3
19 L X+1 Y+2 Z+3
20 L X+1 Y+2 Z+3
21 L X+1 Y+2 Z+3
22 L X+1 Y+2 Z+3
23 L X+1 Y+2 Z+3
24 END PGM test MM
log:
DEBUG:LSV2 TCP:Socket successfully created, host 172.29.48.76 was resolved to IP 172.29.48.76
INFO:LSV2 Client:enabling safe mode. restricting functionality
DEBUG:LSV2 TCP:Connected to host 172.29.48.76 at port 19000
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LG payload length 8 bytes data: bytearray(b'\x00\x00\x00\x08A_LGINSPECT\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:login executed successfully for login INSPECT
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x01')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x02')
DEBUG:LSV2 TCP:received block of data with length 23
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x03')
DEBUG:LSV2 TCP:received block of data with length 25
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x04')
DEBUG:LSV2 TCP:received block of data with length 186
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x05')
DEBUG:LSV2 TCP:received block of data with length 21
DEBUG:LSV2 Client:expected response received: RSP.S_VR
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_VR payload length 1 bytes data: bytearray(b'\x00\x00\x00\x01R_VR\x07')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 24 'LSV2_ERROR_T_ER_WRONG_PARA'
DEBUG:LSV2 Client:got version info: iTNC530 / 606420 02 SP10
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_PR payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00R_PR')
DEBUG:LSV2 TCP:received block of data with length 132
DEBUG:LSV2 Client:expected response received: RSP.S_PR
DEBUG:LSV2 Client:got system parameters: <pyLSV2.dat_cls.SystemParameters object at 0x000001D8B04DFB00>
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x01')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_CI
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x02')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_CI
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_CI payload length 4 bytes data: bytearray(b'\x00\x00\x00\x04R_CI\x00\x00\x00\x03')
DEBUG:LSV2 TCP:received block of data with length 16
DEBUG:LSV2 Client:expected response received: RSP.S_CI
DEBUG:LSV2 Client:setting connection settings for ControlType.MILL_OLD and block length 4096
DEBUG:LSV2 Client:use buffer size of 4096
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_CC payload length 2 bytes data: bytearray(b'\x00\x00\x00\x02C_CC\x00\x07')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_CC payload length 2 bytes data: bytearray(b'\x00\x00\x00\x02C_CC\x00\x13')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:secure file send is enabled
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LG payload length 5 bytes data: bytearray(b'\x00\x00\x00\x05A_LGFILE\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:login executed successfully for login FILE
INFO:LSV2 Client:successfully configured connection parameters and basic logins
iTNC530
606420 02 SP10
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_DC payload length 6 bytes data: bytearray(b'\x00\x00\x00\x06C_DCTNC:\\\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:changed working directory to TNC:\
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_DC payload length 5 bytes data: bytearray(b'\x00\x00\x00\x05C_DCTNC:\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
DEBUG:LSV2 Client:changed working directory to TNC:
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_DI payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00R_DI')
DEBUG:LSV2 TCP:received block of data with length 178
DEBUG:LSV2 Client:expected response received: RSP.S_DI
DEBUG:LSV2 Client:successfully received directory information for TNC:\
DEBUG:LSV2 Client:login already active
DEBUG:LSV2 TCP:telegram to transmit: command CMD.R_FI payload length 12 bytes data: bytearray(b'\x00\x00\x00\x0cR_FITNC:\\test.H\x00')
DEBUG:LSV2 TCP:received block of data with length 10
INFO:LSV2 Client:an error was received after the last transmission, Error Type: 1, Error Code: 32 'LSV2_ERROR_T_ER_NO_FILE'
DEBUG:LSV2 Client:file does not exist
DEBUG:LSV2 Client:ready to send file from H:\python\pyTNC\pyLSV2\test.H to TNC:\test.H
DEBUG:LSV2 Client:selecting non binary transfer mode
DEBUG:LSV2 TCP:telegram to transmit: command CMD.C_FL payload length 13 bytes data: bytearray(b'\x00\x00\x00\rC_FLTNC:\\test.H\x00\x00')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 TCP:telegram to transmit: command RSP.S_FL payload length 525 bytes data: bytearray(b'\x00\x00\x02\rS_FL0 BEGIN PGM test MM \r\n1 L X+1 Y+2 Z+3\r\n2 L X+1 Y+2 Z+3\r\n3 L X+1 Y+2 Z+3\r\n4 L X+1 Y+2 Z+3\r\n5 L X+1 Y+2 Z+3\r\n6 L X+1 Y+2 Z
+3\r\n7 L X+1 Y+2 Z+3\r\n8 L X+1 Y+2 Z+3\r\n9 L X+1 Y+2 Z+3\r\n10 L X+1 Y+2 Z+3\r\n11 L X+1 Y+2 Z+3\r\n12 L X+1 Y+2 Z+3\r\n13 L X+1 Y+2 Z+3\r\n14 L X+1 Y+2 Z+3\r\n15 L X+1 Y+2 Z+3\r\n16 L X+1 Y+2 Z+3\r\n17 L X+1 Y+2 Z+3\r\n18 L X+1 Y+
2 Z+3\r\n19 L X+1 Y+2 Z+3\r\n20 L X+1 Y+2 Z+3\r\n21 L X+1 Y+2 Z+3\r\n22 L X+1 Y+2 Z+3\r\n23 L X+1 Y+2 Z+3\r\n24 END PGM test MM ')
DEBUG:LSV2 TCP:received block of data with length 10
WARNING:LSV2 Client:could not send data, received unexpected response 'RSP.T_BD'
DEBUG:LSV2 TCP:telegram to transmit: command CMD.A_LO payload length 0 bytes data: bytearray(b'\x00\x00\x00\x00A_LO')
DEBUG:LSV2 TCP:received block of data with length 8
DEBUG:LSV2 Client:expected response received: RSP.T_OK
INFO:LSV2 Client:logout executed successfully for login None
DEBUG:LSV2 TCP:Connection to 172.29.48.76 closed
DEBUG:LSV2 Client:connection to host closed
The possible lines shift by longer or shorter blocks
on the iTNC530 340494 08 i testet the same, but i cant transver one single line (file recive works perfectly)
iTNC530 606420 02: Ok, since it related to the length, there probably is an error identifying the buffer size for the connection. Going by the log messages pyLSV2 uses a buffer size of 4096 bytes. This decision is made based on the system parameters that are set during there initialization phase. The longer file results in a transfer of 525 bytes.
Can you please try the following to force pyLSV2 to use a buffer size for 256 before sending the file? Going by what little documentation is available, this is the smallest possible buffer size and should therefor be supported by any version. To do this, add following line before sending the file:
con._llcom.buffer_size = 256
If the transfer works after adding this line, the init code is wrong.
iTNC530 340494 08: I haven't had time to get a old version of windows running but I hope to find some time soon.
This works for me too, thank you very much
The iTNC530 340494 08 is not very important to me, I personally don't necessarily need a fix and don't want to burden you unnecessarily
can you please retest with the current master branch? I think #67 might also fix the last remaining issue
Hello drunsinn,
thank you very mutch, the transver work :)
Hello,
I try to send data (normal .H) with send_file, binary_mode=False on a "iTNC530 60642002 SP10" (the same code works on a TNC640)
could not send data, received unexpected response 'RSP.T_BD
The Heidenhan Doc says "Blockübertragungsfehler" (sorry German) _Die Fehlernummern 100 - 199 sind Blockübertragungsabbruchfehler (TBD)
con.last_error() repeats also an Error :( Traceback (most recent call last):