D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
usr
/
lib
/
python3.6
/
site-packages
/
bs4
/
__pycache__
/
Filename :
diagnose.cpython-36.opt-1.pyc
back
Copy
3 #6]� � @ s d Z dZddlZddlmZ ddlmZ ddlZddlmZm Z ddl mZ ddlZddl Z ddlZddlZddlZddlZddlZddlZdd � Zd#dd�ZG d d� de�Zdd� ZdZdZd$dd�Zd%dd�Zd&dd�Zd'dd�Zd(d d!�Zed"k�reejj � � dS ))z=Diagnostic functions, mainly for use when doing tech support.ZMIT� N)�StringIO)� HTMLParser)� BeautifulSoup�__version__)�builder_registryc ; C sX t dt � t dtj � dddg}x>|D ]6}x0tjD ]}||jkr6P q6W |j|� t d| � q*W d|kr�|jd� y*dd l m } t d djtt |j�� � W n* tk r� } zt d� W Y d d }~X nX d|k�rydd l}t d|j � W n, tk �r } zt d� W Y d d }~X nX t| d��r4| j� } n�| jd��sL| jd��rdt d| � t d� d S y:tjj| ��r�t d| � t| ��}|j� } W d Q R X W n tk �r� Y nX t � x�|D ]�}t d| � d} yt| |d�} d} W n8 tk �r" } zt d| � tj� W Y d d }~X nX | �rBt d| � t | j� � t dd � �q�W d S )z/Diagnostic suite for isolating common problems.z'Diagnostic running on Beautiful Soup %szPython version %szhtml.parser�html5lib�lxmlz;I noticed that %s is not installed. Installing it may help.zlxml-xmlr )�etreezFound lxml version %s�.z.lxml is not installed or couldn't be imported.NzFound html5lib version %sz2html5lib is not installed or couldn't be imported.�readzhttp:zhttps:z<"%s" looks like a URL. Beautiful Soup is not an HTTP client.zpYou need to use some other library to get the document behind the URL, and feed that document to Beautiful Soup.z7"%s" looks like a filename. Reading data from the file.z#Trying to parse your markup with %sF)�featuresTz%s could not parse the markup.z#Here's what %s did with the markup:�-�P )�printr �sys�versionr Zbuildersr �remove�appendr r �join�map�strZLXML_VERSION�ImportErrorr �hasattrr � startswith�os�path�exists�open� ValueErrorr � Exception� traceback� print_excZprettify)�dataZ basic_parsers�nameZbuilderr �er �fp�parser�success�soup� r) �/usr/lib/python3.6/diagnose.py�diagnose sj r+ Tc K sN ddl m} x<|jt| �fd|i|��D ]\}}td||j|jf � q(W dS )z�Print out the lxml events that occur during parsing. This lets you see how lxml parses a document when no Beautiful Soup code is running. r )r �htmlz%s, %4s, %sN)r r Z iterparser r �tag�text)r"