AcademySoftwareFoundation / AcademySoftwareFoundation/OpenShadingLanguage

[BUG] On Windows, liboslquery will have errors on import with invalid PATH variables

Open Beginner friendly
#2,109 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
2.3k
Forks
414
Avg merge
3d 1h
Merged PRs (30d)
10

Description

**Describe the bug**

When running `import oslquery` in Python, and you have a invalid path like `C:` in your environment variables, you will get a error.

**To Reproduce**

On Windows:
- Add `C:` to `PATH`
- Important, it needs to be `C:` and not `C:\`
- Run a Python script that imports liboslquery. The simplest way is to just run https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/main/src/liboslquery/__init__.py directly.
- Notice you get a error message

**Evidence**

Error message:
````
Traceback (most recent call last):
File "/path/to/oslquery/__init__.py", line 10, in
os.add_dll_directory(path)
~~~~~~~~~~~~~~~~~~~~^^^^^^
File "", line 1165, in add_dll_directory
OSError: [WinError 87] The parameter is incorrect: 'C:'
```

Contributor guide

Open the contributing guide

Research direction

Start with src/liboslquery/__init__.py and reproduce the import on Windows with C: included in PATH. Verify the handling of that PATH entry and confirm that importing liboslquery succeeds without the WinError 87 exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.