简体   繁体   English

DISCORD // 'unicodeescape' 编解码器无法解码位置 2-3 中的字节:截断的 \\UXXXXXXXX 转义

[英]DISCORD // 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

I'm trying to open discord with this script我正在尝试使用此脚本打开不和谐

import subprocess

subprocess.call(['C:\Users\xerxe\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Discord Inc\\Discord.exe'])

but only get this this error但只会得到这个错误

'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

The \\ character is an escape character - \\n means a newline character, \\t is a tab character, etc. \\U is used to denote the beginning of a Unicode escape sequence, like \\U000145d3 , where the 8 chars following \\U are hex digits ( 0-9a-f ). \\字符是转义字符 - \\n表示换行符, \\t是制表符等。 \\U用于表示 Unicode 转义序列的开头,例如\\U000145d3 ,其中\\U后面的 8 个字符是十六进制数字 ( 0-9a-f )。 Since \\Users\\xer is not a valid Unicode escape sequence, you got an error.由于\\Users\\xer不是有效的 Unicode 转义序列,因此您会收到错误消息。 For Windows paths, you either need to escape the escape character:对于 Windows 路径,您需要对转义字符进行转义:

subprocess.call(['C:\\Users\\xerxe\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Discord Inc\\Discord.exe'])

use a raw string literal (note the r just before the opening ' ):使用原始字符串文字(注意开头'之前的r ):

subprocess.call([r'C:\Users\xerxe\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.exe'])

or use / characters as path delimiters:或使用/字符作为路径分隔符:

subprocess.call(['C:/Users/xerxe/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Discord Inc/Discord.exe'])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \\UXXXXXXXXX escape , on an image - SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape , on an image python SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX 转义错误 - python SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape error Tkinter:SyntaxError:(unicode 错误)“unicodeescape”编解码器无法解码位置 2-3 中的字节:截断的 \\UXXXXXXXX 转义 - Tkinter: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX 转义错误使用 Selenium 和 Python - SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape error using Selenium and Python “语法错误:(unicode 错误)'unicodeescape' 编解码器无法解码 position 2-3 中的字节:截断 \UXXXXXXXX 转义”。 (文件管理错误) - "SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape" . (File management bug) Python SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX 转义 - Python SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escap SyntaxError:(unicode 错误)“unicodeescape”编解码器无法解码 position 7-8 中的字节:截断 \UXXXXXXXX 转义 - SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 7-8: truncated \UXXXXXXXX escape re.compile("[" ^ SyntaxError: (unicode error) 'unicodeescape' 编解码器无法解码位置 0-7 的字节:截断的 \\UXXXXXXXX 转义 - re.compile("[" ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-7: truncated \UXXXXXXXX escape SyntaxError: (unicode error) 'unicodeescape' 代码无法解码位置 12-13 截断的字节 \\UXXXXXXXX 转义 - SyntaxError: (unicode error) 'unicodeescape' codes can't decode bytes in position 12-13 truncated \UXXXXXXXX escape (unicode错误)'unicodeescape'编解码器无法解码位置16-17中的字节:截断\\ uXXXX转义 - (unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: truncated \uXXXX escape
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM