Python 3 & Indigo 2022.1

Posted on
Thu May 19, 2022 12:50 pm
SMUSEBY offline
Posts: 505
Joined: Sep 16, 2009
Location: California

Python 3 & Indigo 2022.1

I have a script that is failing with the message
Script Error control page "0 Common" script error in file gDoorRFID OPEN.py:
Script Error inconsistent use of tabs and spaces in indentation
Script Error around line 18 - "time.sleep(1)"

The entire script:
Code: Select all
#   opens fDoor if fDoor interlock variable is true; interlock true for 1 sec

import time
fDoorInterlock = indigo.variables[911502153].getValue(bool)
hseStatus = indigo.variables[1176596514].getValue(bool)

if hseStatus:
   indigo.variable.updateValue(911502153, value = "True") #set to true enabling operation of door latch
   fDoorInterlock = indigo.variables[911502153].getValue(bool)

fDoorInterlock = indigo.variables[911502153].getValue(bool)

fDoorInterlock = indigo.variables[911502153].getValue(bool)

if fDoorInterlock:
   exec(open("/Library/Application Support/Perceptive Automation/Scripts/RFID-Access-Control.py").read())   
   fDoorInterlock = indigo.variables[911502153].getValue(bool)
    time.sleep(1)
    indigo.variable.updateValue(911502153, value = "False") #set to false
   fDoorInterlock = indigo.variables[911502153].getValue(bool)

Quoting the code above shows lines 18 and 19 with a one character indent; the code in BBEdit does not show that extra space.
I have no idea how to fix this error.
Suggestions?

Posted on
Thu May 19, 2022 2:01 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Python 3 & Indigo 2022.1

Use the "Convert tabs to spaces" command in BBEdit. And set your prefs to use spaces and not tabs.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri May 20, 2022 3:14 pm
SMUSEBY offline
Posts: 505
Joined: Sep 16, 2009
Location: California

Re: Python 3 & Indigo 2022.1

That seems to have fixed the issue - by deleting the tabs, and adding spaces. I was unable to find the preference 'use spaces not tabs'. The closest I could find was in the 'editor defaults menu', and selecting '1 space per tab'. I don't think that's correct because I got the same error until I manually deleted the tabs and inserted spaces.
Can you point me to the location for the default to spaces for tabs?
Bob

Posted on
Fri May 20, 2022 3:19 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Python 3 & Indigo 2022.1

I think it's actually the "auto expand tabs" option.
Attachments
Screen Shot 2022-05-20 at 5.18.16 PM.png
Screen Shot 2022-05-20 at 5.18.16 PM.png (302.54 KiB) Viewed 591 times

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests