Skip to content

exit is not imported in lightning/pytorch/trainer/call.pyΒ #20666

@galtay-tempus

Description

@galtay-tempus

Bug description

keyboard interrupt a run and you will end up here with a, NameError: name 'exit' is not defined

https://github.com/Lightning-AI/pytorch-lightning/blob/master/src/lightning/pytorch/trainer/call.py#L65

likely just needs
from sys import exit
or
import sys
sys.exit(1)

What version are you seeing the problem on?

v2.5

How to reproduce the bug

Error messages and logs

# Error messages and logs here please

Environment

Current environment
#- PyTorch Lightning Version (e.g., 2.5.0):
#- PyTorch Version (e.g., 2.5):
#- Python version (e.g., 3.12):
#- OS (e.g., Linux):
#- CUDA/cuDNN version:
#- GPU models and configuration:
#- How you installed Lightning(`conda`, `pip`, source):

More info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageWaiting to be triaged by maintainersver: 2.5.x

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions