CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Sun May 28, 2017 11:27 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Feb 10, 2017 8:53 am 
Offline

Joined: Mon Oct 20, 2014 7:05 am
Posts: 6
When a library is compiled by "Check all pool objects" from Build-menu and there occure build errors (which are displayed in die Build message window) it is nevertheless possible to save the library as "compiled library" - why?
How can build/compile errors be detected in a python script if the "Check all pool objects" command is also triggered by python script?

Thanks in advance.


Top
   
PostPosted: Fri Feb 10, 2017 11:35 am 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 192
Hi DBaur.

DBaur wrote:
When a library is compiled by "Check all pool objects" from Build-menu and there occure build errors (which are displayed in die Build message window) it is nevertheless possible to save the library as "compiled library" - why?
How can build/compile errors be detected in a python script if the "Check all pool objects" command is also triggered by python script?

Why don't you use the method check_all_pool_objects() of the project object?

Here some example code which "builds" a loaded library and prints the compiler error:
Code:
CompileCategory = Guid("{97F48D64-A2A3-4856-B640-75C046E37EA9}")

# Clear messages from Build category
system.clear_messages(CompileCategory)

projects.primary.check_all_pool_objects()

# Get message objects which contain all the data
severities = {
   Severity.FatalError : "Fatal error", Severity.Error : "Error",
   Severity.Warning : "Warning", Severity.Information : "Information",
   Severity.Text : "Text"
   }

msgs = system.get_message_objects(CompileCategory, Severity.FatalError|Severity.Error)
for msg in msgs:
   sev = severities[msg.severity]
   print("{} {}{}: {}".format(sev, msg.prefix, msg.number, msg.text)

BR
Martin

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


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

All times are UTC+01:00


Who is online

Users browsing this forum: Andreas Kehrer 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