Home > other >  'GBK' codec can 't decode byte 0 xa1 position in 2638: illegal multibyte sequence
'GBK' codec can 't decode byte 0 xa1 position in 2638: illegal multibyte sequence

Time:05-21




# @ Siftware PyCharm

The import wadden. Detection
# # wadden -u 'https://www.baidu.com' error
Det=wadden. Detection. The Detector ()
Url=input ()
Print (det) detect (url))


Error below
ERROR: root: ERROR while reading JSON file, terminating: 'GBK' codec can 't decode byte 0 xa1 position in 2638: illegal multibyte sequence
Traceback (the most recent call last) :
The File "G:/Pycharm/demo_01/Zjc01/wad_detect py", line 9, the in & lt; module>
Det=wadden. Detection. The Detector ()
The File "G: \ Pycharm \ demo_01 \ Zjc01 \ venv \ lib \ site - packages \ wadden \ detection py", line 24, in __init__
Self. Apps, and the self. The categories=Clues. Get_clues ()
The File "G: \ Pycharm \ demo_01 \ Zjc01 \ venv \ lib \ site - packages \ wadden \ clues py", line, 38 in get_clues
Self. Load_clues (filename)
The File "G: \ Pycharm \ demo_01 \ Zjc01 \ venv \ lib \ site - packages \ wadden \ clues py", line 94, in load_clues
Self. Apps, and the self. The categories=self. Read_clues_from_file (filename)
The File "G: \ Pycharm \ demo_01 \ Zjc01 \ venv \ lib \ site - packages \ wadden \ clues py", line 55, in read_clues_from_file
Clues=json. The load (json_data)
The File "G: \ Python \ lib \ json \ set py", line 293, the load in
Return loads (fp) read (),
UnicodeDecodeError: 'GBK' codec can 't decode byte 0 xa1 position in 2638: illegal multibyte sequence

, the code used technology, the purpose is to look at the website error, how to solve

CodePudding user response:

To find a lot of methods are not,,

CodePudding user response:

Question which is wadden this library should be haven't updated for a long time, can be solved by modifying the way of the underlying source code, open the clues. Py (in pycharm directly click on an error that file will jump straight to clues. Py), modify the 46th lines of code, just add a utf-8,


The test code:

 
The import wadden. Detection
Det=wadden. Detection. The Detector ()
Url="https://www.baidu.com"
Json_data (url)
=https://bbs.csdn.net/topics/det.detectPrint (json_data)

The results are as follows:

CodePudding user response:

Results the following

  • Related