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

Improve py27 detection to avoid "No module named venv" when using plonecli #70

Open
idgserpro opened this issue Sep 1, 2021 · 3 comments

Comments

@idgserpro
Copy link

  • Plone CLI version: 2.1.2
  • Python version: 2.7
  • Operating System: Ubuntu 18.04

Right now, the logic to use virtualenv instead of venv is a bit fragile, since it tries to detect python 2 by comparing if the bin is python2.7

if python_bin == "python2.7":

A more robust condition using sys.version_info is better since you can use any compiled python in any path. A little hackish, but it works instead of comparing to python2.7string: if subprocess.call([python_bin, "-c", "import sys; sys.exit(0) if sys.version_info.major == 2 else sys.exit(1)"]) == 0

@jensens

@jensens
Copy link
Sponsor Member

jensens commented Sep 1, 2021

@idgserpro sounds like a plan. Would you prepare a pull request?
Alternatively checking python --version would be a way to check. But executing code with an exit is probably most save.

@idgserpro
Copy link
Author

I thought about the PR but can't sign the Contributor's Agreement and this package it's in plone namespace. 😢 That's why it's opened as an issue with a suggestion.

@MrTango
Copy link
Contributor

MrTango commented Sep 5, 2022

I thought about the PR but can't sign the Contributor's Agreement

why?

I's a pity, you have a lot great ideas ;)

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

No branches or pull requests

3 participants