Skip to content
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
Closed

Python files with invalid names are incorrectly handled #356

sqlalchemy-bot opened this issue Feb 4, 2016 · 5 comments
Labels
bug Something isn't working low priority

Comments

@sqlalchemy-bot
Copy link

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
Copy link
Author

Changes by Sébastien Leblanc (@sebleblanc):

  • edited description

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

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

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • removed labels: feature
  • added labels: bug

@sqlalchemy-bot
Copy link
Author

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
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added low priority bug Something isn't working labels Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority
Projects
None yet
Development

No branches or pull requests

1 participant