Can't use os.path.isdir in case #135
-
[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: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Any ideas on how to check for existing directory with script? |
Beta Was this translation helpful? Give feedback.
-
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"]
... |
Beta Was this translation helpful? Give feedback.
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
expr
task in a situation like this: