Skip to content

Update Python samples to use project relative to script #2266

Closed
@billti

Description

@billti

In the Python samples that load a Q# project, we often set the project_root as "." However this is relative to the process working directory, which is likely the workspace in VS Code, which means the script fails to run if not at the root of the workspace.

We should probably change the Python samples to use something like,

from pathlib import Path
this_dir = Path(__file__).resolve().parent
qsharp.init(project_root=this_dir)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions