Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address "'http:" not found: [Errno 11001] getaddrinfo failed. #2325

Closed
LancelotHolmes opened this issue Oct 14, 2016 · 8 comments
Closed

address "'http:" not found: [Errno 11001] getaddrinfo failed. #2325

LancelotHolmes opened this issue Oct 14, 2016 · 8 comments

Comments

@LancelotHolmes
Copy link

@LancelotHolmes LancelotHolmes commented Oct 14, 2016

When I try the sample code of scrapy tutorial in Creating a project, Extracting data,after type

scrapy shell 'http://quotes.toscrape.com/page/1/'

I got a exception like

twisted.internet.error.DNSLookupError: DNS lookup failed: address "'http:" not found: [Errno 11001] getaddrinfo failed.

and my operating system is windows with python 2.7

@LancelotHolmes
Copy link
Author

@LancelotHolmes LancelotHolmes commented Oct 14, 2016

Well,it may be related to the quotation, I tried to use " to enclose the urls and it works, I do not know if this command differs in different OS since the original tutorial commmand code use the ' to enclose the urls.

@redapple
Copy link
Contributor

@redapple redapple commented Oct 14, 2016

That's interesting. If " is more universal, we'll update the tutorial. Thanks for reporting @LancelotHolmes

@kmike
Copy link
Member

@kmike kmike commented Oct 14, 2016

In unix shells ' quote disables interpolation/evaluation, unlike "; enclosing URLs in " won't keep URLs inside as-is, it only allows shell to interpret URL as a single argument.

@redapple
Copy link
Contributor

@redapple redapple commented Oct 14, 2016

so what's your suggestion @kmike ?

@kmike
Copy link
Member

@kmike kmike commented Oct 14, 2016

@redapple it seems quoting rules are different in cmd.exe (http://stackoverflow.com/questions/24173825/what-does-single-quote-do-in-windows-batch-files) - only double quotes are supported. It means that on Linux and OS X the right way is to use single quotes, and on Windows the right way is to use double quotes. My vote is to add a note about Windows and keep single quotes in examples.

@LancelotHolmes
Copy link
Author

@LancelotHolmes LancelotHolmes commented Oct 19, 2016

Well, I found that on Windows(10) cmd, it also works without quotation like

scrapy shell http://quotes.toscrape.com/page/1/

which got a same result as

scrapy shell "http://quotes.toscrape.com/page/1/"
@kmike
Copy link
Member

@kmike kmike commented Oct 19, 2016

@LancelotHolmes it works because there is nothing to escape in these URLs; these URLs work without quotes in linux as well. But in linux the example start to fail as soon as user changes URL to another URL, with GET arguments, because & has special meaning in shell. So we used quotes in tutorial to promote good practices.

It seems escaping in windows shell is more tricky; there is no equivalent for unix single quotes. According to http://ss64.com/nt/syntax-esc.html percent character still needs to be escaped, even if it is inside quotes. On the other hand, unlike bash, & char is not a problem under Windows.

@danielsjf
Copy link

@danielsjf danielsjf commented Feb 28, 2019

You can get the same error message if the email server (Mailhog) isn't properly set up.

Request Method: | POST
-- | --
http://127.0.0.1:8000/accounts/email/
2.0.13
gaierror
[Errno 11001] getaddrinfo failed
C:\ProgramData\Anaconda3\lib\socket.py in getaddrinfo, line 748

Simply changing the backend in your settings file can solve this issue (only for local).

EMAIL_BACKEND = env('DJANGO_EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.