我正在尝试安装win_unc库,但是出现以下错误:
File "unc_credentials.py", line 36 """
Syntax error: (unicode error) 'unicodescape' codec can't decode bytes in position 340-341: truncated \uXXXX escape
这是导致问题的unc_credentials.py
的代码段:
def __init__(self, username=None, password=None):
"""
Returns a new `UncCredentials` object. Both `username` and `password` are optional.
If neither are provided, the new object will mean that credentials are unnecessary.
`username` must be a string representing a Windows username (logon). Windows usernames
may include a domain prefix (i.e. "domain\username"). If `username` cannot be
construed as a valid Windows username, then this will raise an
`InvalidUsernameError`.
Note: UNC connections that require authentication will use the username of the
currently logged in Windows user unless specifically provided another
username.
Note: Providing `None` and `""` (the empty string) have very different meanings.
Usernames cannot be empty.
`password` must be a string representing a password.
Note: Providing `None` and `''` (the empty string) have very different meanings.
The empty string is a meaningful, legitimate password.
If only the first positional argument is provided and it is already an instance of the
`UncCredentials` class (either directly or by inheritance), this constructor will clone
it and create a new `UncCredentials` object with the same properties.
"""
最后一行""""是第36行。
它看起来只是对我的评论,但当我摆脱它时,我得到另一个错误no commands supplied
似乎最后一行的三重双引号存在问题,但我可能错了。
我尝试过使用不同的引号并使用' r'在字符串前面,但我得到相同的错误或no commands supplied
。
我真的很感激有关如何解决或解决此问题的任何建议。
答案 0 :(得分:0)
我不再维护这个库了。我不知道这里发生了什么,但唯一想到的是文件在下载或保存期间被破坏了。如果您打开HEX编辑器并按照建议检查位置340-341,您可能会发现一个奇怪的非ASCII字符。
请注意,win_unc不支持使用英语以外的任何语言的系统。
答案 1 :(得分:0)
我认为,这不是脚本的必要部分,只是评论。我删除了它并成功安装了这个模块。