# Python Script Compilation Error in Ignition - SyntaxError: mismatched input expecting INDENT

**URL:** <https://forum.inductiveautomation.com/t/python-script-compilation-error-in-ignition-syntaxerror-mismatched-input-expecting-indent/108675>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [July 18, 2025, 1:54pm UTC](https://forum.inductiveautomation.com/t/python-script-compilation-error-in-ignition-syntaxerror-mismatched-input-expecting-indent/108675 "2025-07-18T13:54:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![henri.vereecke](https://avatars.discourse-cdn.com/v4/letter/h/b38774/32.png) [@henri.vereecke](https://forum.inductiveautomation.com/u/henri.vereecke)\
**Post date:** [July 18, 2025, 1:54pm UTC](https://forum.inductiveautomation.com/t/python-script-compilation-error-in-ignition-syntaxerror-mismatched-input-expecting-indent/108675/1 "2025-07-18T13:54:58Z")

</div>

Hello everyone,

I'm having trouble with a Python script in Ignition that won't compile. I keep getting a syntax error and I can't figure out what's wrong.

**Error Message:**

```python
Warning: "Scheduled Script" did not compile!
Parse Error:
File "", line 6
mode_ete = system.tag.readBlocking(["[CRY_FACILITIES]Cernay/BA/nouveau BA/Convecteurs/réglages/mode ETE"])[0].value
^
SyntaxError: mismatched input 'mode_ete' expecting INDENT

```

**My Script:**

```python
# Script scheduled pour la gestion des convecteurs
# Récupération des valeurs de configuration

# Lecture du mode ETE (True = été, False = hiver)
mode_ete = system.tag.readBlocking(["[CRY_FACILITIES]Cernay/BA/nouveau BA/Convecteurs/réglages/mode ETE"])[0].value

# Lecture des consignes
consigne_hiver = system.tag.readBlocking(["[CRY_FACILITIES]Cernay/BA/nouveau BA/Convecteurs/réglages/consigne hiver"])[0].value
consigne_ete = system.tag.readBlocking(["[CRY_FACILITIES]Cernay/BA/nouveau BA/Convecteurs/réglages/consigne ete"])[0].value

print("Lecture des parametres reussie:")
print("Mode ETE: " + str(mode_ete))
print("Consigne hiver: " + str(consigne_hiver))
print("Consigne ete: " + str(consigne_ete))

# Definition des convecteurs a gerer
convecteurs = ["17", "18", "14-A"]

# Determination de la consigne et du mode a appliquer
if mode_ete == True:
    consigne_a_appliquer = consigne_ete
    mode_operation = 1
    print("Mode ete active - Consigne: " + str(consigne_ete))
else:
    consigne_a_appliquer = consigne_hiver
    mode_operation = 0
    print("Mode hiver active - Consigne: " + str(consigne_hiver))

# Creation des listes pour l'ecriture groupee
tags_consigne = []
tags_mode_operation = []
tags_mode_ventilation = []
valeurs_consigne = []
valeurs_mode_operation = []
valeurs_mode_ventilation = []

# Preparation des tags pour chaque convecteur
for convecteur in convecteurs:
    tags_consigne.append("[CRY_FACILITIES]Cernay/BA/nouveau BA/Convecteurs/" + convecteur + "/Consigne")
    valeurs_consigne.append(consigne_a_appliquer)
    
    tags_mode_operation.append("[CRY_FACILITIES]Cernay/BA/nouveau BA/Convecteurs/" + convecteur + "/reglages/Operation mode configuration")
    valeurs_mode_operation.append(mode_operation)
    
    tags_mode_ventilation.append("[CRY_FACILITIES]Cernay/BA/nouveau BA/Convecteurs/" + convecteur + "/Mode ventilation")
    valeurs_mode_ventilation.append(3)

# Ecriture des valeurs
system.tag.writeBlocking(tags_consigne, valeurs_consigne)
system.tag.writeBlocking(tags_mode_operation, valeurs_mode_operation)
system.tag.writeBlocking(tags_mode_ventilation, valeurs_mode_ventilation)

print("Script termine - Convecteurs traites: " + str(convecteurs))

```

**Context:**

- This is a scheduled script in Ignition
- The script is supposed to read configuration values from tags and update multiple heater units

The error message suggests it's expecting an INDENT, but I don't understand why since line 6 is just a simple variable assignment.

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [July 18, 2025, 2:07pm UTC](https://forum.inductiveautomation.com/t/python-script-compilation-error-in-ignition-syntaxerror-mismatched-input-expecting-indent/108675/2 "2025-07-18T14:07:10Z")

</div>

What is the indentation in regards to the def?

```python
def doSomething(anything):
	param = anything
	print param

```

You need that first level of indentation for the entire code block.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [July 18, 2025, 2:13pm UTC](https://forum.inductiveautomation.com/t/python-script-compilation-error-in-ignition-syntaxerror-mismatched-input-expecting-indent/108675/3 "2025-07-18T14:13:40Z")

</div>

Select the whole code block (except the top line def) and hit Tab to indent the whole section (if that's the problem).

Tip: right-click on the editor | Appearance | Whitespace will show you tabs and spaces.

---

<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:** [July 18, 2025, 2:14pm UTC](https://forum.inductiveautomation.com/t/python-script-compilation-error-in-ignition-syntaxerror-mismatched-input-expecting-indent/108675/4 "2025-07-18T14:14:01Z")

</div>

Pay close attention when Ignition presents an event editor with an embedded `def`. This is the modern Ignition approach to custom code, as it has performance advantages. The code must be indented under the `def`.

Older event scripts show a completely blank editor. In those, event information is exposed as local variables, not as function arguments, and the code is **not** indented.
