Changement de programme (2) Python3: URL comme argument de ligne de commande (wikipedia) https://qiita.com/kaizen_nagoya/items/fc095b0c580a35001ea7
Des travaux sont en cours avec docker.
docker (89) python2, python3 avec docker https://qiita.com/kaizen_nagoya/items/ecbe11a4d743357134d5
docker/ubuntu
# pip install bs4
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting bs4
Downloading https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz
Collecting beautifulsoup4
Downloading https://files.pythonhosted.org/packages/c5/48/c88b0b390ae1f785942fc83413feb1268a1eb696f343d4d55db735b9bb39/beautifulsoup4-4.8.2-py2-none-any.whl (106kB)
|################################| 112kB 1.7MB/s
Collecting soupsieve>=1.2
Downloading https://files.pythonhosted.org/packages/81/94/03c0f04471fc245d08d0a99f7946ac228ca98da4fa75796c507f61e688c2/soupsieve-1.9.5-py2.py3-none-any.whl
Collecting backports.functools-lru-cache; python_version < "3"
Downloading https://files.pythonhosted.org/packages/da/d1/080d2bb13773803648281a49e3918f65b31b7beebf009887a529357fd44a/backports.functools_lru_cache-1.6.1-py2.py3-none-any.whl
Building wheels for collected packages: bs4
Building wheel for bs4 (setup.py) ... done
Created wheel for bs4: filename=bs4-0.0.1-cp27-none-any.whl size=1273 sha256=79b8b3765197c5d2662611ba7f1199b00147c4741c41f4dc9cdc82d0f08f0609
Stored in directory: /root/.cache/pip/wheels/a0/b0/b2/4f80b9456b87abedbc0bf2d52235414c3467d8889be38dd472
Successfully built bs4
Installing collected packages: backports.functools-lru-cache, soupsieve, beautifulsoup4, bs4
Successfully installed backports.functools-lru-cache-1.6.1 beautifulsoup4-4.8.2 bs4-0.0.1 soupsieve-1.9.5
# pip3 install bs4
Collecting bs4
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz
Collecting beautifulsoup4 (from bs4)
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/cb/a1/c698cf319e9cfed6b17376281bd0efc6bfc8465698f54170ef60a485ab5d/beautifulsoup4-4.8.2-py3-none-any.whl (106kB)
100% |################################| 112kB 2.4MB/s
Collecting soupsieve>=1.2 (from beautifulsoup4->bs4)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/81/94/03c0f04471fc245d08d0a99f7946ac228ca98da4fa75796c507f61e688c2/soupsieve-1.9.5-py2.py3-none-any.whl
Building wheels for collected packages: bs4
Running setup.py bdist_wheel for bs4 ... done
Stored in directory: /root/.cache/pip/wheels/a0/b0/b2/4f80b9456b87abedbc0bf2d52235414c3467d8889be38dd472
Successfully built bs4
Installing collected packages: soupsieve, beautifulsoup4, bs4
Successfully installed beautifulsoup4-4.8.2 bs4-0.0.1 soupsieve-1.9.5
# python2.7 wia.py
Traceback (most recent call last):
File "wia.py", line 9, in <module>
from urllib.request import urlopen
ImportError: No module named request
# python3.8 wib.py
Traceback (most recent call last):
File "wib.py", line 8, in <module>
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
# pip install urllib
ERROR: Could not find a version that satisfies the requirement urllib (from versions: none)
ERROR: No matching distribution found for urllib
# pip3 install urllib
Collecting urllib
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 795, in get_page
resp.raise_for_status()
File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/urllib/
Erreur URLlib
Installer urllib avec pip3 http://rongonxp.hatenablog.jp/entry/2018/02/01/000816
# pip3 install urllib3
Collecting urllib3
Downloading https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl (125kB)
100% |################################| 133kB 1.7MB/s
Installing collected packages: urllib3
Successfully installed urllib3-1.25.7
# python3 wib.py
Traceback (most recent call last):
File "wib.py", line 15, in <module>
url = "https://ja.wikipedia.org/wiki/" + urllib.parse.quote(args[1])
IndexError: list index out of range
ver. 0.01 Première ébauche 20191230 Après-midi ver. 0.02 addendum urllib3 20191230 Nuit