-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
version 1.6.9 fails with null module __file__ attribute #756
Labels
Comments
For posterity, this was a specific issue with namespace packages in Python 3.7+:
In particular, this was a CPython cleanup noted here: https://docs.python.org/3/whatsnew/3.7.html#other-cpython-implementation-changes as a bug fix for https://bugs.python.org/issue32305. |
jsirois
added a commit
to jsirois/pants
that referenced
this issue
Aug 20, 2019
This pulls in a fix for the pexes Pants generates when run under CPython 3.7+ and namespace packages are involved. See: pex-tool/pex#756 Before the fix both our own tool pexes and pexes we generated for end users could fail like so: ``` $ ./pants --python-setup-interpreter-constraints="['CPython==3.7.*']" \ test.pytest \ --cache-ignore \ tests/python/pants_test/backend/graph_info/tasks:cloc ... 17:16:00 00:26 [test] ... 17:16:00 00:26 [pytest] Invalidated 1 target. scrubbed PYTHONPATH=/home/jsirois/dev/pantsbuild/pants/src/python: from pytest environment 17:16:00 00:26 [run] Traceback (most recent call last): ... File "/home/jsirois/dev/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-3.7.4/e307788111116c190fe04c233d334b12cdc63f77/.bootstrap/pex/pex.py", line 179, in minimum_sys_modules if cls._tainted_path(module_file, site_libs): File "/home/jsirois/dev/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-3.7.4/e307788111116c190fe04c233d334b12cdc63f77/.bootstrap/pex/pex.py", line 157, in _tainted_path paths = frozenset([path, os.path.realpath(path)]) File "/home/jsirois/dev/pantsbuild/jsirois-pants/build-support/pants_dev_deps.py37.venv/lib/python3.7/posixpath.py", line 394, in realpath filename = os.fspath(filename) TypeError: expected str, bytes or os.PathLike object, not NoneType ... ```
jsirois
added a commit
to pantsbuild/pants
that referenced
this issue
Aug 20, 2019
This pulls in a fix for the pexes Pants generates when run under CPython 3.7+ and namespace packages are involved. See: pex-tool/pex#756 Before the fix both our own tool pexes and pexes we generated for end users could fail like so: ``` $ ./pants --python-setup-interpreter-constraints="['CPython==3.7.*']" \ test.pytest \ --cache-ignore \ tests/python/pants_test/backend/graph_info/tasks:cloc ... 17:16:00 00:26 [test] ... 17:16:00 00:26 [pytest] Invalidated 1 target. scrubbed PYTHONPATH=/home/jsirois/dev/pantsbuild/pants/src/python: from pytest environment 17:16:00 00:26 [run] Traceback (most recent call last): ... File "/home/jsirois/dev/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-3.7.4/e307788111116c190fe04c233d334b12cdc63f77/.bootstrap/pex/pex.py", line 179, in minimum_sys_modules if cls._tainted_path(module_file, site_libs): File "/home/jsirois/dev/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-3.7.4/e307788111116c190fe04c233d334b12cdc63f77/.bootstrap/pex/pex.py", line 157, in _tainted_path paths = frozenset([path, os.path.realpath(path)]) File "/home/jsirois/dev/pantsbuild/jsirois-pants/build-support/pants_dev_deps.py37.venv/lib/python3.7/posixpath.py", line 394, in realpath filename = os.fspath(filename) TypeError: expected str, bytes or os.PathLike object, not NoneType ... ```
patliu85
pushed a commit
to twitter/pants
that referenced
this issue
Aug 20, 2019
This pulls in a fix for the pexes Pants generates when run under CPython 3.7+ and namespace packages are involved. See: pex-tool/pex#756 Before the fix both our own tool pexes and pexes we generated for end users could fail like so: ``` $ ./pants --python-setup-interpreter-constraints="['CPython==3.7.*']" \ test.pytest \ --cache-ignore \ tests/python/pants_test/backend/graph_info/tasks:cloc ... 17:16:00 00:26 [test] ... 17:16:00 00:26 [pytest] Invalidated 1 target. scrubbed PYTHONPATH=/home/jsirois/dev/pantsbuild/pants/src/python: from pytest environment 17:16:00 00:26 [run] Traceback (most recent call last): ... File "/home/jsirois/dev/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-3.7.4/e307788111116c190fe04c233d334b12cdc63f77/.bootstrap/pex/pex.py", line 179, in minimum_sys_modules if cls._tainted_path(module_file, site_libs): File "/home/jsirois/dev/pantsbuild/pants/.pants.d/test/pytest-prep/CPython-3.7.4/e307788111116c190fe04c233d334b12cdc63f77/.bootstrap/pex/pex.py", line 157, in _tainted_path paths = frozenset([path, os.path.realpath(path)]) File "/home/jsirois/dev/pantsbuild/jsirois-pants/build-support/pants_dev_deps.py37.venv/lib/python3.7/posixpath.py", line 394, in realpath filename = os.fspath(filename) TypeError: expected str, bytes or os.PathLike object, not NoneType ... ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On my arch linux system, after the pants upgrade to version 1.6.9, a number of pieces of pants functionality that make use of pex started failing with the following error message:
It looks like what's going on here is that https://github.com/pantsbuild/pex/blob/master/pex/pex.py#L178 is iterating over every module and extracting the
__file__
attribute of that mdoule. However, some module on my system seems to have aNone
value for that attribute, which is causing code downstream of that line to fail. It looks like the commit b5f7e41 might be relevant.The text was updated successfully, but these errors were encountered: