Уведомления

Группа в Telegram: @pythonsu

#1 Ноя. 6, 2016 19:55:34

jagrmi1
Зарегистрирован: 2016-11-06
Сообщения: 5
Репутация: +  0  -
Профиль   Отправить e-mail  

Проблемы при запуске программ с urllib и re

Вроде было днем все ок,запускалось.
А вечером при запуске вначале на версии 3.4 писало что невозможно импортировать urllib.request, и даже после обновления программы до 3.5 проблема не решилась.
Стала только висеть в итоге…
Может кто подскажет как и что делать дальше

Прикреплённый файлы:
attachment Снимок.JPG (87,4 KБ)

Офлайн

#2 Ноя. 6, 2016 20:35:57

JOHN_16
От: Россия, Петропавловск-Камчатск
Зарегистрирован: 2010-03-22
Сообщения: 3292
Репутация: +  221  -
Профиль   Отправить e-mail  

Проблемы при запуске программ с urllib и re

 john_16@Linux-home /tmp $ python3 --version
Python 3.5.2
john_16@Linux-home /tmp $ cat t.py 
import urllib.request
fhand = urllib.request.urlopen('https://docs.python.org/3/library/urllib.html')
for line in fhand:
    print(line.strip())
john_16@Linux-home /tmp $ python3 t.py 
b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
b'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
b''
b''
b'<html xmlns="http://www.w3.org/1999/xhtml">'
b'<head>'
b'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'
b''
b'<title>21.5. urllib \xe2\x80\x94 URL handling modules &mdash; Python 3.5.2 documentation</title>'
b''
b'<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />'
b'<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />'
b''
b'<script type="text/javascript">'
b'var DOCUMENTATION_OPTIONS = {'
b"URL_ROOT:    '../',"
b"VERSION:     '3.5.2',"
b'COLLAPSE_INDEX: false,'
b"FILE_SUFFIX: '.html',"
b'HAS_SOURCE:  true'
b'};'
b'</script>'
b'<script type="text/javascript" src="../_static/jquery.js"></script>'
b'<script type="text/javascript" src="../_static/underscore.js"></script>'
b'<script type="text/javascript" src="../_static/doctools.js"></script>'
b'<script type="text/javascript" src="../_static/sidebar.js"></script>'
b'<link rel="search" type="application/opensearchdescription+xml"'
b'title="Search within Python 3.5.2 documentation"'
b'href="../_static/opensearch.xml"/>'
b'<link rel="author" title="About these documents" href="../about.html" />'
b'<link rel="copyright" title="Copyright" href="../copyright.html" />'
b'<link rel="top" title="Python 3.5.2 documentation" href="../contents.html" />'
b'<link rel="up" title="21. Internet Protocols and Support" href="internet.html" />'
b'<link rel="next" title="21.6. urllib.request \xe2\x80\x94 Extensible library for opening URLs" href="urllib.request.html" />'
b'<link rel="prev" title="21.4. wsgiref \xe2\x80\x94 WSGI Utilities and Reference Implementation" href="wsgiref.html" />'
b'<link rel="shortcut icon" type="image/png" href="../_static/py.png" />'
b''
b'<script type="text/javascript" src="../_static/copybutton.js"></script>'
b'<script type="text/javascript" src="../_static/version_switch.js"></script>'
b''
b''
b''
b''
b'</head>'
b'<body role="document">'
b'<div class="related" role="navigation" aria-label="related navigation">'
b'<h3>Navigation</h3>'
b'<ul>'
b'<li class="right" style="margin-right: 10px">'
b'<a href="../genindex.html" title="General Index"'
b'accesskey="I">index</a></li>'
b'<li class="right" >'
b'<a href="../py-modindex.html" title="Python Module Index"'
b'>modules</a> |</li>'
b'<li class="right" >'
b'<a href="urllib.request.html" title="21.6. urllib.request \xe2\x80\x94 Extensible library for opening URLs"'
b'accesskey="N">next</a> |</li>'
b'<li class="right" >'
b'<a href="wsgiref.html" title="21.4. wsgiref \xe2\x80\x94 WSGI Utilities and Reference Implementation"'
b'accesskey="P">previous</a> |</li>'
b'<li><img src="../_static/py.png" alt=""'
b'style="vertical-align: middle; margin-top: -1px"/></li>'
b'<li><a href="https://www.python.org/">Python</a> &raquo;</li>'
b'<li>'
b'<span class="version_switcher_placeholder">3.5.2</span>'
b'<a href="../index.html">Documentation </a> &raquo;'
b'</li>'
b''
b'<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>'
b'<li class="nav-item nav-item-2"><a href="internet.html" accesskey="U">21. Internet Protocols and Support</a> &raquo;</li>'
b'<li class="right">'
b''
b''
b'<div class="inline-search" style="display: none" role="search">'
b'<form class="inline-search" action="../search.html" method="get">'
b'<input placeholder="Quick search" type="text" name="q" />'
b'<input type="submit" value="Go" />'
b'<input type="hidden" name="check_keywords" value="yes" />'
b'<input type="hidden" name="area" value="default" />'
b'</form>'
b'</div>'
b'<script type="text/javascript">$(\'.inline-search\').show(0);</script>'
b'|'
b'</li>'
b''
b'</ul>'
b'</div>'
b''
b'<div class="document">'
b'<div class="documentwrapper">'
b'<div class="bodywrapper">'
b'<div class="body" role="main">'
b''
b'<div class="section" id="module-urllib">'
b'<span id="urllib-url-handling-modules"></span><h1>21.5. <a class="reference internal" href="#module-urllib" title="urllib"><code class="xref py py-mod docutils literal"><span class="pre">urllib</span></code></a> &#8212; URL handling modules<a class="headerlink" href="#module-urllib" title="Permalink to this headline">\xc2\xb6</a></h1>'
b'<p><strong>Source code:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/3.5/Lib/urllib/">Lib/urllib/</a></p>'
b'<hr class="docutils" />'
b'<p><code class="docutils literal"><span class="pre">urllib</span></code> is a package that collects several modules for working with URLs:</p>'
b'<ul class="simple">'
b'<li><a class="reference internal" href="urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal"><span class="pre">urllib.request</span></code></a> for opening and reading URLs</li>'
b'<li><a class="reference internal" href="urllib.error.html#module-urllib.error" title="urllib.error: Exception classes raised by urllib.request."><code class="xref py py-mod docutils literal"><span class="pre">urllib.error</span></code></a> containing the exceptions raised by <a class="reference internal" href="urllib.request.html#module-urllib.request" title="urllib.request: Extensible library for opening URLs."><code class="xref py py-mod docutils literal"><span class="pre">urllib.request</span></code></a></li>'
b'<li><a class="reference internal" href="urllib.parse.html#module-urllib.parse" title="urllib.parse: Parse URLs into or assemble them from components."><code class="xref py py-mod docutils literal"><span class="pre">urllib.parse</span></code></a> for parsing URLs</li>'
b'<li><a class="reference internal" href="urllib.robotparser.html#module-urllib.robotparser" title="urllib.robotparser: Load a robots.txt file and answer questions about fetchability of other URLs."><code class="xref py py-mod docutils literal"><span class="pre">urllib.robotparser</span></code></a> for parsing <code class="docutils literal"><span class="pre">robots.txt</span></code> files</li>'
b'</ul>'
b'</div>'
b''
b''
b'</div>'
b'</div>'
b'</div>'
b'<div class="sphinxsidebar" role="navigation" aria-label="main navigation">'
b'<div class="sphinxsidebarwrapper">'
b'<h4>Previous topic</h4>'
b'<p class="topless"><a href="wsgiref.html"'
b'title="previous chapter">21.4. <code class="docutils literal"><span class="pre">wsgiref</span></code> &#8212; WSGI Utilities and Reference Implementation</a></p>'
b'<h4>Next topic</h4>'
b'<p class="topless"><a href="urllib.request.html"'
b'title="next chapter">21.6. <code class="docutils literal"><span class="pre">urllib.request</span></code> &#8212; Extensible library for opening URLs</a></p>'
b'<div role="note" aria-label="source link">'
b'<h3>This Page</h3>'
b'<ul class="this-page-menu">'
b'<li><a href="../bugs.html">Report a Bug</a></li>'
b'<li><a href="../_sources/library/urllib.txt"'
b'rel="nofollow">Show Source</a></li>'
b'</ul>'
b'</div>'
b'</div>'
b'</div>'
b'<div class="clearer"></div>'
b'</div>'
b'<div class="related" role="navigation" aria-label="related navigation">'
b'<h3>Navigation</h3>'
b'<ul>'
b'<li class="right" style="margin-right: 10px">'
b'<a href="../genindex.html" title="General Index"'
b'>index</a></li>'
b'<li class="right" >'
b'<a href="../py-modindex.html" title="Python Module Index"'
b'>modules</a> |</li>'
b'<li class="right" >'
b'<a href="urllib.request.html" title="21.6. urllib.request \xe2\x80\x94 Extensible library for opening URLs"'
b'>next</a> |</li>'
b'<li class="right" >'
b'<a href="wsgiref.html" title="21.4. wsgiref \xe2\x80\x94 WSGI Utilities and Reference Implementation"'
b'>previous</a> |</li>'
b'<li><img src="../_static/py.png" alt=""'
b'style="vertical-align: middle; margin-top: -1px"/></li>'
b'<li><a href="https://www.python.org/">Python</a> &raquo;</li>'
b'<li>'
b'<span class="version_switcher_placeholder">3.5.2</span>'
b'<a href="../index.html">Documentation </a> &raquo;'
b'</li>'
b''
b'<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>'
b'<li class="nav-item nav-item-2"><a href="internet.html" >21. Internet Protocols and Support</a> &raquo;</li>'
b'<li class="right">'
b''
b''
b'<div class="inline-search" style="display: none" role="search">'
b'<form class="inline-search" action="../search.html" method="get">'
b'<input placeholder="Quick search" type="text" name="q" />'
b'<input type="submit" value="Go" />'
b'<input type="hidden" name="check_keywords" value="yes" />'
b'<input type="hidden" name="area" value="default" />'
b'</form>'
b'</div>'
b'<script type="text/javascript">$(\'.inline-search\').show(0);</script>'
b'|'
b'</li>'
b''
b'</ul>'
b'</div>'
b'<div class="footer">'
b'&copy; <a href="../copyright.html">Copyright</a> 2001-2016, Python Software Foundation.'
b'<br />'
b'The Python Software Foundation is a non-profit corporation.'
b'<a href="https://www.python.org/psf/donations/">Please donate.</a>'
b'<br />'
b'Last updated on Sep 23, 2016.'
b'<a href="../bugs.html">Found a bug</a>?'
b'<br />'
b'Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.'
b'</div>'
b''
b'</body>'
b'</html>'
john_16@Linux-home /tmp $ 



_________________________________________________________________________________
полезный блог о python john16blog.blogspot.com

Офлайн

#3 Ноя. 6, 2016 20:37:27

JOHN_16
От: Россия, Петропавловск-Камчатск
Зарегистрирован: 2010-03-22
Сообщения: 3292
Репутация: +  221  -
Профиль   Отправить e-mail  

Проблемы при запуске программ с urllib и re

P.S. значит дело не в программе



_________________________________________________________________________________
полезный блог о python john16blog.blogspot.com

Офлайн

#4 Ноя. 6, 2016 22:37:38

jagrmi1
Зарегистрирован: 2016-11-06
Сообщения: 5
Репутация: +  0  -
Профиль   Отправить e-mail  

Проблемы при запуске программ с urllib и re

JOHN_16
P.S. значит дело не в программе
Выходит у меня что-то с ПО не то, так ?

Офлайн

#5 Ноя. 6, 2016 23:15:35

JOHN_16
От: Россия, Петропавловск-Камчатск
Зарегистрирован: 2010-03-22
Сообщения: 3292
Репутация: +  221  -
Профиль   Отправить e-mail  

Проблемы при запуске программ с urllib и re

Мы не знаем в чем именно проблема с Вашей стороны. Гадать слишком долго.



_________________________________________________________________________________
полезный блог о python john16blog.blogspot.com

Офлайн

#6 Ноя. 6, 2016 23:19:37

izekia
От:
Зарегистрирован: 2008-07-19
Сообщения: 317
Репутация: +  12  -
Профиль   Отправить e-mail  

Проблемы при запуске программ с urllib и re

попробуйте то же самое но с requests



Офлайн

#7 Ноя. 6, 2016 23:57:57

wallet
Зарегистрирован: 2016-02-21
Сообщения: 50
Репутация: +  2  -
Профиль  

Проблемы при запуске программ с urllib и re

jagrmi1
попробуйте поменять название файла, либо запустить с корневой директории

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version