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

API code uses sys.exit to signal errors #35

sqlalchemy-bot opened this Issue Feb 28, 2012 · 2 comments


None yet
1 participant

sqlalchemy-bot commented Feb 28, 2012

Migrated issue, originally created by Robert Buchholz (@rbuchholz)

The documentation describes the following as API to stamp a database:

    from alembic.config import Config
    from alembic import command
    alembic_cfg = Config(path_to_config)
    command.stamp(alembic_cfg, "head")

If stamp encounters an error reading the config file, it will use util.err which stops program execution immediately:

def err(message):

While it is possible to catch SystemExit, I would favor a more specific exception that includes the error message for the API part of the command.


This comment has been minimized.

sqlalchemy-bot commented Feb 28, 2012

Michael Bayer (@zzzeek) wrote:

oh that's just a bug, util.err() should only be called in main() when the runner is definitely via commandline. It's a CommandError in [[|6aeeebeb8a1401b010347bbae8373d0422ee8ba3]].


This comment has been minimized.

sqlalchemy-bot commented Feb 28, 2012

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment