Describe the bug
The main.m program which initialises the Python runtime sets PYTHONHOME here:
|
python_home = [NSString stringWithFormat:@"%@/support/python-stdlib", resourcePath, nil]; |
|
NSLog(@"PythonHome: %@", python_home); |
|
wtmp_str = Py_DecodeLocale([python_home UTF8String], NULL); |
|
status = PyConfig_SetString(&config, &config.home, wtmp_str); |
This is does not work as intended. As documented in https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME, the home is suffixed with /lib/python3.11, resulting in the Python runtime believing that
Contents/Resources/support/python-stdlib/lib/python3.11
is the location of its stdlib.
In practice, this is not a problem because we later explicitly include the stdlib in the Python path:
|
path = [NSString stringWithFormat:@"%@/support/python-stdlib/lib-dynload", resourcePath, nil]; |
|
NSLog(@"- %@", path); |
|
wtmp_str = Py_DecodeLocale([path UTF8String], NULL); |
|
status = PyWideStringList_Append(&config.module_search_paths, wtmp_str); |
This does mean however that the initially quoted lines currently are not useful at all.
To Reproduce
- Build the Xcode project.
- From the Python program, inspect ``.
Additional context
We could do either of the following:
- Completely rely on the PYTHONPATH to contain the stdlib.
- Set the stdlib dir correctly, if possible, and omit it the PYTHONPATH.
- Change the location of the stdlib directory to
Contents/Resources/support/lib/python3.11
Describe the bug
The
main.mprogram which initialises the Python runtime sets PYTHONHOME here:briefcase-macOS-Xcode-template/{{ cookiecutter.formal_name }}/{{ cookiecutter.class_name }}/main.m
Lines 53 to 56 in fdcbf96
This is does not work as intended. As documented in https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME, the
homeis suffixed with/lib/python3.11, resulting in the Python runtime believing thatis the location of its stdlib.
In practice, this is not a problem because we later explicitly include the stdlib in the Python path:
briefcase-macOS-Xcode-template/{{ cookiecutter.formal_name }}/{{ cookiecutter.class_name }}/main.m
Lines 121 to 124 in fdcbf96
This does mean however that the initially quoted lines currently are not useful at all.
To Reproduce
Additional context
We could do either of the following:
Contents/Resources/support/lib/python3.11