Strange behaviour of subprocess_check_output with Macports Python in virtualenv

Ruben Di Battista rubendibattista at gmail.com
Sat Feb 8 00:42:45 UTC 2020


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?)
          _   
-.     .´  |∞∞∞∞
  ',  ;    |∞∞∞∞∞∞
    ˜˜     |∞∞∞∞∞∞∞∞∞ RdB
    ,.,    |∞∞∞∞∞∞
  .'   '.  |∞∞∞∞
-'       `’

https://rdb.is
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20200208/dbbdfd1d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP using AMPGpg
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20200208/dbbdfd1d/attachment.sig>


More information about the macports-users mailing list