-
Notifications
You must be signed in to change notification settings - Fork 259
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
Unable to import aiomysql while running as uid without account #587
Comments
@chrisburr do you want to create a PR from your commit? |
I'm surprised I hadn't already 😅. Done in #687 |
* Allow getpass.getuser() to fail Fixes #587 * add changelog entry Co-authored-by: Richard Schwab <[email protected]>
Hello, I'm running into the same issue for a deployment. How can we include this fix in our code? The latest release I see on pypi is from november |
Hi, I recently took over maintaining aiomysql. In my personal projects I worked around this by creating a container user in the image, though I do realize that this may not be possible in all scenarios, such as openshift I believe, where it gets randomized. Other than that, until a new release is out, there's probably only the option to package it yourself and use a local package or vendoring this library. |
On openshift I currently use this as a workaround: # Workaround for https://github.com/aio-libs/aiomysql/issues/587
getuser = getpass.getuser
getpass.getuser = lambda: "unknown"
import aiomysql # noqa
getpass.getuser = getuser |
Hi,
I'm trying to run a script inside a container.
I don't know the UID the container runs as at build time and I don't want to initialize the container as root, so I can't workaround by creating the user at runtime.
This means that at runtime the UID the script is running as does not have an entry in
/etc/passwd
.This is however expected at least in the current master at the time of writing, not sure if there are other places where this is expected in the code:
aiomysql/aiomysql/connection.py
Line 45 in 0a8af23
Currently when trying to
import aiomysql
the following exception is raised:To reproduce:
Dockerfile
demo.py
DOCKER_BUILDKIT=1 docker build -t test-py .
docker run --rm -it --user 12345 test-py
The text was updated successfully, but these errors were encountered: