Skip to content

Conversation

@blag
Copy link
Contributor

@blag blag commented Dec 18, 2020

This PR fixes a regression introduced by #5106. That code runs within a pack's virtualenv, and because we are still supporting Python 2 in StackStorm Exchange packs, we also need to support Python 2 in st2common/content/loader.py.

Using the encoding keyword argument to open() works on Python 3, but the native open() on Python 2 does not accept the encoding argument.

Instead, this PR imports io.open when running on Python 2, which should resolve the issue.

Thanks to @nmaludy for tracking down the issue and @armab for pointing this Stack Overflow post out on Slack.

@pull-request-size pull-request-size bot added the size/XS PR that changes 0-9 lines. Quick fix/merge. label Dec 18, 2020
@blag
Copy link
Contributor Author

blag commented Dec 18, 2020

See the Ansible pack CI for illuminating this regression.

That issue will affect all Python 2 pack CI runs, which will be ~160 starting later today.

@blag
Copy link
Contributor Author

blag commented Dec 18, 2020

Thanks for the review! Will merge this later today once all of the CI (except for maybe Travis) are green.

@blag blag added this to the 3.4.0 milestone Dec 18, 2020
@blag blag merged commit 7ad17fd into master Dec 18, 2020
@blag blag deleted the fix-open-python2 branch December 18, 2020 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug packs python3 regression size/XS PR that changes 0-9 lines. Quick fix/merge.

4 participants