View unanswered posts | View active topics It is currently Sun May 19, 2013 2:43 pm



Reply to topic  [ 3 posts ] 
 Help with script error 
Author Message

Joined: Aug 05, 2011
Posts: 230
Post Help with script error
I'm getting an odd error when I try and run an imbedded script just before midnight from a schedule. This script runs fine when I compile it and run it with the run button:

Code: Select all
#Constants
#--Drying factor (How much moisture is lost on a dry day)
DryFac = float(indigo.variables[1579339587].value) #Variable DryFac (ex 0.3)
#--Soil Capacity
MaxAccum = float(indigo.variables[1284193260].value) #Variable SoilCapacity (ex 1.0)

#Minimum Humidity from day before today
YMinHum = float(indigo.variables[967341429].value) #Variable YesterdayMinHumidity

#Accumulated Soil Moisture
AccumVar = indigo.variables[1198641854]#Variable Accumulatedmoisture
Accum = float(AccumVar.value)

#TodaysRain
Rain = float(indigo.variables[1720216395].value) # Variable DayRain

#Add Todays rain and remove drying rate ( nothing at 100% humidiity, DryFac at 0)
Accum = Accum + Rain - DryFac * 0.01 *(100 - YMinHum)
if Accum > MaxAccum:
   Accum = MaxAccum
if Accum < 0:
   Accum = 0.
indigo.variable.updateValue(1198641854,str(Accum))

#Minimum Humidity from day before today
MinHum = float(indigo.variables[1398312244].value) #Variable MinHumidity

#Copy todays Min Hum into yesterday (which will be right in 1 minute)
indigo.variable.updateValue(967341429,str(MinHum))
#and set MinHumidity to Current Humidity
indigo.variable.updateValue(1398312244,indigo.variables[581968200].value)


but when the schedule tries to run it at 11:59 pm, it gives
    Jul 6, 2012 11:59:00 PM
    Schedule Set AccumulatedRain
    Script Error embedded script: 'VariableCmds' object is unindexable
    Script Error Exception Traceback (most recent call shown last):

    embedded script, line 5, at top level
    TypeError: 'VariableCmds' object is unindexable

So is Indigo locking the variables just before midnight for some reason?


Sat Jul 07, 2012 4:42 am
Profile
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11682
Location: Texas
Post Re: Help with script error
Hmmm... I'm not sure what is going on here exactly. The error message:
TypeError: 'VariableCmds' object is unindexable

would occur if you tried to reference an index on the variable command space instead of the variable object model dict. indigo.variable is the command space that should be used for commands such as updateVariable, whereas the object model indigo.variables is the dict that contains all of the variable objects. So if you tried:

Code: Select all
indigo.variable[967341429]

I would expect the error you saw since the correct syntax is actually:

Code: Select all
indigo.variables[967341429]

All that said, your script code does look correct so I'm not sure what is going wrong. Is the problem consistently reproducible?

Could it be that you have another version of the script being run by a different schedule that has the error?

_________________
Image


Sat Jul 07, 2012 10:39 am
Profile WWW

Joined: Aug 05, 2011
Posts: 230
Post Re: Help with script error
:oops: Oops, false alarm, my mistake: I had corrected a compile error in the imbedded script, and after I had compiled and run the corrected code, I apparently neglected to click OK on the entire schedule dialog. And because the dialog got buried, I didn't realize that it was already open when I clicked on the home window to bring it back in order to try and change the time to 11:58 yesterday afternoon. But it ran fine last night.


Sun Jul 08, 2012 6:06 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.