Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy_interface.c
| Show First 20 Lines • Show All 335 Lines • ▼ Show 20 Lines | |||||
| # if defined(__APPLE__) || defined(_WIN32) | # if defined(__APPLE__) || defined(_WIN32) | ||||
| fprintf(stderr, | fprintf(stderr, | ||||
| "Bundled Python not found and is expected on this platform " | "Bundled Python not found and is expected on this platform " | ||||
| "(the 'install' target may have not been built)\n"); | "(the 'install' target may have not been built)\n"); | ||||
| # endif | # endif | ||||
| } | } | ||||
| } | } | ||||
| /* Without this the `sys.stdout` may be set to 'ascii' | /* Force `utf-8` on all platforms, since this is what's used for Blender's internal strings, | ||||
| * (it is on my system at least), where printing unicode values will raise | * providing consistent encoding behavior across all Blender installations. | ||||
| * an error, this is highly annoying, another stumbling block for developers, | * | ||||
| * so use a more relaxed error handler and enforce utf-8 since the rest of | * This also uses the `surrogateescape` error handler ensures any unexpected bytes are escaped | ||||
| * Blender is utf-8 too - campbell */ | * instead of raising an error. | ||||
| Py_SetStandardStreamEncoding("utf-8", "surrogateescape"); | * | ||||
| * Without this `sys.getfilesystemencoding()` and `sys.stdout` for example may be set to ASCII | |||||
| * or some other encoding - where printing some `utf-8` values will raise an error. | |||||
| * | |||||
| * This can cause scripts to fail entirely on some systems. | |||||
| * | |||||
| * This assignment is the equivalent of enabling the `PYTHONUTF8` environment variable. | |||||
| * See `PEP-540` for details on exactly what this changes. */ | |||||
| Py_UTF8Mode = 1; | |||||
| /* Suppress error messages when calculating the module search path. | /* Suppress error messages when calculating the module search path. | ||||
| * While harmless, it's noisy. */ | * While harmless, it's noisy. */ | ||||
| Py_FrozenFlag = 1; | Py_FrozenFlag = 1; | ||||
| /* Only use the systems environment variables and site when explicitly requested. | /* Only use the systems environment variables and site when explicitly requested. | ||||
| * Since an incorrect 'PYTHONPATH' causes difficult to debug errors, see: T72807. */ | * Since an incorrect 'PYTHONPATH' causes difficult to debug errors, see: T72807. */ | ||||
| Py_IgnoreEnvironmentFlag = !py_use_system_env; | Py_IgnoreEnvironmentFlag = !py_use_system_env; | ||||
| ▲ Show 20 Lines • Show All 477 Lines • Show Last 20 Lines | |||||