python 使用execjs执行接js解密时报错execjs UnicodeDecodeError: ‘gbk‘ codec can‘t decode...

报错内容:
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa1 in position 26: illegal multibyte sequence
具体:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "D:\tools\Python3.6\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "D:\tools\Python3.6\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "D:\tools\Python3.6\lib\subprocess.py", line 1083, in _readerthread
    buffer.append(fh.read())
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa1 in position 26: illegal multibyte sequence

Traceback (most recent call last):
  File "D:/zjf_workspace/003、自己测试用的/002加密和验证码破解/02-js加密破解/022、梦幻西游藏宝阁/执行.py", line 11, in <module>
    result = ct.call('decode_desc', _0x1c0cdf)
  File "D:\tools\Python3.6\lib\site-packages\execjs\_abstract_runtime_context.py", line 37, in call
    return self._call(name, *args)
  File "D:\tools\Python3.6\lib\site-packages\execjs\_external_runtime.py", line 92, in _call
    return self._eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args))
  File "D:\tools\Python3.6\lib\site-packages\execjs\_external_runtime.py", line 78, in _eval
    return self.exec_(code)
  File "D:\tools\Python3.6\lib\site-packages\execjs\_abstract_runtime_context.py", line 18, in exec_
    return self._exec_(source)
  File "D:\tools\Python3.6\lib\site-packages\execjs\_external_runtime.py", line 87, in _exec_
    output = self._exec_with_pipe(source)
  File "D:\tools\Python3.6\lib\site-packages\execjs\_external_runtime.py", line 103, in _exec_with_pipe
    stdoutdata, stderrdata = p.communicate(input=input)
  File "D:\tools\Python3.6\lib\subprocess.py", line 863, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "D:\tools\Python3.6\lib\subprocess.py", line 1133, in _communicate
    stdout = stdout[0]
IndexError: list index out of range

解决步骤
1、进去错误这个D:\tools\Python3.6\lib\subprocess.py文件
在这里插入图片描述
2、搜索:encoding=
这个搜索方式,是我找了好一会才懂,所以记录下来,大家可以参考下。

3、修改编码格式为utf-8
注意事项:
建议备份一行,毕竟修改的是模块的源码,万一弄错了好改回来。敲代码最忌不懂,乱改还不保留,这样很招人烦的,尤其团队合作时
在这里插入图片描述
至此修改完毕,可以尝试运行了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值