Skip to content

Spaces in def setup() definition are tripping up the run_sketch utility #314

@hx2A

Description

@hx2A

Things that don't work that should:

def setup( ):
    size(200, 200)

def draw( ):
    rect(mouse_x, mouse_y, 10, 10)
def setup ():
    size(200, 200)

def draw ():
    rect(mouse_x, mouse_y, 10, 10)

This is closely related to #160 and I know I made a fix for this specifically but it seems I didn't test it well enough. If setup() has extra spaces but draw() does not, it works correctly. If draw() has extra spaces or is not defined for this Sketch, it does have a problem.

To fix this I need to take the regex I wrote to address this before and apply it to two other locations in py5_tools/parsing.py and py5_tools/imported.py.

Thanks to @villares for finding this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions