-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
When using the pySingleFile library, a NameError: name 'exit' is not defined error is thrown when encountering unknown types of img tags.
Steps to Reproduce
- Install the pySingleFile library
- Run the following code:
from pySingleFile import SingleFile
u = "https://www.baidu.com/"
sf = SingleFile(u)
sf.get_resource()
- The error occurs when processing certain web pages
NameError Traceback (most recent call last)
Cell In[35], line 5
3 sf = SingleFile(u)
4 # 打印资源示例
----> 5 sf.get_resource()
File D:\Anaconda\envs\deep_learning\lib\site-packages\pySingleFile\singlefile.py:158, in SingleFile.get_resource(self, delete_instance)
152 """
153 获取全部img、JavaScript、css资源。调用完此函数默认会删除实例,如需保留实例需要设置delete_instance参数。
154 :param delete_instance: 调用完此函数是否删除实例,默认为True。
155 :return:
156 """
157 self.page.get(self.url)
--> 158 self._get_images()
159 self._get_javascripts()
160 self._get_stylelinks()
File D:\Anaconda\envs\deep_learning\lib\site-packages\pySingleFile\singlefile.py:74, in SingleFile._get_images(self)
72 else:
73 print("img标签出现未知类型")
---> 74 exit(-1)
NameError: name 'exit' is not defined