Can't use os.path.isdir in case #135
Answered
by
nat-n
mgzenitech
asked this question in
Q&A
[tool.poe.tasks.post_install]
control.script = "os.path:isdir('.venv/node')"
[[tool.poe.tasks.post_install.switch]]
case = "False"
sequence = [
...
]
[tool.poe.poetry_hooks]
post_install = "post_install"Is always getting me: |
Answered by
nat-n
Mar 22, 2023
Replies: 2 comments 1 reply
|
Any ideas on how to check for existing directory with script? |
0 replies
|
Hi @mgzenitech, You can make your example work by configuring the control script task to print the result. The problem is that cases are compared to the output of the script task, and although the isdir function returns a boolean value is doesn't output (i.e. print) anything. [tool.poe.tasks.post_install]
control.script = "os.path:isdir('.venv/node')"
control.print_result = true
...However I would usually recommend using an [tool.poe.tasks.post_install]
control.expr = "os.path.isdir('.venv/node')"
control.imports = ["os"]
... |
1 reply
Answer selected by
mgzenitech
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @mgzenitech,
You can make your example work by configuring the control script task to print the result. The problem is that cases are compared to the output of the script task, and although the isdir function returns a boolean value is doesn't output (i.e. print) anything.
However I would usually recommend using an
exprtask in a situation like this: