“getaddrinfo 失败”,这是什么意思?

发布于 2024-12-03 15:04:51 字数 280 浏览 1 评论 0 原文

  File "C:\Python27\lib\socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)   gaierror: [Errno 11004]
getaddrinfo failed

Bottle 文档 启动“Hello World”示例时出现此错误

  File "C:\Python27\lib\socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)   gaierror: [Errno 11004]
getaddrinfo failed

Getting this error when launching the "Hello World" sample from the Bottle documentation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

淡忘如思 2024-12-10 15:04:51

这很可能意味着无法解析主机名。

import socket
socket.getaddrinfo('localhost', 8080)

如果它在那里不起作用,那么它在 Bottle 示例中也不会起作用。如果出现问题,您可以尝试使用“127.0.0.1”而不是“localhost”。

It most likely means the hostname can't be resolved.

import socket
socket.getaddrinfo('localhost', 8080)

If it doesn't work there, it's not going to work in the Bottle example. You can try '127.0.0.1' instead of 'localhost' in case that's the problem.

梦在深巷 2024-12-10 15:04:51

就我而言,问题在于,当我没有代理时,某些安装在某些时候在我的计算机上定义了一个环境变量 http_proxy

删除 http_proxy 环境变量解决了问题。

The problem, in my case, was that some install at some point defined an environment variable http_proxy on my machine when I had no proxy.

Removing the http_proxy environment variable fixed the problem.

孤蝉 2024-12-10 15:04:51

我的问题是,我需要为 http_proxyhttps_proxy 添加环境变量。

例如,

http_proxy=http://your_proxy:your_port
https_proxy=https://your_proxy:your_port

要在 Windows 中设置这些环境变量,请参阅此问题的答案

The problem in my case was that I needed to add environment variables for http_proxy and https_proxy.

E.g.,

http_proxy=http://your_proxy:your_port
https_proxy=https://your_proxy:your_port

To set these environment variables in Windows, see the answers to this question.

挽心 2024-12-10 15:04:51

我花了一些时间来解决这个问题,但结果证明解决方案非常简单。我的 ftp 服务器地址以 ftp:// 开头。我删除了它,代码开始工作。

之前的FTP地址:

ftp_css_address = "ftp://science-xyz.xyz.xyz.int"

修改为:

ftp_css_address = "science-xyz.xyz.xyz.int"

I spent some good hours fixing this but the solution turned out to be really simple. I had my ftp server address starting with ftp://. I removed it and the code started working.

FTP address before:

ftp_css_address = "ftp://science-xyz.xyz.xyz.int"

Changed it to:

ftp_css_address = "science-xyz.xyz.xyz.int"
命硬 2024-12-10 15:04:51

确保在命令中传递代理属性
例如 - pip install --proxy=http://proxyhost:proxyport pixiedust

使用具有直接连接的代理端口(通过 /无密码)。与您的公司 IT 管理员联系。快速的方法是找出 Eclipse 中使用的网络设置,它将有直接连接。

如果您在公司防火墙后面工作,您会经常遇到此问题。您必须检查您的 Internet Explorer - InternetOptions -LAN Connection - Settings

取消选中 - 使用自动配置脚本
检查 - 为您的 LAN 使用代理服务器。确保您提供了正确的地址和端口。

单击“确定”
回到anaconda终端,你可以尝试安装命令

Make sure you pass a proxy attribute in your command
forexample - pip install --proxy=http://proxyhost:proxyport pixiedust

Use a proxy port which has direct connection (with / without password). Speak with your corporate IT administrator. Quick way is find out network settings used in eclipse which will have direct connection.

You will encouter this issue often if you work behind a corporate firewall. You will have to check your internet explorer - InternetOptions -LAN Connection - Settings

Uncheck - Use automatic configuration script
Check - Use a proxy server for your LAN. Ensure you have given the right address and port.

Click Ok
Come back to anaconda terminal and you can try install commands

峩卟喜欢 2024-12-10 15:04:51

也许这会对某人有所帮助。我在 python 脚本中设置了代理,但不断收到问题中提到的错误。

下面是一个块,它将在开始时将我的用户名和密码作为常量。

   if (use_proxy):
        proxy = req.ProxyHandler({'https': proxy_url})
        auth = req.HTTPBasicAuthHandler()
        opener = req.build_opener(proxy, auth, req.HTTPHandler)
        req.install_opener(opener)

如果您使用的是公司笔记本电脑并且没有连接到 Direct Access 或办公室 VPN,则上述块将引发错误。您所需要做的就是连接到您的组织 VPN,然后执行您的 python 脚本。

谢谢

May be this will help some one. I have my proxy setup in python script but keep getting the error mentioned in the question.

Below is the piece of block which will take my username and password as a constant in the beginning.

   if (use_proxy):
        proxy = req.ProxyHandler({'https': proxy_url})
        auth = req.HTTPBasicAuthHandler()
        opener = req.build_opener(proxy, auth, req.HTTPHandler)
        req.install_opener(opener)

If you are using corporate laptop and if you did not connect to Direct Access or office VPN then the above block will throw error. All you need to do is to connect to your org VPN and then execute your python script.

Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文