attributeerror module urllib has no attribute urlopen

This question already has an answer here:

I just started learning Python. I am sure i wrote the code right.

but i keep on getting this error no matter how much i try.

I tried `urllib.request as well. I get this error.

marked as duplicate by Łukasz Rogalski, Bakuriu python Users with the python badge can single-handedly close python questions as duplicates and reopen them as needed. Oct 11 ’16 at 16:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Comments

Copy link Quote reply

fferraro87 commented Mar 14, 2017

Hi,
i’m trying to use this tool on my arch OS.
i’ve this error :

what i’ve to install?
thanks

This comment has been minimized.

Copy link Quote reply

This comment has been minimized.

Copy link Quote reply

fferraro87 commented Mar 14, 2017

Python 3.6.0, i’ve already install dnspython and netaddr via pip

This comment has been minimized.

Copy link Quote reply

This comment has been minimized.

Copy link Quote reply

fferraro87 commented Mar 14, 2017

Ah ok thanks for your help

This comment has been minimized.

Copy link Quote reply

palnabarun commented May 14, 2017

@darkoperator Hey. I refactored the code but that threw up a HTTP403:Forbidden. I think Google servers are rejecting requests from urllib python.

PS: I do not ping Google servers using scripts that often, so blocking my IP is not an option.

This comment has been minimized.

Copy link Quote reply

palnabarun commented May 14, 2017

@darkoperator Using requests in Python3.5.2 though solves the problem. Moreover, the function unique does not work in Python3, so a workaround by using set is to be done.

This comment has been minimized.

Copy link Quote reply

CerebralMischief commented Oct 20, 2017

Any updates on this? I’m running into this problem across various shells and have resorted to using Kali Linux and avoid updating Python there — this isn’t ideal and I’d rather see the issue fixed here. I personally don’t know Python well enough to make the change or I would take care of it myself and submit a PR. Though I see other PR’s have been open for a while so I’m wondering if @darkoperator is even working on this any longer. (I hope so!) 🙂 Thank you in advance.

This comment has been minimized.

Copy link Quote reply

darkoperator commented Oct 20, 2017

@CerebralMischief not abandone, just need to set time to figure how to keep it compatible with python 2.7 and 3.x and python breaking stuff in minor changes does not help, specially since Python is not a strength of mine

This comment has been minimized.

Copy link Quote reply

CerebralMischief commented Oct 20, 2017

I’m so happy to hear you’re still working on this project! Thank you for taking the time to respond. I am in the same boat, I don’t know Python very well or I’d happily work on a fix and submit a PR. Maybe I can try to dig in and learn it as I’d love to help you. 🙂

This comment has been minimized.

Copy link Quote reply

darkoperator commented Oct 21, 2017

Actually thinking of removing the Google feature. It is against Google terms of service and it is not actually a DNS enumeration technique. While testing I banned my IP for a while.

This comment has been minimized.

Copy link Quote reply

darkoperator commented Oct 23, 2017

Pushed a fix to master. Test and let me know if it fixed the issue.

11 [2011-09-26 15:10:00]

Я изучаю urllib2, следуя этому руководству Выполнение кода ниже дает другой результат из учебника

Интерпретатор Python переплевывает это назад

Как это происходит?

UPDATE

Когда я пытаюсь распечатать атрибут кода, он отлично работает

python attributes urllib2 urllib

3 ответа

1 Решение [2011-09-27 01:01:00]

Причина, по которой я получил атрибут AttributeError, заключалась в том, что я использовал OpenDNS. Очевидно, даже когда вы передаете фиктивный URL, OpenDNS рассматривает его так, как он существует. Поэтому после перехода на DNS-сервер Googles я получаю ожидаемый результат:

Также я должен упомянуть трассировку, которую я получил для запуска этого кода, который есть все, кроме try и except

какой добрый человек (wo)? от IRС#python сказал мне, что это очень странно, и затем спросил, использую ли я OpenDNS, на что я ответил «да». Поэтому они предложили мне переключить его на Google, который я и сделал.

В зависимости от типа ошибки объект e может или не может нести этот атрибут.

В приведенной ссылке есть более полный пример:

Потому что такого атрибута нет. Попробуйте:

Оцените статью