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

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):

for row in pyDs:
    for col in row:
        print col

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

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.

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]