I have a problem with this code, please help me solve it this code
is giving give me the following error:
socket.gaierror: [Errno 11001] getaddrinfo failed
import socket
servername='host'
serverport=12000
clientsocket=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
message=input('input:')
clientsocket.sendto(message.encode('ascii'),(servername,serverport))
modimess,serveraddress=clientsocket.recvfrom(2048)
print(modimess)
clientsocket.close()
Related
While downloading NLTK stopwords , I am getting the following error
[nltk_data] Error loading stopwords: <urlopen error [Errno 110]
[nltk_data] Connection timed out>
The code used is
import nltk
nltk.download('stopwords')
I also tried the following command and got the same error
python -m nltk.downloader stopwords
Thanks
I'm running Django 3.2 with django-tenants on a Windows local dev environment.
In my windows hosts file I have:
127.0.0.1 *.localhost
...so that I am able to use subdomains with django-tenants. E.g. http://mysub.localhost:8000.
When running ./manage.py runserver the dev server runs perfectly. However, when trying to execute urlopen in my code I get an error:
>>> html = urlopen('http://mysub.localhost:8000')
Traceback (most recent call last):
[...]
urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>
As far as I can tell the error is due to the proxy settings on my windows machine (this does not fail in production), but I am unsure how to resolve it?
I've been running my pipeline that uses spotipy to get spotify information every day for a while now, and just this morning I'm getting this error. Is anybody else having the same problem / have any ideas as to what's going on?
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='accounts.spotify.com', port=443): Max retries exceeded with url: /api/token (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x120f558b0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
I wanna connect to a mongodb in a kubectl pod using pymongo.
I've tried this https://kubernetes.io/blog/2017/01/running-mongodb-on-kubernetes-with-statefulsets/
but it just doesn't work.
I even used a post forwarding like:
kubectl port-forward [pod]-2 27017:27017
and tried to connect using localhost hostname (which works in mongodb tools like mongoshell) but it also gives me the same errors.
The errors I get are:
raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: [pod]-0.[service]:27017: [Errno 11001] getaddrinfo failed,[pod]-1.[service]:27017: [Errno 11001] getaddrinfo failed,[pod]-2.[service]:27017: [Errno 11001] getaddrinfo failed, Timeout: 30s, Topology Description: <TopologyDescription id: xxxxxxxxx, topology_type: Unknown, servers: [<ServerDescription ('[pod]-0.[service]', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('[pod]-0.[service]:27017: [Errno 11001] getaddrinfo failed')>, etc...]>
Notes [pod] and [services] are the pod and service names (but hidden) I'm using.
Do you have any ideas of what I'm doing wrong?
I used the last version of python3, last version of pymongo and windows10.
That article is very old. I'd recommend looking at MongoDB Community Kubernetes Operator: https://github.com/mongodb/mongodb-kubernetes-operator.
Follow https://github.com/mongodb/mongodb-kubernetes-operator/blob/master/docs/install-upgrade.md to install;
Then https://github.com/mongodb/mongodb-kubernetes-operator/blob/master/docs/deploy-configure.md to deploy a cluster;
The instructions will show how to get a connection string (in the format mongodb+srv://<username>:<password>#example-mongodb-svc.mongodb.svc.cluster.local/admin?ssl=true); use this connection string in your pymongo code.
OS: Windows 10
tensorflow and keras succesfully imported, python 3.7.9
tf.__version__
>>> '2.1.0'
keras.__version__
>>> '2.2.4-tf'
Problem
Tried load_datasets or any dataset available in tf.keras such as:
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.fashion_mnist.load_data()
give this error
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
.
.
.
URLError: <urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host>
During handling of the above exception, another exception occurred:
.
.
.
Exception: URL fetch failure on https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-labels-
idx1-ubyte.gz: None -- [WinError 10054] An existing connection was forcibly closed by the remote host
The three dots showing bunch of code lines that can't be executed.
Anyone knows how to solve? I've been looking for possible solutions but the closest I can find is solving certification/verification issue, I think mine is about URL.
I know the workaround is to download the dataset from kaggle etc., but I want to know what cause this. Thanks guys
EDIT: it's not URL problem, unable to access https://storage.googleapis.com using IDM, but files can be downloaded directly in browser. So I guess it's security issue
Finally after 5 hours reading here and there..
Please check the solution by CRLannister here https://github.com/tensorflow/tensorflow/issues/33285
What it doesn't mention is where data_utils.py is located in case of Windows OS and anaconda environment. It's located here
~\Anaconda3\envs\*your_env*\Lib\site-packages\tensorflow_core\python\keras\utils\data_utils.py
just add the following after all the import statement
import requests
requests.packages.urllib3.disable_warnings()
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
# Legacy Python that doesn't verify HTTPS certificates by default
pass
else:
# Handle target environment that doesn't support HTTPS verification
ssl._create_default_https_context = _create_unverified_https_context