mintproject / mic

Model Insertion Checker
https://mic-cli.readthedocs.io/en/latest/
5 stars 3 forks source link

Cannot create SWAT component #301

Closed dgarijo closed 4 years ago

dgarijo commented 4 years ago

I was attempting to create a SWAT component with Timo. However, mic failed in the mic pkg inputs command. Here is the component: https://www.dropbox.com/s/411vz59l9kbfgua/naryn_swat2.7z?dl=0 (too big for GitHub).

issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.84. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

mosoriob commented 4 years ago
mic   commands.py        ERROR    Inputs failed: list index out of range
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/mic/click_encapsulate/commands.py", line 412, in inputs
    code_files = find_code_files(spec, inputs_reprozip, config_files_list, user_execution_directory)
  File "/usr/local/lib/python3.6/dist-packages/mic/component/reprozip.py", line 283, in find_code_files
    if is_executable(files_path):
  File "/usr/local/lib/python3.6/dist-packages/mic/component/reprozip.py", line 293, in is_executable
    name = "." + (name.split("."))[1]
IndexError: list index out of range
mosoriob commented 4 years ago

The code is assuming an extension in the file.

    for i in EXECUTABLE_EXTENSIONS:
        name = file_path.name.lower()
        name = "." + (name.split("."))[1]
        if i.lower() == name.lower():
            return True
mosoriob commented 4 years ago

The recommendation is to use the Path module and not use strings operation.

Path('/root/dir/sub/file.ext').stem


PurePath.stem

    The final path component, without its suffix:
    >>>

    >>> PurePosixPath('my/library.tar.gz').stem
    'library.tar'
    >>> PurePosixPath('my/library.tar').stem
    'library'
    >>> PurePosixPath('my/library').stem
    'library'
dgarijo commented 4 years ago

@mosoriob do you think this is a fix @Cmheidelberg can easily do? I think we should have this ready before our next meeting with Timo next Wednesday

dgarijo commented 4 years ago

I was able to successfully finish the swat component, so I will close this issue