Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Python.Path

Queries the default module search path.

Component Version macOS Windows Linux Server iOS SDK
Python 14.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Python.Path" )

Parameters

none

Result

Returns text or error.

Description

Queries the default module search path.
This is computed from the program name (set by assigning ProgramName) and some environment variables. The returned string consists of a series of directory names separated by a platform dependent delimiter character. The delimiter character is ':' on Unix and macOS, ';' on Windows.
The list sys.path is initialized with this value on interpreter startup; it can be (and usually is) modified later to change the search path for loading modules.

Examples

Query path on macOS:

MBS( "Python.Path" )

Example result: /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python312.zip:/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12:/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload

Blog Entries

This function is free to use.

Created 12nd June 2024, last changed 12nd June 2024


Python.New - Python.PrintOutput