Jusito - 2019-10-29


I want to create a small snippet which opens the project, create a boot application, do a login and perform a cold reset. Codesys
My problem is, that this 2 lines not working:

from _3S.CoDeSys.OnlineUI.OnlineChangeOption import OnlineChangeOption
from _3S.CoDeSys.Core.Online.ResetOption import ResetOption

The error message is always: >Zitat:
ImportError: No module named _3S.CoDeSys.OnlineUI.OnlineChangeOption (same with ResetOption)

My Code:

from _3S.CoDeSys.OnlineUI.OnlineChangeOption import OnlineChangeOption
from _3S.CoDeSys.Core.Online.ResetOption import ResetOption
proj = projects.open("D:\\Starterkit_RPi.project")
app = proj.find("Application", True)
onlineapp = online.create_online_application(app[0])
\#_3S.CoDeSys.OnlineUI.OnlineChangeOption . OnlineChangeOption.Force = 2
onlineapp.login(change_option=OnlineChangeOption.Force, delete_foreign_apps=True)
\# _3S.CoDeSys.Core.Online.ResetOption . ResetOption.Cold = 1
onlineapp.reset(reset_option=ResetOption.Cold, force_kill=True)

As a workaround I tried to use the int values, which results in error:

TypeError: Cannot convert numeric value 2 to OnlineChangeOption.  The value must be zero.

I saw some code here (a while ago, so cant provide a link) which is using the enums, so it should be possible. How can I use this enums?

Thanks for your time!

Edit solution:
Looks like I made two mistakes:
1. I have to use ```

import scriptengine

, where is the documentation for this module or the information that this one contains the enums? 2.


isn't possible, only