CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Feb 18, 2020 8:32 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: Tue Oct 29, 2019 3:58 pm 
Offline

Joined: Fri Jul 26, 2019 10:04 am
Posts: 2
Hello,

I want to create a small snippet which opens the project, create a boot application, do a login and perform a cold reset. Codesys 3.5.14.1
My problem is, that this 2 lines not working:
Code:
from _3S.CoDeSys.OnlineUI.OnlineChangeOption import OnlineChangeOption
from _3S.CoDeSys.Core.Online.ResetOption import ResetOption


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


My Code:
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)
onlineapp.start()
proj.close()


As a workaround I tried to use the int values, which results in error:
Code:
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
Code:
import scriptengine
, where is the documentation for this module or the information that this one contains the enums?
2.
Code:
OnlineChangeOption.Force
isn't possible, only
Code:
OnlineChangeOption.Never


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited