https://pulumi.com logo
#automation-api
Title
# automation-api
b

broad-hairdresser-1495

05/28/2021, 5:39 PM
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

bored-oyster-3147

05/28/2021, 5:45 PM
have you tried providing a full path instead of a relative path?
b

broad-hairdresser-1495

05/28/2021, 5:46 PM
yes, I tried that, and it does not help
b

bored-oyster-3147

05/28/2021, 5:50 PM
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

lemon-agent-27707

05/28/2021, 5:50 PM
Looks like a bug. Can you try setting opts.work_dir
jinx
😅 1
b

broad-hairdresser-1495

05/28/2021, 5:58 PM
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/"))