Hi, I have a basic question. How do run python pro...
# automation-api
b
Hi, I have a basic question. How do run python program using
auto.create_or_select_stack
so that stack will use my local path
work_dir="localPath/"
with
Copy code
from pulumi import automation as auto
stack = auto.create_or_select_stack(stack_name=stack_name, project_name=project_name, program=pulumi_program, work_dir="localPath/")
it seems to jump in here: from
pulumi/automation/_local_workspace.py
Copy code
if _is_inline_program(**args):  # <<< here
        return _inline_source_stack_helper(stack_name, program, project_name, Stack.create_or_select, opts)  # type: ignore
    if _is_local_program(**args):
        return _local_source_stack_helper(stack_name, work_dir, Stack.create_or_select, opts)  # type: ignore
due to I get this error:
Copy code
error: unable to open bucket file:///C:/Users/romlaz/AppData/Local/Temp/automation-ib7k43_6/myLOGS2: CreateFile C:\Users\romlaz\AppData\Local\Temp\automation-ib7k43_6\myLOGS2: The system cannot find the file specified.
It tries to create a temp location but I need to have this stated in
work_dir="localPath/"
b
have you tried providing a full path instead of a relative path?
b
yes, I tried that, and it does not help
b
it looks like the way the python API was written the top-level provided
work_dir
is ignored for inline programs. Instead, try setting
work_dir
on
opts.work_dir
l
Looks like a bug. Can you try setting opts.work_dir
jinx
😅 1
b
this seem to be working better:
Copy code
stack = auto.create_or_select_stack(stack_name=stack_name, project_name=project_name, program=pulumi_program, opts=auto.LocalWorkspaceOptions(work_dir="myLOGS/"))