# Small bug in script processing

**URL:** <https://forum.inductiveautomation.com/t/small-bug-in-script-processing/4417>\
**Category:** Ignition\
**Created:** [May 4, 2012, 6:14pm UTC](https://forum.inductiveautomation.com/t/small-bug-in-script-processing/4417 "2012-05-04T18:14:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [May 4, 2012, 6:14pm UTC](https://forum.inductiveautomation.com/t/small-bug-in-script-processing/4417/1 "2012-05-04T18:14:55Z")

</div>

Hello

I have a small script which checks if a window instance is already open to prevent opening another one again for the same pump. (I can have many instances but only for different pumps)

Each time I open a popup window I set a different title for the window (that includes the Pump Name) so I can later check if its already opened like this:

```auto
#Abre nueva instancia de la gráfica
param1 = event.source.parent.parent.Bomba #this is a UDT property

windows=system.gui.getOpenedWindows()
found=0
for window in windows:
    if (window.title=="Tendencias Históricas de la Bomba "+param1.Nombre):
       found=1
if (found==0):       
   system.nav.openWindowInstance('Historicos/Tendencias', {'Bomba' : param1})
```

I noticed that I get an error because of the accent in the word “Históricas” and if I change it to “Historicas” without accent it works OK.

This is the error:

```auto
Traceback (most recent call last):
  File "<event:mouseClicked>", line 8, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf3 in position 15: ordinal not in range(128)
```

I also noticed that it doesn’t matter if the window.title property has accent or not, but the problem is in the comparison with the string written in the script, if it has accent the error pops up.

Regards

---

<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:** [May 4, 2012, 8:16pm UTC](https://forum.inductiveautomation.com/t/small-bug-in-script-processing/4417/2 "2012-05-04T20:16:09Z")

</div>

The problem is you have a unicode character “ó” in your string. You can try doing this:`if (window.title== u"Tendencias Históricas de la Bomba "+param1.Nombre):`It would probably be better to check the param you pass in rather than checking the title of the window. I would try this:[code]#Abre nueva instancia de la gráfica  
param1 = event.source.parent.parent.Bomba #this is a UDT property

windows=system.gui.getOpenedWindows()  
found=0  
for window in windows:  
if (window.getRootContainer().Bomba.Nombre == param1.Nombre):  
found=1  
if (found==0):  
system.nav.openWindowInstance(‘Historicos/Tendencias’, {‘Bomba’ : param1})[/code]

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [May 4, 2012, 8:30pm UTC](https://forum.inductiveautomation.com/t/small-bug-in-script-processing/4417/3 "2012-05-04T20:30:23Z")

</div>

Travis you’re a Genius!

That is much more elegant.

Thank you!
