Closed d74fda93-1fbd-4bc0-8e94-d0b349041a1d closed 23 years ago
When you try to connect to a imap server with a macintosh, you get an error:
>>>
>>> import imaplib
>>> M = imaplib.IMAP4('imapserver')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "Macintosh HD:Applications (Mac OS
9):Python 2.1.1:Lib:imaplib.py", line 168, in __init__
self._simple_command(cap)
File "Macintosh HD:Applications (Mac OS
9):Python 2.1.1:Lib:imaplib.py", line 844, in
_simple_command
return self._command_complete(name,
apply(self._command, (name,) + args))
File "Macintosh HD:Applications (Mac OS
9):Python 2.1.1:Lib:imaplib.py", line 676, in
_command_complete
raise self.abort('command: %s => %s' % (name,
val))
* CAPABILITY IMAP4 IMAP4REV1 NAMESPACE
IDLE SCAN SORT MAILBOX-REFERRALS
LOGIN-REFERRALS AUTH=LOGIN
THREAD=ORDEREDSUBJEC'
>>>
That is because the file associated to the socket created by IMAP4 object is not binary, and that is a problem with end lines in macintosh.
When I changed the file mode to binary it works:
------- start patch-----------------------
*** imaplib.py Wed Oct 10 17:12:37 2001 --- imaplib-old.py Wed Oct 10 17:12:03 2001
* 207,213 ** """ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! self.file = self.sock.makefile('rb')
def read(self, size):
--- 207,213
"""
self.sock = socket.socket(socket.AF_INET,
socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) ! self.file = self.sock.makefile('r')
def read(self, size):
--------end of patch -----------
With linux, the new imaplib works too, but I have not tested it in other platforms,
Alfonso Baciero.
Logged In: YES user_id=346109
There's no uploaded file! You have to check the checkbox labeled "Check to Upload & Attach File" when you upload a file.
Please try again.
(This is a SourceForge annoyance that we can do nothing about. :-( )
Logged In: YES user_id=21627
The patch looks fine to me.
In a binary stream (such as an LDAP connection), using readline (i.e. C fgets) seems risky, since end-of-line characters are really only meaningful in text mode. However, it appears that it should still work on any implementation where \n indicates ASCII LF in binary mode (i.e. on any implementation that uses ASCII, which is a prerequisite in Python, anyway).
If somebody thinks this is a problem, IMAP4.readline needs to be rewritten to look for the line delimiter CRLF itself.
BTW, how did you issue the "canned response"?
Logged In: YES user_id=346109
I don't think I have to say any more about the patch.
About the canned response issue, when I posted the patch, I didn´t upload the patch as file. Later I uploaded the patch file and I think that I put the canned response menu to Missing Upload (I now realize that I had not to do that).
Sorry by the delay in my response but I haven't been able to connect to internet before.
Logged In: YES user_id=6380
I think using readline on a binary-opened file is fine, so I've applied this now.
I gues he saw the canned response menu because he's an admin for another SF project. I've seen weirdnesses like this before (some submitters can close their own bug report, very confusing).
Logged In: YES user_id=346109
In addition to the canned response menu, I see other menus in this patch tracker: "assigned to", "status" and so on. And I am not admin in any project: in fact, I opened the SF account to submit this bug!
Logged In: YES user_id=6380
Bizarre. I've submitted a bug report to SF. Their permission checking must do a reduction of the userid modulo 2**16 or so. :-(
Logged In: YES user_id=6380
It turns out to be a feature: the original submitter has the same power over a tracker item as the project admin. We never stop learning. :-)
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = 'https://github.com/gvanrossum' closed_at =
created_at =
labels = ['library']
title = 'Bugfix for imaplib for macintosh'
updated_at =
user = 'https://bugs.python.org/alczj'
```
bugs.python.org fields:
```python
activity =
actor = 'gvanrossum'
assignee = 'gvanrossum'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation =
creator = 'alczj'
dependencies = []
files = ['3670']
hgrepos = []
issue_num = 469910
keywords = ['patch']
message_count = 8.0
messages = ['37810', '37811', '37812', '37813', '37814', '37815', '37816', '37817']
nosy_count = 3.0
nosy_names = ['gvanrossum', 'loewis', 'alczj']
pr_nums = []
priority = 'normal'
resolution = 'accepted'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue469910'
versions = []
```