Strange behaviour of subprocess_check_output with Macports Python in virtualenv

Ruben Di Battista rubendibattista at gmail.com
Fri Mar 13 09:47:48 UTC 2020


The problem has been solved with the updated of virtualenv, that is
currently in a PR for Macports. 😉

On Fri, 13 Mar 2020, 00:09 Ryan Schmidt, <ryandesign at macports.org> wrote:

> I am dropping macports-dev from Cc because the question is not about
> developing MacPorts.
>
> On Feb 7, 2020, at 18:42, Ruben Di Battista wrote:
>
> > Hello,
> > I’m experiencing a problem (
> https://github.com/davidhalter/jedi/issues/1375).
> >
> > Running this on a Python installed with Macports:
> > ```
> > Python 3.8.1 (default, Feb  8 2020, 01:33:23)
> > [Clang 11.0.0 (clang-1100.0.33.16)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import subprocess
> > >>>
> subprocess.check_output('/Users/rubendibattista/.envs/josiepy-B4k-0ZyT/bin/python
> -c "import sys; print(sys.executable)"', shell=True)
> > b'/opt/local/bin/python\n'
> >
> > ```
> >
> > I get as result the system python executable and not the one from the
> virtualenv (created using pew).
> > While on Linux:
> >
> > ```
> > Python 3.7.3 (default, Jun  7 2019, 17:57:55)
> > [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import subprocess
> > >>>
> subprocess.check_output('/home/ruben.di-battista/.envs/josiepy/bin/python
> -c "import sys; print(sys.executable)"', shell=True)
> > b'/home/ruben.di-battista/.envs/josiepy/bin/python\n'
> >
> > ```
> >
> > Does it work for you? Is it a bug from Macports, from my particular
> configuration, from macOs or from Python build on macOs? (Or isn’t a bug?)
>
> I am not very familiar with Python and I do not have any virtualenv. I can
> however offer this result from my High Sierra system:
>
>
> $ /opt/local/bin/python3.8
> Python 3.8.2 (default, Mar  2 2020, 03:10:15)
> [Clang 9.1.0 (clang-902.0.39.2)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import subprocess
> >>> subprocess.check_output('/opt/local/bin/python3.7 -c "import sys;
> print(sys.executable)"', shell=True)
> b'/opt/local/bin/python3.7\n'
> >>> ^D
>
>
> In other words, that seems to be working correctly.
>
> Possibly relevant is that I do not have /opt/local/bin/python. If you have
> it, what is it, and do you still experience the same problem if you remove
> it?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20200313/5f5265d5/attachment.html>


More information about the macports-users mailing list