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

The provided correct example for stripping leading whitespace is a Python heredoc that does not run #668

Open
adamnovak opened this issue Jun 24, 2024 · 0 comments
Assignees

Comments

@adamnovak
Copy link
Collaborator

The 1.1 spec gives this as a correct answer for stripping leading whitespace:

python <<CODE
  with open("/path/to/file") as fp:
    for line in fp:
      if not line.startswith('#'):
        print(line.strip())
CODE

wdl/SPEC.md

Lines 3648 to 3655 in 9c0b9cf

```sh
python <<CODE
with open("/path/to/file") as fp:
for line in fp:
if not line.startswith('#'):
print(line.strip())
CODE
```

But that Bash command will always fail. The Python script is indented by 2 spaces; Bash does not itself strip leading whitespace inside the heredoc. So Python will raise an IndentationError when parsing the script:

$ python <<CODE
  with open("/path/to/file") as fp:
    for line in fp:
      if not line.startswith('#'):
        print(line.strip())
CODE
  File "<stdin>", line 1
    with open("/path/to/file") as fp:
IndentationError: unexpected indent

The spec goes on to act as if this command can ever succeed, including by giving example output for the task containing it, which can never be obtained.

@adamnovak adamnovak changed the title The provided correct example for stripping leading whitespace is a Python script that does not run The provided correct example for stripping leading whitespace is a Python heredoc that does not run Jun 24, 2024
jdidion added a commit that referenced this issue Jun 26, 2024
jdidion added a commit that referenced this issue Jun 26, 2024
@jdidion jdidion self-assigned this Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants