Override Graphics in View

I’m trying to override element color in a view by a parameter value, I’m getting no errors but the color is not changing. This code probably has some extra bits because it is just for testing before I copy code over to a permanent tool later.

# Imports
# import pyRevit
from pyrevit import DB, revit, script, forms, HOST_APP

# Specific Imports
from Autodesk.Revit.DB import (FilteredElementCollector, View, Categories, Category, Element, CategoryType, Viewport,
                               BuiltInCategory, SharedParameterElement, Color, Transaction, OverrideGraphicSettings)
from Autodesk.Revit.UI import UIDocument
from Autodesk.Revit.ApplicationServices import Application
from itertools import izip_longest
import System
# ################################################################################
# Debug toggles
globalDebug = True
disabledScript = False


def dprint(*printItems):
    if globalDebug:
        for pI in printItems:
            print(pI)


# Clicky
output = script.get_output()

# Spaces
spaces = "&nbsp"

# Doc
doc = __revit__.ActiveUIDocument.Document
# Current View
cView = doc.ActiveView
acctive_view = HOST_APP.active_view

# Revit Version
versionValue = HOST_APP.version

####################################################################################################
####################################################################################################
# Color Code Sound Systems
####################################################################################################
####################################################################################################

speaker_collections = (FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_CommunicationDevices)
                     .WhereElementIsNotElementType().ToElements())

####################################################################################################
# Class
class SpeakerInfo:
    def __init__(self, speaker_instance, system):
        self.speaker_instance = speaker_instance
        self.system = system

class SystemInfo:
    def __init__(self, system, system_color):
        self.system = system
        self.system_color = system_color


####################################################################################################
# Get speakers and create list
speakers = []
for sC in speaker_collections:
    dprint(sC.Name)
    if sC.LookupParameter("Tech_SpeakerSystem") is None:
        pass
    else:
        value = sC.LookupParameter("Tech_SpeakerSystem").AsString()
        speakers.append(SpeakerInfo(sC, value))

# Speaker check for debug testing
dprint("___________________Speaker Check________________________")
for s in speakers:
    dprint(s.speaker_instance.Name)
    dprint(s.system)
    dprint("___________")

####################################################################################################
# Get systems and create list

# Pastel Color List
color_list = [Color(255, 204, 153),
              Color(255, 255, 153),
              Color(204, 255, 153),
              Color(153, 255, 153),
              Color(153, 255, 204),
              Color(153, 255, 255),
              Color(153, 204, 255),
              Color(153, 153, 255),
              Color(204, 153, 255),
              Color(255, 153, 255),
              Color(255, 153, 204)]


systems = []
systems.append(SystemInfo("", Color(255, 0, 0)))
color_index = 0
for s in speakers:
    if s.system in [x.system for x in systems]:
        pass
    else:
        systems.append(SystemInfo(s.system, color_list[color_index]))
        color_index += 1

dprint("___________________System Check________________________")
for s in systems:
    dprint(s.system)
    dprint(s.system_color)

with revit.Transaction("pyRevit - Speaker System Colors"):
    for sp in speakers:
        ogs = OverrideGraphicSettings()
        ogs.SetProjectionLineColor([i.system_color for i in systems if i.system == sp.system][0])
        acctive_view.SetElementOverrides(sp.speaker_instance.Id, ogs)
    forms.alert("Colors added to speakers by system.")

I had a script.exit() at the end that I didn’t include in the post above. I had this because I was testing an alternate method below it that I have since removed. I removed the script.exit and the elements gain the color override after the alert appears but only for a second, after which they return to their default white color. Not sure what is going on there.

EDIT: Never mind, I accidentally had uncommented code below this that was causing an error.