Skip to content

AttributeError: 'ScriptLine' object has no attribute 'stage_direction' #812

@Tim020

Description

@Tim020

Issue Description

The application throws an AttributeError when accessing the /api/v1/show/character/stats endpoint.

Error Traceback

[E 260106 11:38:08 web:1945] Uncaught exception GET /api/v1/show/character/stats (::1)
    HTTPServerRequest(protocol='http', host='localhost:8080', method='GET', uri='/api/v1/show/character/stats', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "/Users/tim/.pyenv/versions/venv313-digiscript/lib/python3.13/site-packages/tornado/web.py", line 1859, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/Users/tim/Documents/Code/DigiScript/server/controllers/api/show/characters.py", line 201, in get
        if line.stage_direction:
           ^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'ScriptLine' object has no attribute 'stage_direction'

Root Cause

The stage_direction boolean field was removed from the ScriptLine model in commit 08b6424 and replaced with a line_type enum field (supporting DIALOGUE, STAGE_DIRECTION, CUE_LINE, SPACING types).

However, several files still reference the old stage_direction attribute:

Production Code

  1. /server/controllers/api/show/characters.py line 201
  2. /server/controllers/api/show/cast.py line 189
  3. /server/utils/show/mic_assignment.py line 127

Test Code

  1. /server/test/utils/show/test_mic_assignment.py (multiple lines)

Impact

  • Character statistics endpoint crashes
  • Cast statistics endpoint likely crashes
  • Microphone auto-assignment may fail

Solution

Replace all instances of if line.stage_direction: with if line.line_type != ScriptLineType.DIALOGUE: to properly check for non-dialogue line types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeIssues created by Claude

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions