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

[BUG] ValueError when providing '' as value for an argument with type: integer and multiple: true. #619

Open
2 tasks done
DriesSchaumont opened this issue Jan 4, 2024 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@DriesSchaumont
Copy link
Contributor

DriesSchaumont commented Jan 4, 2024

What happened?

When creating an argument in a viash config, with property type: integer and multiple: true, it is not possible to specify an empty value. Instead, an error is thrown

Steps to reproduce

config.vsh.yaml:

functionality:
  name: myscrpt
  arguments:
    - name: "--this_is_a_multiple"
      type: integer
      required: false
      multiple: true
      default: 50
  resources:
    - type: python_script
      path: script.py
      text: |
        print("foo!")

viash run ./config.vsh.yaml -- --this_is_a_multiple ""

Expected behavior

Using '' as an value for an argument that is multiple: true should be considered an empty value

Relevant log output

Traceback (most recent call last):
  File "/tmp/viash-run-myscrpt-CYPWfP.py", line 4, in <module>
    'this_is_a_multiple': list(map(int, r''.split(':')))
ValueError: invalid literal for int() with base 10: ''
Files and logs are stored at '/tmp/viash_myscrpt11977260778426443065'

Version

0.8.2

Possible solution

No response

Confirmation

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have provided clear and concise information about the bug.

Additional context

No response

@DriesSchaumont DriesSchaumont added the bug Something isn't working label Jan 4, 2024
@Grifs
Copy link
Collaborator

Grifs commented Apr 17, 2024

One of the big issues is how an empty list of strings should be handled.
'' isn't evidently an empty array in this case, but rather an empty string.

@rcannood rcannood added this to the Viash 0.8.x milestone Apr 17, 2024
@DriesSchaumont
Copy link
Contributor Author

DriesSchaumont commented May 22, 2024

I think we should descide on a good 'default' value to represent not specified (NA, null, ... ). One argument against this is that the user might actually need that value does not represent 'not specified'. For these cases, I would like to propose to add a viash config value for arguments that allows overwriting this default value with another value if the user chooses to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants