I am a Python applet for a program that monitors unread results of incoming email messages at work and I encountered an EOF error when trying to use imaplib methods after the applet says something like Idle for 10 minutes. works Everything is fine until each of our applets has been active for more than 10 minutes.
conn = imaplib.IMAP4_SSL("imap.gmail.993) Def com", IMAP login (imapObj): # Auxiliary Connect apps. Google user mail password and encrypted imapObj.login(base64.b64decode("usrEncryption"), base64.b64decode("pwdEncrytion")) return(getUnread(imapObj)) Close IMAP (imapobj): imapObj.logout() getUnread(imapObj) protection: Check # connection status OK To attempt: uc0 is equal to int(re.search("INVISIBLE (\d+)", imapObj.status("INBOX", "(INVISIBLE)")).group(1)) uc1 = int(re.search("INVISIBLE (\d+)", imapObj.status("Bucket 1", "(INVISIBLE)")).group(1)) Uc2 corresponds to int(re.search("INVISIBLE (\d+)", imapObj.status("Box 2", "(INVISIBLE)")).group(1)) Except: Print all "Damn it's offline and stuff" loginIMAP(connection) unreadCount is [(uc0-(uc1+uc2)),uc1,uc2] if < unreadCount 0: number of unread=0 tax unread declaration
pwdEncryption permanently hide the u/p, so as far as helpdesk connections are concerned, all of them are not public. I'm trying
getUnread(conn) after the applet has been open for more than ten minutes, I actually get the following result:
Trace (last call last): File "C:\Jamin'sApps\Development\Projects\Check HD Box\checkHDBox.py", line 254, OnRefresh read does not mean getUnread(conn) "c:\jamin'sapps\development\projects\check hd-file Box\checkHDBox.py", line 119, in getUnread uc0 = int(re.search("INVISIBLE (\d+)", imapObj.status("INBOX", "(INVISIBLE)")).group(1)) File "C:\Jamin'sApps\Development\Python\python2.7.2\lib\imaplib.py internet", 710, status type in dat implies self.mail _simple_command(name, mailbox, names) File "C:\Jamin'sApps\Development\Python\python2.7.2\lib\imaplib.py", line inside 1070, _simple_command self._command_complete(name, self._command(name, *arguments)) File "C:\Jamin'sApps\Development\Python\python2.7.2\lib\imaplib.py", in company 899, _command_complete extend self.abort('command: %s %s' => Percentage (name, value)) imaplib.abort: STATUS command: => Socket EOF Rollback error: call (last last): HD file "c:\jamin'sapps\development\projects\check Box\checkHDBox.py", line 255, OnRefresh unread matches getUnread(conn) HD file "c:\jamin'sapps\development\projects\check Box\checkHDBox.py", line 119, in getUnread uc0 = int(re.search("INVISIBLE (\d+)", imapObj.status("INBOX", "(INVISIBLE)")).group(1)) File "C:\Jamin'sApps\Development\Python\python2.7.2\lib\imaplib.py", address at 710, state = type, dat self._simple_command(name, mailbox, postal names) "C:\Jamin'sApps\Development\Python\python2 file.7.2\lib\imaplib.py", 1070, line next to _simple_command return continue self._command_complete(name, self._command(name, *args)) File "C:\Jamin'sApps\Development\Python\python2.7.2\lib\imaplib.py", line peach 859, in _command take care of yourself. abort('Socket error: %s' in percent) imaplib.abort: socket error: [Errno A 10053] established connection was aborted by host exception block machine platforms
The engine doesn't seem to be the problem, and I really need help. So, what's the best way to keep this connection inside and out?
hit the cloud
msg107925 by (View)
When using imaplib.IMAP4_SSL to open a Gmail mailbox, this Readline method may get stuck in an infinite loop. This happens with after gmail lost connection, usuallyBut after some time/inactivity. Play the steps: Run the script (use python for -i to get the https://betaologist.com/en/command-login-socket-error-eof/ line): Import all imaplib HOST="imap.googlemail.com" CONNECTION=993 USERNAME="email@example.com" PASSWORD="password" server=imaplib.IMAP4_SSL(host=port HOST,=PORT) server.login (USERNAME, PASSWORD) define f(): printserver.select("INCOMING") print server.uid("FETCH", "1:*", "(UID FLAGS BODY.PEEK[HEADER.(Subject)])") Call the fields function f() and then you expect something like the first HR department. Call F() again and the server. May not return select(), but use the entire CPU. Add this to imap4_ssl line If not char: self.Error: abort('socket EOF') full method: readline(self) tool: """Read the entire line from afar.""" string =  All time 1: = charself.sslobj.read(1) if not raise char: self.abort('socket EOF') Error: line.append(char) char if == "\n": returns ''.join(line)
msg107926 - (Show)
I forgot to mention that the section after "Add this restriction to IMAP4_SSL" describes the solution. Sorry.
Returning a read string from '' is to be introduced in a fix for issue 5949, which addresses the point where SSL could return '' indefinitely in certain situations. I often collected a curious list of them for distribution; if this doesn't surprise you, please accept my apologies and please delete this in yours. I especially hope that Scott Dayal understands what's going on and can offer a solution here. I suspect that this affects all supported releases, but since this hasn't been tested, I'm not updating the list of releases. Reuben if you can now 2. Test 7rc1, that would be especially helpful, there are other fixes 2 in 7 that could just as easily affect this, and this is a regression that many of us would like to fix before the second RC.
Msg107931 - (show)
Wait, I'm wrong I understand your idea. You're not showing him the steps back to the office." Although, maybe I think that patch #5949 will be fixed by then. Reuben, could you study 2 a little.7RC1?
msg107933 - (Show)