https://prefect.io logo
Title
m

Mansour Zayer

06/21/2022, 3:45 PM
Hello. I'm trying to use ShellTask locally on Windows using Prefect core, but I'm having issues. I found this old Issue on Github saying that ShellTask isn't windows-compatible. Is there a fix or any workaround?
The end goal here is to execute a
dbt run
command. I tried dbt task library, but it's a child of ShellTask class, so the same issue...
k

Kevin Kho

06/21/2022, 3:47 PM
Check this. You need bash on your path to use it
But you can also maybe use your own
os.subprocess
call inside a task
m

Mansour Zayer

06/22/2022, 1:05 PM
Thanks for the reply, but it didn't fixt it
k

Kevin Kho

06/22/2022, 2:33 PM
What error do you get?
m

Mansour Zayer

06/22/2022, 2:38 PM
The task itself runs, but my
helper_script
is not executed in the directory I'm in; it's executed in the directory in the screenshot; therefore I get directory doesn't exist
k

Kevin Kho

06/22/2022, 2:48 PM
What if you made a task that does this instead?
subprocess.call('ls', shell=True, cwd='path/to/wanted/dir/')
m

Mansour Zayer

06/22/2022, 2:52 PM
it doesn't recognize ls
'ls' is not recognized as an internal or external command,...
k

Kevin Kho

06/22/2022, 2:53 PM
That just an example. Try
dir
for Windows
m

Mansour Zayer

06/22/2022, 2:54 PM
Oh, What you're suggesting is avoiding ShellTask, and using subprocess instead all together?
k

Kevin Kho

06/22/2022, 2:55 PM
Yeah inside a task
m

Mansour Zayer

06/22/2022, 6:07 PM
I can solve my problem with subprocess. Thanks Are there limitations in using subprocess instead of ShellTask? Like I mentioned, our use-case for ShellTask is not complicated, just running dbt (
run dbt --some_optinos
)