Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line python commands fail with IndentationError #1770

Closed
tonnydourado opened this issue Aug 20, 2024 · 2 comments
Closed

Multi-line python commands fail with IndentationError #1770

tonnydourado opened this issue Aug 20, 2024 · 2 comments
Labels
state: awaiting response Waiting for issue author to respond. state: can't repro Not enough information was given to reproduce the issue described.

Comments

@tonnydourado
Copy link

I could swear that multi-line python commands used to work, but now I can't make one work in any way, shape, or form. This is the simplest example of what I'm trying to do:

# https://taskfile.dev
version: '3'
tasks:
  wat:
    cmds:
      - |
        python -c '
        import sys
        print(sys.executable)
        '

I have similar commands in older projects, that I haven't touched in a while, so I'm quite sure it used to work. But now I always get an indentation error:

$ task wat
task: [wat] python -c '
import sys
print(sys.executable)
'

  File "<string>", line 1
    ||  goto :error
IndentationError: unexpected indent
task: Failed to run task "wat": exit status 1

I tried changing the block style indicator, running under different shells (Git Bash, PowerShell), using different task versions (v3.38.0, v3.29.1, v3.28.0), opening new shells, nothing works.

Any ideas what else could have changed?

  • Task version: v3.38.0, v3.29.1, v3.28.0
  • Operating system: Windows
  • Experiments enabled: None
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Aug 20, 2024
@vmaerten
Copy link
Member

Hello !
I've tested it in Linux, with Bash and Zsh and it works as expected :
image

@vmaerten vmaerten added state: awaiting response Waiting for issue author to respond. state: can't repro Not enough information was given to reproduce the issue described. and removed state: needs triage Waiting to be triaged by a maintainer. labels Sep 15, 2024
@andrewimeson
Copy link

The IndentationError: unexpected indent is coming from your Python interpreter. I would look there. The YAML form is correct.

It also runs for me (I have to change the interpreter from python to python3) on macOS with Python 3.12 and Task 3.39.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: awaiting response Waiting for issue author to respond. state: can't repro Not enough information was given to reproduce the issue described.
Projects
None yet
Development

No branches or pull requests

4 participants