ansys / ansys/grantami-jobqueue

Confusing error message if list of file paths parameter provided to ImportRequest is of type <str>

Open
#155 1 comment 0 reactions 0 assignees View on GitHub
bug good first issue
Dominant language
Python
Stars
0
Forks
0
Avg merge
1d 10h
Merged PRs (30d)
13

Description

### 🔍 Before submitting the issue

- [x] I have searched among the existing issues
- [x] I am using a Python virtual environment

### 🐞 Description of the bug

Providing a file path in form of pure to any ‘files’ (data_files, combined_files, attachment_files) parameter in import request, results in error: `“ValueError: File paths in import are not unique.“`

Request object is expecting a list of strings, but when just a single str is provided, it carries on iterating through the parameter treating each 'char' as a separate path.

Should we add a simple ‘if not list’ check and throw more meaningful error msg in such case?

### 📝 Steps to reproduce

prepare ExcelImportJobRequest where one of files parameter is a 'str' instead of ['str']`
and create a job with it

```python
import_request = jobqueue.ExcelImportJobRequest(name = "name",
description = "description",
template_file = ".\\myTemplate.xls",
data_files = ".\\myDataFIle.xls")

import_job = api_client.create_job_and_wait(job_request=import_request)
```

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

ansys-grantami-jobqueue 1.1.0rc0
ansys-grantami-serverapi-openapi 4.0.0
ansys-openapi-common 2.2.0
GRANTA_MIScriptingToolkit 4.1.75

MI b. 25.1.1888

### 🐍 Which Python version are you using?

3.13

### 📦 Installed packages

```shell
ansys-grantami-jobqueue==1.1.0rc0
ansys-grantami-recordlists==1.3.0rc0
ansys-grantami-serverapi-openapi==4.0.0
ansys-openapi-common==2.2.0
certifi==2024.8.30
cffi==1.17.1
charset-normalizer==3.4.0
cryptography==43.0.3
filetype==1.2.0
GRANTA_MIScriptingToolkit @ file:///C:/Automation/STK/scripting-toolkit-4-1-75/pip/granta_miscriptingtoolkit-4.1.75-cp38-abi3-win_amd64.whl#sha256=7be8c6e46f63c29c0fde2a30911b2c3a607c5fb6443258b56e77339ca4db58b0
idna==3.10
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
keyring==25.5.0
more-itertools==10.5.0
packaging==24.2
pycparser==2.22
pyparsing==3.2.0
pypiwin32==223
pyspnego==0.11.2
python-dateutil==2.9.0.post0
pywin32==308
pywin32-ctypes==0.2.3
requests==2.32.3
requests-negotiate-sspi==0.5.2
requests_ntlm==1.3.0
six==1.16.0
sspilib==0.2.0
urllib3==2.2.3
```

Contributor guide

Open the contributing guide

Research direction

Start with the ExcelImportJobRequest handling for the data_files, combined_files, and attachment_files parameters, and reproduce the case where one is a str rather than a list. Done means the request rejects this input with a meaningful error instead of reporting non-unique file paths, with the affected behavior covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.