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 Sun Dec 16, 2018 12:33 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Nov 07, 2018 6:29 am 
Offline

Joined: Thu Nov 01, 2018 12:32 pm
Posts: 1
Hi!

I'm trying to create POU using python script in Codesys 3.5 SP5:
Code:
proj = projects.primary

found = proj.find("Application", True)
app = found[0]
print app
print dir(app)

# Create FB
mypou = app.create_pou("MyPou")


But I get the following error:

Code:
[WARNING]       Python 2 print statement found. For Python 3 compatibility, use 'from __future__ import print_function' and the print() function instead. in Script 'C:\Users\and-work\Desktop\1.py', Line '5' Column '1'
[INFORMATION]   1.py(1): Begin script
[INFORMATION]   1.py(1): proj = projects.primary
[INFORMATION]   1.py(3): found = proj.find("Application", True)
[INFORMATION]   1.py(4): app = found[0]
[INFORMATION]   1.py(5): print app
                ScriptObject{NoDeviceObject, NoExplicitConnectorObject, NoLibManObject, LibManObjectContainer, ScriptNoProjectInfoMarker, ScriptApplication, NoScriptApplicationComposerObject}(Project=0, Name=Application, guid=5a9278fe-989c-4674-9101-b9726dbde107)
[INFORMATION]   1.py(6): print dir(app)
                ['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
[INFORMATION]   1.py(9): mypou = app.create_pou("MyPou")
[INFORMATION]   1.py(9): exception (<type 'exceptions.AttributeError'>, AttributeError("'ScriptObject' object has no attribute 'create_pou'",), <traceback object at 0x000000000000002B>)
[INFORMATION]   1.py(9): mypou = app.create_pou("MyPou")
[INFORMATION]   1.py(9): exception (<type 'exceptions.AttributeError'>, AttributeError("'ScriptObject' object has no attribute 'create_pou'",), <traceback object at 0x000000000000002C>)
[INFORMATION]   1.py(9): mypou = app.create_pou("MyPou")
[INFORMATION]   1.py(9): return from script
[INFORMATION]   1.py(9): mypou = app.create_pou("MyPou")


Looks like there is no create_pou method in application object.

Could anybody help me with this issue?

Regards,
Victor


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 1 guest


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