Fix ty warnings for using shutil.which on Windows

Apparently `ty` is being too strict here and warning about `Any` possibly being `PathLike` which is not supported on older Pythons.

```
error[deprecated]: The overload of `which` is deprecated
    --> src\bonsai\bonsai\bim\module\drawing\operator.py:2267:34
     |
2267 |                     command[0] = shutil.which(command[0]) or command[0]
     |                                  ^^^^^^^^^^^^ On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.

error[deprecated]: The overload of `which` is deprecated
    --> src\bonsai\bonsai\tool\drawing.py:1324:30
     |
1324 |                 command[0] = shutil.which(command[0]) or command[0]
     |                              ^^^^^^^^^^^^ On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.
```
This commit is contained in:
Andrej730
2026-09-09 15:05:47 +05:00
parent 33462ecc7c
commit 79fddd802e
2 changed files with 2 additions and 2 deletions
@@ -2264,7 +2264,7 @@ class CreateSheets(bpy.types.Operator, tool.Ifc.Operator):
# [["inkscape", "svg", "-o", "eps"], ["pstoedit", "-dt", "-f", "dxf:-polyaslines -mm", "eps", "dxf", "-psarg", "-dNOSAFER"]]
commands = json.loads(svg2dxf_command)
for command in commands:
command[0] = shutil.which(command[0]) or command[0]
command[0] = shutil.which(str(command[0])) or command[0]
subprocess.run([replacements.get(c, c) for c in command])
if self.open_viewer:
+1 -1
View File
@@ -1321,7 +1321,7 @@ class Drawing(bonsai.core.tool.Drawing):
commands = json.loads(user_command)
replacements = {"path": path}
for command in commands:
command[0] = shutil.which(command[0]) or command[0]
command[0] = shutil.which(str(command[0])) or command[0]
subprocess.Popen([replacements.get(c, c) for c in command])
else:
if platform.system() == "Darwin":