if os.path.isdir(args.model_path): TypeError: _isdir: path should be string, bytes or os.PathLike, not NoneType
时间: 2024-01-07 13:51:49 浏览: 117
This error occurs when the variable `args.model_path` is `None`. The `os.path.isdir()` function expects a string, bytes or `os.PathLike` object as its argument, but it cannot handle a `None` value.
To resolve this error, you should ensure that `args.model_path` is assigned a valid string or bytes object before passing it to the `os.path.isdir()` function. You can also add a check to ensure that `args.model_path` is not `None` before passing it to the function.
Here is an example of how to check if `args.model_path` is `None` before using it in `os.path.isdir()`:
```
if args.model_path is not None and os.path.isdir(args.model_path):
# your code here
else:
# handle the case where args.model_path is None or not a valid directory path
```
阅读全文