# Scripting Error on Compoent "Background" access:

**URL:** <https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441>\
**Category:** Ignition\
**Created:** [October 16, 2011, 12:09pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441 "2011-10-16T12:09:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![robin.abdul](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@robin.abdul](https://forum.inductiveautomation.com/u/robin.abdul)\
**Post date:** [October 16, 2011, 12:09pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/1 "2011-10-16T12:09:44Z")

</div>

Dear Brother,  
when I try  
if pfin \> 90:  
system.gui.getWindow(“LS\_CALC”).rootContainer.getComponent(‘NEW\_MOTOR\_RPM\_STD%d’ %cn).background = (223,222,222,222)   
I am receiving this error,

The following is the error message  
[color=#008080][size=85]  
Traceback (innermost last):  
File “”, line 95, in ?  
TypeError: readonly class or attribute: background

```
at org.python.core.Py.TypeError(Py.java)
at org.python.core.PyObject. __setattr__ (PyObject.java)
at org.python.pycode._pyx18.f$0(<script playground>:95)
at org.python.pycode._pyx18.call_function(<script playground>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:394)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:387)
at com.inductiveautomation.ignition.designer.gui.tools.ScriptPlayground.runScript(ScriptPlayground.java:208)
at com.inductiveautomation.ignition.designer.gui.tools.ScriptPlayground$2.actionPerformed(ScriptPlayground.java:222)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)[/size]

```

Ignition v7.2.8 (b178)  
Java: Sun Microsystems Inc. 1.6.0\_26  
[/color]

can you please help me…  
abdul

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [October 17, 2011, 4:31pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/2 "2011-10-17T16:31:06Z")

</div>

What kind of component is NEW\_MOTOR\_RPM\_STD#?

---

<div class="post-metadata">

**Author:** ![robin.abdul](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@robin.abdul](https://forum.inductiveautomation.com/u/robin.abdul)\
**Post date:** [October 18, 2011, 4:50am UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/3 "2011-10-18T04:50:18Z")

</div>

Its a Numeric Label

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [October 18, 2011, 2:58pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/4 "2011-10-18T14:58:05Z")

</div>

I would print the following to the console to make sure the component really exists:`print 'NEW_MOTOR_RPM_STD%d' %cn`My guess is the name is incorrect.

---

<div class="post-metadata">

**Author:** ![robin.abdul](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@robin.abdul](https://forum.inductiveautomation.com/u/robin.abdul)\
**Post date:** [November 14, 2011, 11:55am UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/5 "2011-11-14T11:55:25Z")

</div>

yes the name is absolutelty perfect

actually we upgraded recently to v7.3.1 32 bit  
and since then we are facing these issues

even the pages with good designs and colors are now turning to gray scale,  
during runtime and the actual configuration done is also affected.  
even the fonts and font size and colors are being changed automatically ( to Dailog, plan, 12)  
please check teh below images for your reference

abdul

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/ee7fdd113232c77c5d694d457c18e1d1f224a95c.png)  
  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/3662afba9ea201a7c3a294f0b773b4d1c4eb792a.png)

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [November 14, 2011, 4:33pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/6 "2011-11-14T16:33:12Z")

</div>

Robin - as another approach, it may be easier to bind the background property to an expression that sets the color based on that pfin value instead of using scripting.

---

<div class="post-metadata">

**Author:** ![robin.abdul](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@robin.abdul](https://forum.inductiveautomation.com/u/robin.abdul)\
**Post date:** [November 14, 2011, 5:03pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/7 "2011-11-14T17:03:28Z")

</div>

hi nathan, Yeah but can you please look at those two images that i posted down,  
if I copy any component and paste them,  
I am loosing the original formatting of those components (background, foregroung, font and brorder)  
on all pages after upgrading to V7.3 can you please help,  
We are covered under total care contract…

awaiting,

Abdul

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [November 17, 2011, 11:57pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/8 "2011-11-17T23:57:31Z")

</div>

Can you export that window from the pre-7.3 version that you were using and send it to us or post it here please?

---

<div class="post-metadata">

**Author:** ![robin.abdul](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@robin.abdul](https://forum.inductiveautomation.com/u/robin.abdul)\
**Post date:** [November 18, 2011, 3:37pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/9 "2011-11-18T15:37:22Z")

</div>

Dear nathan,  
withv7.3 running on xp and clients accessing it on Windows 7, and when we launch the designer on  
windows 7 we are facing these issues.

please can u reproduce the same  
???

---

<div class="post-metadata">

**Author:** ![nathan](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@nathan](https://forum.inductiveautomation.com/u/nathan)\
**Post date:** [November 18, 2011, 9:16pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/10 "2011-11-18T21:16:59Z")

</div>

Please try what Carl said and export the window on the older version designer.

---

<div class="post-metadata">

**Author:** ![markdobtech](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@markdobtech](https://forum.inductiveautomation.com/u/markdobtech)\
**Post date:** [January 17, 2012, 10:25pm UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/11 "2012-01-17T22:25:38Z")

</div>

I am new to the board, but in a spirit of ‘better late than never’, here is the solution to the issue. The syntax was wrong as there is no ‘rootContainer’ method, there is getRootContainer().

Wrong Syntax-  
system.gui.getWindow(“LS\_CALC”).rootContainer.getComponent(‘NEW\_MOTOR\_RPM\_STD%d’ %cn).background = (223,222,222,222)

Correct-  
system.gui.getWindow(“LS\_CALC”).getRootContainer().getComponent(‘NEW\_MOTOR\_RPM\_STD%d’ %cn).background = (223,222,222,222)

---

<div class="post-metadata">

**Author:** ![robin.abdul](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@robin.abdul](https://forum.inductiveautomation.com/u/robin.abdul)\
**Post date:** [January 18, 2012, 6:41am UTC](https://forum.inductiveautomation.com/t/scripting-error-on-compoent-background-access/3441/12 "2012-01-18T06:41:57Z")

</div>

TQ Very Much
