Hello,
I use a script on different PC's. Since last week I've got an error on one of the PC's
A Message box says line 173 object is no applicationobject. I checked the script on different PC's, only one has this error.
codesys script protocol is:
(172): app = proj.active_application
(173): onlineapp = online.create_online_application(app)
(173): Ausnahmefehler (<type 'exceptions.valueerror'="">, ValueError('Das angegebene Objekt ist kein Applikationsobjekt!',), <traceback object="" at="" 0x000000000000002c="">)
(173): onlineapp = online.create_online_application(app)
CoDeSysScript.py(173): Ausnahmefehler (<type 'exceptions.valueerror'="">, ValueError('Das angegebene Objekt ist kein Applikationsobjekt!',), <traceback 0x000000000000002d="" object="" at="">)
(173): onlineapp = online.create_online_application(app)
(173): Rückgabe von Skript
(173): onlineapp = online.create_online_application(app)</traceback></type></traceback></type>
In the script:
Line
172 app = proj.active_application
173 onlineapp = online.create_online_application(app)
like lots of examples here in the Forum...
I checked the script that 'proj' is defined, that the path to the Codesys Project is the same, that all Options in codesys are identicall, but there must be a difference, but I've got now idea by now and I wasn't able to find something similar in the Forum.
Has anyone had the same Problem or an idea how to solve it?
best regards,
daniel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2015-07-20
Originally created by: M.Schaber
Hi,
could you provide us with the typeguid of the object?
I'm not quite sure what you mean, the next uses in the code are:
\# setzeProjektalsaktiveApplikation
  app=proj.active_application
  onlineapp=online.create_online_application(app)
\# CodeinIECimportieren
  if(loadoption&PLCLOADOPTION_IMPORT)!=0:
    ImportCodeInIEC(proj, app);
...
\# Einloggen
  if(loadoption&PLCLOADOPTION_ONLINECHANGE)!=0:
    onlineapp.login(OnlineChangeOption.Force, True)
  else:
    onlineapp.login(OnlineChangeOption.Never, True)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2015-07-20
Originally created by: M.Schaber
I wanted you to share with us the output of the print statements, so we know the type guid (and possibly embedded object guids) of the object in question.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
171#setzeProjektalsaktiveApplikation172Â Â app=proj.active_application173Â Â print(app.type)174Â Â print(repr(app.embedded_object_types))175Â Â onlineapp=online.create_online_application(app)
I get the Output
(172):   app=proj.active_application(173):   print(app.type)        225bfe47-7336-4dbc-9419-4105a7c831fa(174):   print(repr(app.embedded_object_types))        Array[Guid](())(175):   onlineapp=online.create_online_application(app)(175):Ausnahmefehler(<type'exceptions.ValueError'>,ValueError('Das angegebene Objekt ist kein Applikationsobjekt!',),<tracebackobjectat0x000000000000002C>)(175):   onlineapp=online.create_online_application(app)(175):Ausnahmefehler(<type'exceptions.ValueError'>,ValueError('Das angegebene Objekt ist kein Applikationsobjekt!',),<tracebackobjectat0x000000000000002D>)(175):   onlineapp=online.create_online_application(app)(175):RückgabevonSkript(175):   onlineapp=online.create_online_application(app)
is that what you Need?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2015-07-20
Originally created by: M.Schaber
Hi, dblessin,
yes, that's exactly what I need.
it seems that the guid you give is the type guid of the device object (which clearly is no application object).
However, I'm not sure how this could happen on a specific machine, as you wrote.
At this place, the scripting API just uses the underlying Automation Platform API.
Is this only happening on a specific project, or on all projects you process on the affected PC?
Do the same projects work fine on other PCs?
Which application is shown as the active one (it's displayed in bold)?
What happens if you open the projects, set the active application to a valid application object via context menu, and save them - do the scripts work fine then?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
that was the hint I needed, I don't know how this could happen, cause I use two PC's and on both I loaded the Project this morning from source safe. But on the machine with the Problem there was no active application defined (No Application found, Parametername: stApplication). After I set one of the devices to active application everything went quite well.
That's the reason why it only happend on this PC. I haven't tested it with other Projects, but I'm sure it was the Problem of the not defined active application.
Is ther an example for changing the active application or the used device in a Project using a python script?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2015-07-20
Originally created by: M.Schaber
Hi,
you can just set the active application by finding the application object in the script, and then assigning it to proj.active_application.
Hello,
I use a script on different PC's. Since last week I've got an error on one of the PC's
A Message box says line 173 object is no applicationobject. I checked the script on different PC's, only one has this error.
codesys script protocol is:
(172): app = proj.active_application
(173): onlineapp = online.create_online_application(app)
(173): Ausnahmefehler (<type 'exceptions.valueerror'="">, ValueError('Das angegebene Objekt ist kein Applikationsobjekt!',), <traceback object="" at="" 0x000000000000002c="">)
(173): onlineapp = online.create_online_application(app)
CoDeSysScript.py(173): Ausnahmefehler (<type 'exceptions.valueerror'="">, ValueError('Das angegebene Objekt ist kein Applikationsobjekt!',), <traceback 0x000000000000002d="" object="" at="">)
(173): onlineapp = online.create_online_application(app)
(173): Rückgabe von Skript
(173): onlineapp = online.create_online_application(app)</traceback></type></traceback></type>
In the script:
Line
172 app = proj.active_application
173 onlineapp = online.create_online_application(app)
like lots of examples here in the Forum...
I checked the script that 'proj' is defined, that the path to the Codesys Project is the same, that all Options in codesys are identicall, but there must be a difference, but I've got now idea by now and I wasn't able to find something similar in the Forum.
Has anyone had the same Problem or an idea how to solve it?
best regards,
daniel
Originally created by: M.Schaber
Hi,
could you provide us with the typeguid of the object?
I'm not quite sure what you mean, the next uses in the code are:
Originally created by: M.Schaber
I wanted you to share with us the output of the print statements, so we know the type guid (and possibly embedded object guids) of the object in question.
with the modified code
I get the Output
is that what you Need?
Originally created by: M.Schaber
Hi, dblessin,
yes, that's exactly what I need.
it seems that the guid you give is the type guid of the device object (which clearly is no application object).
However, I'm not sure how this could happen on a specific machine, as you wrote.
At this place, the scripting API just uses the underlying Automation Platform API.
Is this only happening on a specific project, or on all projects you process on the affected PC?
Do the same projects work fine on other PCs?
Which application is shown as the active one (it's displayed in bold)?
What happens if you open the projects, set the active application to a valid application object via context menu, and save them - do the scripts work fine then?
Hi Mr. Schaber,
that was the hint I needed, I don't know how this could happen, cause I use two PC's and on both I loaded the Project this morning from source safe. But on the machine with the Problem there was no active application defined (No Application found, Parametername: stApplication). After I set one of the devices to active application everything went quite well.
That's the reason why it only happend on this PC. I haven't tested it with other Projects, but I'm sure it was the Problem of the not defined active application.
Is ther an example for changing the active application or the used device in a Project using a python script?
Originally created by: M.Schaber
Hi,
you can just set the active application by finding the application object in the script, and then assigning it to proj.active_application.
Hi Mr. Schaber,
it works, thank you.