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

Python files with invalid names are incorrectly handled #356

Closed
sqlalchemy-bot opened this Issue Feb 4, 2016 · 5 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Feb 4, 2016

Migrated issue, originally created by Sébastien Leblanc (@sebleblanc)

Emacs leaves backup files named .#name_of_my_python_file.py. It seems that Alembic will pick them up (as if it was looking for all files "*.py") but when it tries to load them the interpreter trips up because it is not a valid Python module name.

Alembic should validate the name of the module before attempting to load it, ignoring it if it its name is invalid.

  File "/home/sebleblanc/myproject/virtualenv/lib/python3.5/site-packages/alembic/util/pyfiles.py", line 87, in load_python_file
    raise ImportError("Can't find Python file %s" % path)
ImportError: Can't find Python file /home/sebleblanc/myproject/app/migrations/versions/.#fc57a0d49adc_leftover_file.py
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Feb 4, 2016

Changes by Sébastien Leblanc (@sebleblanc):

  • edited description
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Feb 4, 2016

Michael Bayer (@zzzeek) wrote:

there's an existing regexp that checks these, feel free to send a PR.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Feb 4, 2016

Changes by Michael Bayer (@zzzeek):

  • removed labels: feature
  • added labels: bug
@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Nov 28, 2016

Michael Bayer (@zzzeek) wrote:

Ignore py files generated by emacs

Added a file ignore for Python files of the form .#<name>.py,
which are generated by the Emacs editor. Pull request courtesy
Markus Mattes.

Change-Id: I06861c2ba7b8e6730948c01ff0690b50bdb26f0f
Pull-request: zzzeek/alembic#32
Fixes: #356

053062c

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Nov 28, 2016

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