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

Unable to load smart_open.gcs #474

Closed
andrewasheridan opened this issue Apr 13, 2020 · 2 comments · Fixed by #476
Closed

Unable to load smart_open.gcs #474

andrewasheridan opened this issue Apr 13, 2020 · 2 comments · Fixed by #476

Comments

@andrewasheridan
Copy link

andrewasheridan commented Apr 13, 2020

I have an issue similar to this : https://stackoverflow.com/questions/61126546/docker-compose-up-d-cannot-finish-because-an-error

Installation in docker works fine but when importing this error crops up.

The issue does not occur with 1.10, only with 1.11

Apologies for the total lack of details / reproducibility. I will try to add those tomorrow if possible.

@Andrew-Sheridan
Copy link

I apologize, my above description is just not at all correct. Boo me.

So the issue that I was having was that my tests for a CLI were failing during a build process. That happens in Docker and for some reason I thought that was the issue (it's not).

The test for the CLI was essentially a test to ensure it had installed correctly, that the entrypoint name was available, something like this:

    from subprocess import PIPE
    from subprocess import Popen
    process = Popen(["entrypoint-foo", "--help"], stdout=PIPE, stderr=PIPE)
    stdout, stderr = process.communicate()
    assert stdout.decode().startswith("CLI entrypoint for Foo")
    assert stderr == b""

Foo could essentially have just been a script with import smart_open as open

The line assert stderr == b"" used to work, but as of smart_open==1.11.0, it is failing because stderr is now equal to b"unable to import 'smart_open.gcs', disabling that module\n".

The real issue is just my sucky test.

I'm really happy with the work everyone has put into smart_open, and I saw the recent conversation around using extras_requires to help slim down installations - I will absolutely be moving towards pip install smart-open[aws] for Serverless Lambda installs.

In closing, I don't think there is really an issue here, besides my not-awesome testing of the my CLI.

Also I am definitely commenting using the wrong account but oh well. . Thanks again!

@mpenkov mpenkov closed this as completed Apr 14, 2020
@mpenkov
Copy link
Collaborator

mpenkov commented Apr 14, 2020

Thank you for the kind words.

I think if you check the exit value of the subprocess instead of its stderr, your script will be robust to issues like this.

mpenkov added a commit that referenced this issue Jun 17, 2020
* Prevent regression of #474 and #475

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* flake8 init.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants