socket.gaierror in Google Data Python lib code - gdata

I'm trying to execute this basic code from Getting Started with Google data:
`import gdata.docs.service
# Create a client class which will make HTTP requests with Google Docs server.
client = gdata.docs.service.DocsService()
# Authenticate using your Google Docs email address and password.
client.ClientLogin('jo#gmail.com', 'password')
# Query the server for an Atom feed containing a list of your documents.
documents_feed = client.GetDocumentListFeed()
# Loop through the feed and extract each document entry.
for document_entry in documents_feed.entry:
# Display the title of the document on the command line.
print document_entry.title.text`
The third line i.e. client.ClientLogin('myemail-id', 'my-password') is throwing an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gdata/service.py", line 834, in ClientLogin
self.ProgrammaticLogin(captcha_token, captcha_response)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gdata/service.py", line 771, in ProgrammaticLogin
headers={'Content-Type':'application/x-www-form-urlencoded'})
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/atom/http.py", line 163, in request
connection.endheaders()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 951, in endheaders
self._send_output(message_body)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 811, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 773, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1154, in connect
self.timeout, self.source_address)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
Could you help me understand what this error is about and also how to work around this?

Related

Connection to local postgresql database fails after upgrade to Big Sur

I use IntelliJ IDEA's bundled database client (DataGrip) to manage my database connections, both local and remote. And using docker to connect to postgres with following settings:
services:
postgresql:
image: postgres:11
ports:
- "5432:5432"
expose:
- "5432"
environment:
- POSTGRES_USER=$user
- POSTGRES_PASSWORD=$pass
- POSTGRES_DB=k$db
After upgrading from Catalina to Big Sur, connection to local db fails and it just shows a connection error message as follows:
[08001] Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
java.net.ConnectException: Connection refused (Connection refused).
When I run docker-compose up, I get the following error:
Traceback (most recent call last):
File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "site-packages/docker/transport/unixconn.py", line 43, in connect
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/requests/adapters.py", line 449, in send
File "site-packages/urllib3/connectionpool.py", line 727, in urlopen
File "site-packages/urllib3/util/retry.py", line 403, in increment
File "site-packages/urllib3/packages/six.py", line 734, in reraise
File "site-packages/urllib3/connectionpool.py", line 677, in urlopen
File "site-packages/urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "site-packages/docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages/docker/api/client.py", line 205, in _retrieve_server_version
File "site-packages/docker/api/daemon.py", line 181, in version
File "site-packages/docker/utils/decorators.py", line 46, in inner
File "site-packages/docker/api/client.py", line 228, in _get
File "site-packages/requests/sessions.py", line 543, in get
File "site-packages/requests/sessions.py", line 530, in request
File "site-packages/requests/sessions.py", line 643, in send
File "site-packages/requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-compose", line 3, in <module>
File "compose/cli/main.py", line 67, in main
File "compose/cli/main.py", line 123, in perform_command
File "compose/cli/command.py", line 69, in project_from_options
File "compose/cli/command.py", line 132, in get_project
File "compose/cli/docker_client.py", line 43, in get_client
File "compose/cli/docker_client.py", line 170, in docker_client
File "site-packages/docker/api/client.py", line 188, in __init__
File "site-packages/docker/api/client.py", line 213, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', ConnectionRefusedError(61, 'Connection refused'))
[1269] Failed to execute script docker-compose
Connecting to remote db's are not broken somehow, they work. Is there anyone came across this problem?
After Big Sur upgrade, I also had a warning whenever I open a new terminal:
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
I did not think they are related but the solution to this problem, explained in this thread, also solved the main postgresql connection issue for me. But my computer keeps restarting occasionally and after this restart, I again get the main problem when I run docker-compose up inside IDE's terminal. I then manually restart and it works. Although not being a permanent soluiton, this solved my problem for now.

What to do to import a CSV file using a chromebook idle version python 3.7.3 shell

Keep getting this error message when I enter this code :
data = pd.read_csv('1.01. Simple linear regression.csv')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
data = pd.read_csv('1.01. Simple linear regression.csv')
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 678, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 440, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 787, in __init__
self._make_engine(self.engine)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1014, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1708, in __init__
self._reader = parsers.TextReader(src, **kwds)
File "pandas/_libs/parsers.pyx", line 384, in pandas._libs.parsers.TextReader.__cinit__
File "pandas/_libs/parsers.pyx", line 695, in pandas._libs.parsers.TextReader._setup_parser_source
And the message :
FileNotFoundError: File b'1.01. Simple linear regression.csv' does not exist
(Best end a question with the question.) The current working directory for the program does not have a file by that name. Possible solutions:
Give a complete path to the file to read_csv.
Change the working directory in the program to the one that contain that file using os.chdir. See chdir doc.
Start python in that directory, with or without IDLE, from a command line.

outlook mailbox SMTPDataError 550 delivery result banner

I was using smtp service of outlook mailbox in my web app. And it worked well in last several days. However a sudden error occured during a usual test:
File "/usr/lib/python3.4/smtplib.py", line 799, in sendmail
raise SMTPDataError(code, resp)
smtplib.SMTPDataError: (550, b'5.3.4 554-554 5.2.0 STOREDRV.Deliver;delivery result banner')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
File "/home/lancecopper/code/python/flasky/app/email.py", line 9, in send_async_email
mail.send(msg)
File "/home/lancecopper/code/flasky/venv/lib/python3.4/site-packages/flask_mail.py", line 492, in send
message.send(connection)
File "/home/lancecopper/code/flasky/venv/lib/python3.4/site-packages/flask_mail.py", line 152, in __exit__
self.host.quit()
File "/usr/lib/python3.4/smtplib.py", line 867, in quit
res = self.docmd("quit")
File "/usr/lib/python3.4/smtplib.py", line 403, in docmd
self.putcmd(cmd, args)
File "/usr/lib/python3.4/smtplib.py", line 349, in putcmd
self.send(str)
File "/usr/lib/python3.4/smtplib.py", line 341, in send
raise SMTPServerDisconnected('please run connect() first')
smtplib.SMTPServerDisconnected: please run connect() first
I have little knowledge about underlining mechanism of smtp. Can anybody give me some clue about this kind of error.
By the way, I'm a poor guy living inside GFW(Great Firewall of China).Would it be possible that the error above was caused by interruption of GFW?
I encountered this issues when using mutt to.
login your account and verify mobile phone number and check it again.
You may got message like on your phone:
[TLSG] Microsoft 访问代码:2130

OpenERP Server Error Access denied

After installing Odoo, I went to web panel where it asked create new database.
As I entered details I got error. I can change master password successfully.
I already created database on putty and there is no openerp-server.conf file under /etc/ folder.
Odoo
OpenERP Server Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 500, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 517, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 284, in _call_function
return self.endpoint(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 733, in __call__
return self.method(*args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 376, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python2.7/dist-packages/openerp/addons/web/controllers/main.py", line 714, in create
params['create_admin_pwd'])
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 807, in proxy_method
result = dispatch_rpc(self.service_name, method, args)
File "/usr/lib/python2.7/dist-packages/openerp/http.py", line 100, in dispatch_rpc
result = dispatch(method, params)
File "/usr/lib/python2.7/dist-packages/openerp/service/db.py", line 62, in dispatch
security.check_super(passwd)
File "/usr/lib/python2.7/dist-packages/openerp/service/security.py", line 33, in check_super
raise openerp.exceptions.AccessDenied()
AccessDenied: Access denied.
Using following command you will get location of .conf file
locate openerp-server.conf
Now go to that path and open it and check out master password whether it's same as you given while creating a new database.
#Danish the master password should be "admin" it is required to newly create your database
The master password that you are using to create the database is not same as what you have set for the PostgreSQL server.
#Danish
Check the tools -> config file and look what are the username and
password been set for accessing the database.
Check pg_hba.conf file under /etc/postgresql/9.1/main, that it is
allowing the connection for the specified database user in tools ->
config file.

I have the following error. How to fix the following certificate error (ipython)?

I'm getting the following error when I want to run ipython notebook on my macbook. Does anyone know how to fix this? Could you please help me about it?
ERROR:root:Exception in I/O handler for fd 6
Traceback (most recent call last):
File "//anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 346, in start
self._handlers[fd](fd, events)
File "//anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 167, in accept_handler
callback(connection, address)
File "//anaconda/lib/python2.7/site-packages/tornado/tcpserver.py", line 217, in _handle_connection
do_handshake_on_connect=False)
File "//anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 407, in ssl_wrap_socket
return ssl.wrap_socket(socket, **dict(context, **kwargs))
File "//anaconda/python.app/Contents/lib/python2.7/ssl.py", line 387, in wrap_socket
ciphers=ciphers)
File "//anaconda/python.app/Contents/lib/python2.7/ssl.py", line 141, in __init__
ciphers)
SSLError: [Errno 336445449] _ssl.c:368: error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib
ERROR:root:Exception in I/O handler for fd 6
Traceback (most recent call last):
File "//anaconda/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 346, in start
self._handlers[fd](fd, events)
File "//anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 167, in accept_handler
callback(connection, address)
File "//anaconda/lib/python2.7/site-packages/tornado/tcpserver.py", line 217, in _handle_connection
do_handshake_on_connect=False)
File "//anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 407, in ssl_wrap_socket
return ssl.wrap_socket(socket, **dict(context, **kwargs))
File "//anaconda/python.app/Contents/lib/python2.7/ssl.py", line 387, in wrap_socket
ciphers=ciphers)
File "//anaconda/python.app/Contents/lib/python2.7/ssl.py", line 141, in __init__
ciphers)
SSLError: [Errno 336445449] _ssl.c:368: error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib
It appears that your browser is attempting to access the notebook without SSL. Make sure to access the site with HTTPS. For example, when you access the notebook, type in https://127.0.0.1:9999 in your browser. (Or whatever the address of the server is.)
It doesn't recognise the files you're passing it - either:
pass a .pem file (private key) to --NotebookApp.keyfile= and the .crt file (your certificate) to --NotebookApp.certfile=
create a new file by appending your certificate to your key and pass this new file to --certfile.