ComfyUI_Comfyroll_CustomNodes
ComfyUI_Comfyroll_CustomNodes copied to clipboard
When I use your plugin, the following warning appears in the console:
您好, 我在使用您的插件时,控制台出现以下警告: SyntaxWarning: invalid escape sequence '\W' SyntaxWarning: invalid escape sequence '\R' 这些警告是由于代码中使用了类似 "C:\Windows\Fonts" 这样的 Windows 路径字符串,导致 Python 误把 \W、\R 等识别成转义字符,从而抛出无效转义序列的警告。
建议将涉及路径的字符串改为原始字符串(加前缀 r),例如: r"C:\Windows\Fonts" 或者使用双反斜杠转义: "C:\Windows\Fonts" 具体示例修改:
"default": "C:\Windows\Fonts" 改为 "default": r"C:\Windows\Fonts"
函数参数 folder_path="C:\Windows\Fonts" 改为 folder_path=r"C:\Windows\Fonts"
字符串 "fonts\Roboto-Regular.ttf" 改为 r"fonts\Roboto-Regular.ttf" 或 "fonts\Roboto-Regular.ttf"
这样修改能消除警告,避免潜在的路径解析错误。感谢您的付出!