Skip to content

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

@idgserpro

Description

@idgserpro
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions