# Syntax error on Ignition 7.9.6 when writing simple code

**URL:** <https://forum.inductiveautomation.com/t/syntax-error-on-ignition-7-9-6-when-writing-simple-code/36647>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [July 13, 2020, 4:18pm UTC](https://forum.inductiveautomation.com/t/syntax-error-on-ignition-7-9-6-when-writing-simple-code/36647 "2020-07-13T16:18:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kade.castille](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@kade.castille](https://forum.inductiveautomation.com/u/kade.castille)\
**Post date:** [July 13, 2020, 4:18pm UTC](https://forum.inductiveautomation.com/t/syntax-error-on-ignition-7-9-6-when-writing-simple-code/36647/1 "2020-07-13T16:18:22Z")

</div>

Hello,

I am trying to write a code that enables the visibility of a button if the machine being used matches a certain IP address using an if/else statement. I’m getting a syntax error on the first line, it doesn’t like the “=” for some reason, and didn’t work when I changed it to “==” either. I’m not the best at this aspect of Ignition, and would really appreciate a nudge in the right direction.

Thanks so much!

Code:

ip = system.net.getIpAddress()  
if ( ip == “192.168.245.XXX”, event.source.parent.getComponent(‘Button 4’).visible = True,  
event.source.parent.getComponent(‘Button 4’).visible = False)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 13, 2020, 4:23pm UTC](https://forum.inductiveautomation.com/t/syntax-error-on-ignition-7-9-6-when-writing-simple-code/36647/2 "2020-07-13T16:23:57Z")

</div>

You are trying to use the syntax from expression bindings in python. Use pure python.

---

<div class="post-metadata">

**Author:** ![kade.castille](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@kade.castille](https://forum.inductiveautomation.com/u/kade.castille)\
**Post date:** [July 13, 2020, 4:37pm UTC](https://forum.inductiveautomation.com/t/syntax-error-on-ignition-7-9-6-when-writing-simple-code/36647/3 "2020-07-13T16:37:53Z")

</div>

Thanks for the speedy response! However I’m sorry to say that I’m not sure what you mean when you say to use pure python. Could you elaborate on that please? I’m writing this script on the “Visible” property for the button component, so I should write it somewhere else and not within the binding? If so, where? I appreciate your time, thanks.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 13, 2020, 4:43pm UTC](https://forum.inductiveautomation.com/t/syntax-error-on-ignition-7-9-6-when-writing-simple-code/36647/4 "2020-07-13T16:43:02Z")

</div>

Ah, in the binding, you can only use the expression language, not python. Your first line is a python script call. You would use the `[System]` tag that holds the client IP address. No need for an if function, just the comparison to the desired string.

{Strictly speaking, bindings can call python via the runScript function, but I don’t recommend that for most cases.}

---

<div class="post-metadata">

**Author:** ![kade.castille](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@kade.castille](https://forum.inductiveautomation.com/u/kade.castille)\
**Post date:** [July 13, 2020, 5:04pm UTC](https://forum.inductiveautomation.com/t/syntax-error-on-ignition-7-9-6-when-writing-simple-code/36647/5 "2020-07-13T17:04:05Z")

</div>

That worked! I entered  
{[System]Client/Network/IPAddress} = “192.168.245.XXX”  
When I changed my IP address the button went invisible. Appreciate it!
