Issue 31440: wrong default module search path in help message (original) (raw)

Created on 2017-09-13 08:01 by xiang.zhang, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3624 merged gauravbackback,2017-09-17 06:10
PR 4613 merged python-dev,2017-11-28 15:17
Messages (9)
msg302032 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-09-13 08:01
In python --help: PYTHONHOME : alternate directory (or :<exec_prefix>). The default module search path uses /pythonX.X. I think the default module search path should be /lib/pythonX.X.
msg302338 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-16 13:48
You are right, the path is wrong on Unix-like platforms. It's os.path.join(sys.prefix, 'lib', 'python{major}.{minor}'). But the actual path may depend on the platform, too. I don't recall how Windows sets up the path.
msg302339 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-16 13:51
See site module, especially site._get_path() # Same to sysconfig.get_path('purelib', os.name+'_user') def _get_path(userbase): version = sys.version_info if os.name == 'nt': return f'{userbase}\\Python{version[0]}{version[1]}\\site-packages' if sys.platform == 'darwin' and sys._framework: return f'{userbase}/lib/python/site-packages' return f'{userbase}/lib/python{version[0]}.{version[1]}/site-packages'
msg302361 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2017-09-17 08:05
Not sure about Windows. _get_path() looks to me is used for user site-packages. getsitepackages() doesn't do the same and seems matching the current message, also the OS2 branch in py2. Let's consult Windows guys.
msg302480 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-09-18 18:50
I don't have time right this second to write it all up, but I did so in the past at https://docs.python.org/3/using/windows.html#finding-modules Hopefully the answer you need is somewhere in that. Module search paths are complicated (but eric.snow is going to make it possible to use Python code to derive the search path at startup... right Eric? Right? :) )
msg307127 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-11-28 15:16
New changeset 08d2b86a1058b733bb7f1ae2b55818dd9687d21c by Christian Heimes (gauravbackback) in branch 'master': bpo-31440: Changed default module search path for windows https://github.com/python/cpython/commit/08d2b86a1058b733bb7f1ae2b55818dd9687d21c
msg307132 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-28 15:45
I confirm that Python 2.7 is affected and should also be fixed.
msg307147 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-11-28 17:18
I'll do a backport tomorrow.
msg307148 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-11-28 17:18
New changeset cb79c2203953bd465f2c53b7a09a51071717575f by Christian Heimes (Miss Islington (bot)) in branch '3.6': bpo-31440: Changed default module search path for windows (#4613) https://github.com/python/cpython/commit/cb79c2203953bd465f2c53b7a09a51071717575f
History
Date User Action Args
2022-04-11 14:58:52 admin set github: 75621
2018-12-27 23:36:34 cheryl.sabella set status: open -> closedresolution: fixedstage: patch review -> resolved
2017-11-28 17🔞31 christian.heimes set messages: +
2017-11-28 17🔞05 christian.heimes set assignee: christian.heimesmessages: +
2017-11-28 15:45:16 vstinner set nosy: + vstinnermessages: +
2017-11-28 15:17:42 python-dev set pull_requests: + <pull%5Frequest4528>
2017-11-28 15:16:33 christian.heimes set messages: +
2017-09-18 18:50:00 steve.dower set nosy: + eric.snowmessages: +
2017-09-17 08:05:45 xiang.zhang set nosy: + zach.ware, eryksun, steve.dower, gauravbackbackmessages: +
2017-09-17 06:10:04 gauravbackback set keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest3614>
2017-09-16 13:51:15 christian.heimes set messages: +
2017-09-16 13:48:11 christian.heimes set type: behaviormessages: + nosy: + christian.heimes
2017-09-13 08:01:11 xiang.zhang create