Skip to content

NameError in Chapter19/example3 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Matej-Chmel opened this issue Sep 3, 2023 · 0 comments
Open

NameError in Chapter19/example3 #10

Matej-Chmel opened this issue Sep 3, 2023 · 0 comments

Comments

@Matej-Chmel
Copy link

When running script Chapter19/example3.py a NameError is raised:

scheduler.shutdown()
NameError: name 'scheduler' is not defined

The problem can be fixed by indenting the line 27 under the main guard.

Current version
if __name__ == '__main__':
    scheduler = BackgroundScheduler()
    ...
scheduler.shutdown()
Solution
if __name__ == '__main__':
    scheduler = BackgroundScheduler()
    ...
    scheduler.shutdown()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant