Skip to content

Can't use os.path.isdir in case #135

Answered by nat-n
mgzenitech asked this question in Q&A
Discussion options

You must be logged in to vote

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 expr task in a situation like this:

[tool.poe.tasks.post_install]
control.expr    = "os.path.isdir('.venv/node')"
control.imports = ["os"]

...

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mgzenitech
Comment options

Answer selected by mgzenitech
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #134 on March 22, 2023 19:46.