-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Use an explicit encoding when reading the configuration file #1273
Labels
Comments
zzzeek
added
bug
Something isn't working
command interface
PRs (with tests!) welcome
and removed
requires triage
New issue that requires categorization
labels
Jul 14, 2023
that's fine, can you please send a pull request? thanks |
kkirsche
added a commit
to kkirsche/alembic
that referenced
this issue
Jul 14, 2023
Fix sqlalchemy#1273 This merge request explicitly sets the encoding of the configuration file being read to "utf-8" as recommended by https://docs.python.org/3/library/io.html#opt-in-encodingwarning
kkirsche
added a commit
to kkirsche/alembic
that referenced
this issue
Jul 14, 2023
Fix sqlalchemy#1273 This merge request explicitly sets the encoding of the configuration file being read to "utf-8" as recommended by https://docs.python.org/3/library/io.html#opt-in-encodingwarning
3 tasks
Course, sent 🙂 Thank you for your time and consideration. |
Kevin Kirsche has proposed a fix for this issue in the main branch: Specify |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When the python option
PYTHONWARNDEFAULTENCODING
is set as described on https://docs.python.org/3/library/io.html#opt-in-encodingwarningExpected behavior
Alembic will explicitly specify the encoding to use when reading the configuration file. Per https://docs.python.org/3/library/io.html#opt-in-encodingwarning, the recommendation would be to use
"utf-8"
.To Reproduce
Run an alembic migration with the environment variable
PYTHONWARNDEFAULTENCODING
set to any value. In my testing, I am using1
as my value.Error
Versions.
macOS 13.4.1 (c) (22F770820d)
Python 3.11.4
1.11.1
2.0.18[mysql, mypy]
mariadb from 11.0.2-MariaDB, client 15.2 for osx10.18 (arm64) using EditLine wrapper
mysqlclient 2.2.0
Additional context
The
read
function passes the encoding to https://docs.python.org/3/library/io.html#io.text_encodingFor me, this returns
"locale"
which may make sense to use if you are not comfortable with"utf-8"
."locale"
which, as I understand it, uses https://docs.python.org/3/library/locale.html to detect the encoding settings of the caller's machine.Thank you for your consideration
Have a nice day!
The text was updated successfully, but these errors were encountered: