<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      ?

      execjs執行js編碼錯誤的解決方法(UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xad in position 20: illegal )

      源碼:

      with open('test.js','r',encoding='utf-8') as f:
          js_text=f.read()
          # print(js_text)
          compil=execjs.compile(js_text)
          cookie=compil.call('sdk_1')
      print(cookie)

      報錯:

      Exception in thread Thread-1:
      Traceback (most recent call last):
        File "c:\users\administrator\appdata\local\programs\python\python38\lib\threading.py", line 932, in _bootstrap_inner
          self.run()
        File "c:\users\administrator\appdata\local\programs\python\python38\lib\threading.py", line 870, in run
          self._target(*self._args, **self._kwargs)
        File "c:\users\administrator\appdata\local\programs\python\python38\lib\subprocess.py", line 1370, in _readerthread
          buffer.append(fh.read())
      UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 20: illegal multibyte sequence
      Traceback (most recent call last):
        File "D:/niu/shiji/shiji/spiders/test.py", line 241, in <module>
          cookie=compil.call('sdk_1')
        File "C:\Users\Administrator\Envs\tengfang\lib\site-packages\execjs\_abstract_runtime_context.py", line 37, in call
          return self._call(name, *args)
        File "C:\Users\Administrator\Envs\tengfang\lib\site-packages\execjs\_external_runtime.py", line 92, in _call
          return self._eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args))
        File "C:\Users\Administrator\Envs\tengfang\lib\site-packages\execjs\_external_runtime.py", line 78, in _eval
          return self.exec_(code)
        File "C:\Users\Administrator\Envs\tengfang\lib\site-packages\execjs\_abstract_runtime_context.py", line 18, in exec_
          return self._exec_(source)
        File "C:\Users\Administrator\Envs\tengfang\lib\site-packages\execjs\_external_runtime.py", line 87, in _exec_
          output = self._exec_with_pipe(source)
        File "C:\Users\Administrator\Envs\tengfang\lib\site-packages\execjs\_external_runtime.py", line 103, in _exec_with_pipe
          stdoutdata, stderrdata = p.communicate(input=input)
        File "c:\users\administrator\appdata\local\programs\python\python38\lib\subprocess.py", line 1028, in communicate
          stdout, stderr = self._communicate(input, endtime, timeout)
        File "c:\users\administrator\appdata\local\programs\python\python38\lib\subprocess.py", line 1420, in _communicate
          stdout = stdout[0]
      IndexError: list index out of range
      
      Process finished with exit code 1

      錯誤出在python內部的subprocess.py文件

      解決方式:

      第一種:打開subprocess.py文件,找到初始化函數__init__(),修改參數的默認值為encoding=‘utf-8’,程序運行不再報錯
      第二種:

      import subprocess
      from functools import partial
      
      subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")

      這三句話,在導入 execjs之前寫進去

      posted @ 2022-01-15 10:06  A肆  閱讀(1270)  評論(1)    收藏  舉報
      ? ?
      主站蜘蛛池模板: 奇米四色7777中文字幕| 国产亚洲一区二区三不卡| 蜜臀av久久国产午夜福利软件| 不卡国产一区二区三区| 中国熟妇牲交视频| 久久婷婷五月综合色和啪| 日韩人妻无码精品久久| 天堂中文在线资源| 国产精品一区二区三区激情| 欧美成人精品手机在线| 乐都县| 久久中文字幕无码专区| 中文字幕日韩人妻一区| 理塘县| 精品无码国产不卡在线观看| 亚洲WWW永久成人网站| 日韩人妻无码精品久久| 国产午夜福利视频在线| 欧美嫩交一区二区三区| 蜜芽久久人人超碰爱香蕉| 强奷乱码中文字幕| 加勒比无码av中文字幕| 精品国产迷系列在线观看| 国产精品国产亚洲看不卡| 国产sm重味一区二区三区| 91精品91久久久久久| 久久婷婷五月综合97色直播| 日本边添边摸边做边爱的网站| 亚洲精品乱码久久久久久按摩高清| 国产亚洲精久久久久久久91| 免费无码AV一区二区波多野结衣| 国产精品老熟女免费视频| 国产香蕉九九久久精品免费| 国产美女裸身网站免费观看视频 | 国产999精品2卡3卡4卡| 看免费的无码区特aa毛片| 精品熟女亚洲av在线观看| 热久久美女精品天天吊色| 国产色悠悠综合在线观看| 丁香婷婷综合激情五月色| 激情偷乱人成视频在线观看|