# Script working in Scripting Console but not on action preformed for button

**URL:** <https://forum.inductiveautomation.com/t/script-working-in-scripting-console-but-not-on-action-preformed-for-button/68492>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [January 11, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/script-working-in-scripting-console-but-not-on-action-preformed-for-button/68492 "2023-01-11T16:34:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![user39](https://avatars.discourse-cdn.com/v4/letter/u/59ef9b/32.png) [@user39](https://forum.inductiveautomation.com/u/user39)\
**Post date:** [January 11, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/script-working-in-scripting-console-but-not-on-action-preformed-for-button/68492/1 "2023-01-11T16:34:31Z")

</div>

Hello all,

I am setting up a project to go and grab a bunch of financial data from a banking website.

The way I have it worked out is I have a .exe file on my system that I am using the SubProcess module to activate via python.

Here's the code:  
"""import subprocess

file = "C:\Users\Kyle\Desktop\pyFinanceData\dbConnector.exe"

subprocess.call(file, shell=True) """

Whenever I run this via the Scripting console it works perfect 100% of the time.

But I bound it to a button and now it doesn't work. I tried binding it to a gateway message handler, and using the button to call that, and that also did not work.

I'm not sure why it would ONLY be working in the Scripting Console. Any advice would be really helpful.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 11, 2023, 4:38pm UTC](https://forum.inductiveautomation.com/t/script-working-in-scripting-console-but-not-on-action-preformed-for-button/68492/2 "2023-01-11T16:38:09Z")

</div>

The Script Console is executing _on your local machine_.

Scripting in Perspective, even in the Designer, is being executed _on the gateway_.

---

<div class="post-metadata">

**Author:** ![user39](https://avatars.discourse-cdn.com/v4/letter/u/59ef9b/32.png) [@user39](https://forum.inductiveautomation.com/u/user39)\
**Post date:** [January 11, 2023, 4:40pm UTC](https://forum.inductiveautomation.com/t/script-working-in-scripting-console-but-not-on-action-preformed-for-button/68492/3 "2023-01-11T16:40:32Z")

</div>

Thank you.

So then would I have to set up the permissions for the gateway? Or is there a way to get the button somehow working on my local machine?

---

<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:** [January 11, 2023, 4:42pm UTC](https://forum.inductiveautomation.com/t/script-working-in-scripting-console-but-not-on-action-preformed-for-button/68492/4 "2023-01-11T16:42:30Z")

</div>

Perspective cannot run arbitrary executables locally. Browsers do not permit that--it would be an enormous security hole. Your gateway needs to run that tool, or you need to figure out how it works and re-create it with `system.net.httpClient()`.

Or use Vision instead of Perspective. It would run the tool locally.
