Skip to content

module 'sys' has no attribute '_framework' (mac) #1342

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

Closed
vazrupe opened this issue Sep 5, 2019 · 0 comments · Fixed by #1343
Closed

module 'sys' has no attribute '_framework' (mac) #1342

vazrupe opened this issue Sep 5, 2019 · 0 comments · Fixed by #1343
Labels
C-compat A discrepancy between RustPython and CPython

Comments

@vazrupe
Copy link
Contributor

vazrupe commented Sep 5, 2019

Feature

스크린샷 2019-09-05 오후 8 58 13

RustPython$ RUSTPYTHONPATH=`pwd`/Libs ./whats_left.sh

...

  File "/Users/vazrupe/workspace/RustPython/Lib/site.py", line 570, in <module>
    if not sys.flags.no_site:
  File "/Users/vazrupe/workspace/RustPython/Lib/site.py", line 556, in main
    ENABLE_USER_SITE = check_enableusersite()
  File "/Users/vazrupe/workspace/RustPython/Lib/site.py", line 312, in addusersitepackages
    user_site = getusersitepackages()
  File "/Users/vazrupe/workspace/RustPython/Lib/site.py", line 297, in getusersitepackages
    userbase = getuserbase() # this will also set USER_BASE
  File "/Users/vazrupe/workspace/RustPython/Lib/site.py", line 286, in getuserbase
    USER_BASE = _getuserbase()
  File "/Users/vazrupe/workspace/RustPython/Lib/site.py", line 257, in _getuserbase
    if sys.platform == "darwin" and sys._framework:
AttributeError: module 'sys' has no attribute '_framework'

RustPython and system Python have the following attributes:

RustPython$ cargo run -- -c 'import sys; print(sys._framework)'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'sys' has no attribute '_framework'
RustPython$ python3 --version
Python 3.7.4
RustPython$ python3 -c 'import sys; print(sys._framework)'
Python

Python Documentation

This attribute represents the name of the framework bundle on mac.

Here you can see that the framework name of the Python binary on mac is Python.

Instructions on how to replace this attribute with a different value can be found in the README in python/cpython. I could change to the following command:

$ git clone https://github.com/python/cpython
$ cd cpython
cpython$ ./configure --with-framework-name=example --enable-framework
cpython$ make frameworkinstall
cpython$ ls /Library/Frameworks/example.framework/Versions/Current/bin/
2to3			pip3			python3-config
2to3-3.9		pip3.9			python3.9
easy_install-3.9	pydoc3			python3.9-config
idle3			pydoc3.9
idle3.9			python3
cpython$ /Library/Frameworks/example.framework/Versions/Current/bin/python3
Python 3.9.0a0 (heads/master:29bb227a0c, Sep  5 2019, 23:11:17)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys._framework
'example'
@vazrupe vazrupe added the C-compat A discrepancy between RustPython and CPython label Sep 5, 2019
vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 5, 2019
vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 5, 2019
vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 7, 2019
vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 8, 2019
vazrupe added a commit to vazrupe/RustPython that referenced this issue Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-compat A discrepancy between RustPython and CPython
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants