I trying to create a script in python which build the project and perform a download to the PLC.
But when it tries to login an error occurs, that I do not know how to solve. See my attached picture.
It only occurs when login via the script.
I am using a Lenze PLC 3200C and Lenze PLC designer 3.21.
This is my python code.
from__future__importprint_functionproj=projects.primaryapp=proj.active_applicationonlineapp=online.create_online_application(app)app.build()# Find device objectfound=proj.find('Device',False)assert(foundandlen(found)==1,'No or more than one device found')dev=found[0]print(dev.get_name())gws=online.gatewaysforgwingws:ifgw.name=='Gateway-1':print(gw.name)breakgw.perform_network_scan()PLC_address=gw.find_address_by_ip('192.168.17.10')dev.set_gateway_and_address('Gateway-1',PLC_address)onlineapp.login(OnlineChangeOption.Never,False)ifnotonlineapp.application_state==ApplicationState.run:print(onlineapp.application_state)onlineapp.start()print(onlineapp.application_state)
Hopefully someone who knows sees this and can help. Unfortunately I don't have any experience in what you're trying to do so I just have some generic help, as well as what I've dug up doing my own google search.
My first suggestion is to look on the Codesys Help page if you haven't done so already or if Lenze's IDE doesn't link to it. Looking at it myself it seems like this would be the relevant page within.
I did find this post from someone trying to do something similar.
If you can't get it figured out or don't have time to you will definately get your issue solved by purchasing a support ticket.
Edit: I'm sorry, I tried clicking both "API Reference Documentation for the ScriptEngine" links and both lead to a blank page!
I'll submit a bug report. In the meantime you might be able to find something by following these directions
Hi,
I trying to create a script in python which build the project and perform a download to the PLC.
But when it tries to login an error occurs, that I do not know how to solve. See my attached picture.
It only occurs when login via the script.
I am using a Lenze PLC 3200C and Lenze PLC designer 3.21.
This is my python code.
Thanks and best regards
Lars
Hopefully someone who knows sees this and can help. Unfortunately I don't have any experience in what you're trying to do so I just have some generic help, as well as what I've dug up doing my own google search.
My first suggestion is to look on the Codesys Help page if you haven't done so already or if Lenze's IDE doesn't link to it. Looking at it myself it seems like this would be the relevant page within.
I did find this post from someone trying to do something similar.
If you can't get it figured out or don't have time to you will definately get your issue solved by purchasing a support ticket.
Edit: I'm sorry, I tried clicking both "API Reference Documentation for the ScriptEngine" links and both lead to a blank page!
I'll submit a bug report. In the meantime you might be able to find something by following these directions
Last edit: Morberis 2021-01-05