You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 KiB
12 KiB
<html>
<head>
</head>
</html>
In [1]:
!pip install weasyprint
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 Collecting weasyprint Downloading weasyprint-55.0-py3-none-any.whl (249 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 249.5/249.5 kB 2.5 MB/s eta 0:00:0000:0100:01 Requirement already satisfied: Pillow>=4.0.0 in /opt/homebrew/lib/python3.9/site-packages (from weasyprint) (9.0.1) Collecting cssselect2>=0.1 Downloading cssselect2-0.6.0-py3-none-any.whl (15 kB) Collecting pydyf>=0.0.3 Downloading pydyf-0.2.0-py3-none-any.whl (6.6 kB) Collecting Pyphen>=0.9.1 Downloading pyphen-0.12.0-py3-none-any.whl (2.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 13.6 MB/s eta 0:00:00a 0:00:01 Requirement already satisfied: tinycss2>=1.0.0 in /opt/homebrew/lib/python3.9/site-packages (from weasyprint) (1.1.1) Requirement already satisfied: cffi>=0.6 in /opt/homebrew/lib/python3.9/site-packages (from weasyprint) (1.15.0) Collecting html5lib>=1.1 Downloading html5lib-1.1-py2.py3-none-any.whl (112 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 112.2/112.2 kB 4.4 MB/s eta 0:00:00 Collecting fonttools[woff]>=4.0.0 Downloading fonttools-4.33.3-py3-none-any.whl (930 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 930.9/930.9 kB 16.4 MB/s eta 0:00:0000:01 Requirement already satisfied: pycparser in /opt/homebrew/lib/python3.9/site-packages (from cffi>=0.6->weasyprint) (2.21) Requirement already satisfied: webencodings in /opt/homebrew/lib/python3.9/site-packages (from cssselect2>=0.1->weasyprint) (0.5.1) Collecting brotli>=1.0.1 Downloading Brotli-1.0.9-cp39-cp39-macosx_10_9_universal2.whl (786 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 786.7/786.7 kB 3.9 MB/s eta 0:00:0000:0100:01 Collecting zopfli>=0.1.4 Downloading zopfli-0.2.1-cp39-cp39-macosx_10_9_universal2.whl (289 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 289.8/289.8 kB 9.6 MB/s eta 0:00:00 Requirement already satisfied: six>=1.9 in /opt/homebrew/lib/python3.9/site-packages (from html5lib>=1.1->weasyprint) (1.12.0) Installing collected packages: brotli, zopfli, Pyphen, pydyf, html5lib, fonttools, cssselect2, weasyprint DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 Successfully installed Pyphen-0.12.0 brotli-1.0.9 cssselect2-0.6.0 fonttools-4.33.3 html5lib-1.1 pydyf-0.2.0 weasyprint-55.0 zopfli-0.2.1 WARNING: There was an error checking the latest version of pip.
In [4]:
from weasyprint import HTML
HTML("http://weasyprint.org/").write_pdf("/User/donaldrich/Desktop/weasyprint.pdf")
--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) /Users/donaldrich/Projects/secrets/code/Weazyprint/weasyprint.ipynb Cell 2' in <module> <a href='vscode-notebook-cell:/Users/donaldrich/Projects/secrets/code/Weazyprint/weasyprint.ipynb#ch0000001?line=0'>1</a> from weasyprint import HTML ----> <a href='vscode-notebook-cell:/Users/donaldrich/Projects/secrets/code/Weazyprint/weasyprint.ipynb#ch0000001?line=2'>3</a> HTML("http://weasyprint.org/").write_pdf("/User/donaldrich/Desktop/weasyprint-website.pdf") File /opt/homebrew/lib/python3.9/site-packages/weasyprint/__init__.py:177, in HTML.write_pdf(self, target, stylesheets, zoom, attachments, finisher, presentational_hints, optimize_size, font_config, counter_style, image_cache) 132 def write_pdf(self, target=None, stylesheets=None, zoom=1, 133 attachments=None, finisher=None, presentational_hints=False, 134 optimize_size=('fonts',), font_config=None, 135 counter_style=None, image_cache=None): 136 """Render the document to a PDF file. 137 138 This is a shortcut for calling :meth:`render`, then (...) 174 175 """ 176 return ( --> 177 self.render( 178 stylesheets, presentational_hints=presentational_hints, 179 optimize_size=optimize_size, font_config=font_config, 180 counter_style=counter_style, image_cache=image_cache) 181 .write_pdf(target, zoom, attachments, finisher)) File /opt/homebrew/lib/python3.9/site-packages/weasyprint/document.py:853, in Document.write_pdf(self, target, zoom, attachments, finisher) 851 shutil.copyfileobj(file_obj, target) 852 else: --> 853 with open(target, 'wb') as fd: 854 shutil.copyfileobj(file_obj, fd) FileNotFoundError: [Errno 2] No such file or directory: '/User/donaldrich/Desktop/weasyprint-website.pdf'
In [ ]:
https://selenium-python.readthedocs.io/_/downloads/en/latest/pdf/