メインコンテンツ

polyspace.__install_path__

(Python) Get Polyspace installation folder

Since R2026a

Description

polyspace.__install_path__ returns the Polyspace® installation folder in a Python® script.

Examples

collapse all

Load the sample project polyspaceroot\polyspace\examples\pstest\Getting_Started_Example\Demo_C_PS_Test.psprjx available with a Polyspace Test™ installation. Here, polyspaceroot is the Polyspace installation folder.

In general, you generate and manage Polyspace Test projects and results by using classes from the polyspace package or its modules. Before starting, make sure you can import the package or its modules on a Python shell or in a Python script without errors. For more information, see Set Up Python API for Polyspace.

  1. Import the polyspace.project module (which loads the parent polyspace package):

    import polyspace
    import os

  2. Create the full path to the sample project by appending a relative path to the Polyspace installation folder. To determine the installation folder, use the polyspace.__install_path__ property.

    project_path = os.path.join(
        polyspace.__install_path__,
        "polyspace",
        "examples",
        "pstest",
        "Getting_Started_Example",
        "Demo_C_PS_Test"
    )
    proj = polyspace.project.Project(project_path)

Version History

Introduced in R2026a