# Perspective script runs flawlessly when on a button but when same script is put in a property script it results in a bunch of new errors

**URL:** <https://forum.inductiveautomation.com/t/perspective-script-runs-flawlessly-when-on-a-button-but-when-same-script-is-put-in-a-property-script-it-results-in-a-bunch-of-new-errors/77650>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 9, 2023, 4:30pm UTC](https://forum.inductiveautomation.com/t/perspective-script-runs-flawlessly-when-on-a-button-but-when-same-script-is-put-in-a-property-script-it-results-in-a-bunch-of-new-errors/77650 "2023-08-09T16:30:06Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [August 9, 2023, 6:30pm UTC](https://forum.inductiveautomation.com/t/perspective-script-runs-flawlessly-when-on-a-button-but-when-same-script-is-put-in-a-property-script-it-results-in-a-bunch-of-new-errors/77650/8 "2023-08-09T18:30:25Z")

</div>

You do you, but note that:

This type of code (code intended for troubleshooting) in any form should never be left in production (Vision or Perspective):

```auto
for row in pyDs:
    for col in row:
        print col

```

Here is some information on how `print` works in various contexts:

> [@Event Configuration Print Out to debug](https://forum.inductiveautomation.com/t/event-configuration-print-out-to-debug/60091/5):
>
> It’s complicated slight_smile Starting from most local to least… In the script console, print will log directly to the output buffer on the right hand side. system.util.getLogger() will log to the named ‘Output Console’ Designer window. Bonus: A script invoked from here using system.util.invokeAsync will print to the regular output console, not the buffer on the right hand side. Anywhere else in the designer (except Perspective), print and system.util.getLogger will log to the ‘Out…

Currently the code as you had it is filling up your wrapper logs with what ever random data is returned in your queries. Of course if you want it to be there out of sight, then have at it, but depending on the size of the datasets you're adding an execution pause that will be seen as poor performance from the User's point of view.

Also, this is not how you initialize a variable. If you wanted to do it this way then the proper way to do it would be to initialize it prior to the loop, and set it inside of the loop.

```auto
lvalue = 0
for row in pyDs:
    for col in row:
        lvalue = col

```

Though that is equivalent to `lvalue = pyDs[pyDs.rowCount -1][pyDs.columnCount - 1]`

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-script-runs-flawlessly-when-on-a-button-but-when-same-script-is-put-in-a-property-script-it-results-in-a-bunch-of-new-errors/77650)._
