[issue41672] imaplib: wrong return type documented
Norbert Cyran added the comment: @corona10 PR added: https://github.com/python/cpython/pull/22207 -- ___ Python tracker <https://bugs.python.org/issue41672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41672] imaplib: wrong return type documented
Change by Norbert Cyran : -- keywords: +patch pull_requests: +21261 stage: -> patch review pull_request: https://github.com/python/cpython/pull/22207 ___ Python tracker <https://bugs.python.org/issue41672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41672] imaplib: wrong return type documented
Norbert Cyran added the comment: @ericsmith Sure, I can create a PR and link it here when I'm done. -- ___ Python tracker <https://bugs.python.org/issue41672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41672] imaplib: wrong return type documented
New submission from Norbert Cyran : Documentation on IMAP4 class specifies wrong return type of its commands: Each command returns a tuple: (type, [data, ...]) where type is usually 'OK' or 'NO', and data is either the text from the command response, or mandated results from the command. Each data is either a string, or a tuple. If a tuple, then the first part is the header of the response, and the second part contains the data (ie: ‘literal’ value). That's not valid for Python 3, as IMAP4 commands return bytes-like objects in data, what's shown in the example before:: >>> from imaplib import IMAP4 >>> with IMAP4("domain.org") as M: ... M.noop() ... ('OK', [b'Nothing Accomplished. d25if65hy903weo.87']) That of course can cause a lot of trouble due to incompatibility of strings and bytes. Suggested change is to replace string occurences to bytes-like object. I don't know what types are returned in case when tuple is returned though. -- assignee: docs@python components: Documentation messages: 376143 nosy: docs@python, norbertcyran priority: normal severity: normal status: open title: imaplib: wrong return type documented versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue41672> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39832] Modules with decomposable characters in module name not found on macOS
Norbert added the comment: Yes, if the Python runtime caches file names and determines based on the cache whether a file exists, then it needs to normalize both the file names in the cache and the name of the file it’s looking for. As far as I know, both HFS and APFS do this themselves when asked for a file by name, but if you ask for a list of available files, they don’t know what you’re comparing against. I don’t think codecs would be involved here; I’d use unicodedata.normalize with either NFC or NFD – doesn’t matter which one. -- ___ Python tracker <https://bugs.python.org/issue39832> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39832] Modules with decomposable characters in module name not found on macOS
New submission from Norbert : Modules whose names contain characters that are in precomposed form but can be decomposed in Normalization Form D can’t be found on macOS. To reproduce: 1. Download and unzip the attached file Modules.zip. This produces a directory Modules with four Python source files. 2. In Terminal, go to the directory that contains Modules. 3. Run "python3 -m Modules.Import". Expected behavior: The following lines should be generated: Maerchen Märchen Actual behavior: The first line, “Maerchen” is generated, but then an error occurs: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code exec(code, run_globals) File "/Users/business/tmp/pyimports/Modules/Import.py", line 5, in from Modules.Märchen import hello2 ModuleNotFoundError: No module named 'Modules.Märchen' Evaluation: In the source file Modules/Import.py, the name of the module “Märchen” is written with the precomposed character U+00E4. The file name Märchen.py uses the decomposed character sequence U+0061 U+0308 instead. Macintosh file names commonly use a variant of Normalization Form D in file names – the old file system HFS enforces this, and while APFS doesn’t, the Finder still generates file names in this form. U+00E4 and U+0061 U+0308 are canonically equivalent, so they should be treated as equal in module loading. Tested configuration: CPython 3.8.2 macOS 10.14.6 -- components: Interpreter Core files: Modules.zip messages: 363224 nosy: Norbert priority: normal severity: normal status: open title: Modules with decomposable characters in module name not found on macOS type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file48944/Modules.zip ___ Python tracker <https://bugs.python.org/issue39832> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: SMTPHandler and Unicode
Well, you could use an approach like the one suggested here: http://plumberjack.blogspot.com/2010/07/using-custom-formatter-to-dea... That's nice, thanks. I'll use something like this. Just a thought : I will use errors=replace in the call to the encode method to be sure that the logger does not raise any exception. -- http://mail.python.org/mailman/listinfo/python-list
SMTPHandler and Unicode
Hello, I want to send error messages with SMTPHandler logging. But SMTPHandler does not seem to be unicode aware. Is there something doable without playing with sys.setdefaultencoding ? import logging,logging.handlers smtpHandler = logging.handlers.SMTPHandler(mailhost=(smtp.example.com,25), fromaddr=t...@example.com, toaddrs=t...@example.com, subject=uerror message) LOG = logging.getLogger() LOG.addHandler(smtpHandler) LOG.error(usans accent) LOG.error(uaccentu\u00E9) gives : UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 117: ordinal not in range(128) Thank you ! -- http://mail.python.org/mailman/listinfo/python-list
Re: SMTPHandler and Unicode
On 5 juil, 13:17, Chris Withers ch...@simplistix.co.uk wrote: try MailingLogger: If you have unicode problems with that, I'd be interested in fixing them! Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger import MailingLogger mailingLogger = MailingLogger(mailhost=('smtp.example.com', 25),fromaddr='t...@example.com',toaddrs=('t...@example.com',)) LOG = logging.getLogger() LOG.addHandler(mailingLogger) LOG.error(usans accent) LOG.error(uaccentu\u00E9) -- UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 7: ordinal not in range(128) -- http://mail.python.org/mailman/listinfo/python-list
Re: SMTPHandler and Unicode
On 5 juil, 14:32, Chris Withers ch...@simplistix.co.uk wrote: norbert wrote: Your package has the same unicode problem : import logging,logging.handlers from mailinglogger.MailingLogger import MailingLogger mailingLogger = MailingLogger(mailhost=('smtp.example.com', 25),fromaddr='t...@example.com',toaddrs=('t...@example.com',)) LOG = logging.getLogger() LOG.addHandler(mailingLogger) LOG.error(usans accent) LOG.error(uaccentu\u00E9) -- UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 7: ordinal not in range(128) Interesting, I don't know what the logging framework's position is on unicode... What happens when you try the same logging with just a FileHandler registered? What encoding does the log file use? a FileHandler works as expected, the log file being UTF-8 encoded. The SMTPHandler is the only logger I know with this problem, maybe connected to SMTPLib implementation ? -- http://mail.python.org/mailman/listinfo/python-list
Re: SMTPHandler and Unicode
Ouch. Implicit encoding sounds like a bad behaviour. Looking at the FileHandler source ( http://svn.python.org/view/python/trunk/Lib/logging/__init__.py?view=markup ) : the utf-8 encoding is a fallback. But *FileHandler family let you specify the encoding you want, so that's OK I think. But SMTPHandler does not have such a thing it sends its email with : msg = From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s % ( self.fromaddr, ,.join(self.toaddrs), self.getSubject(record), formatdate(), msg) ... smtp.sendmail(from,to,msg) And there is no encoding in all this. It seems pretty dangerous to me (so my first post) because your application will work without any problem with a FileHandler and the day you'll decide to send email in case of serious problem, it will crash with a UnicodeError. I can't see any workaround, except by subclassing SMTPHandler's emit method to be unicode-aware or at least URF-8 aware. -- http://mail.python.org/mailman/listinfo/python-list
Hint :Easy_Install Documentation
Hello list, just in the moment I wanted to write about then lacking documentation about Easy_Install, but then I found this one : http://www-128.ibm.com/developerworks/library/l-cppeak3.html. Just for google. HTH Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: python.org not current
On 8 Dez., 08:40, Fredrik Lundh [EMAIL PROTECTED] wrote: Norbert wrote: the python websitehttp://www.python.org/mentions Version 2.3.6 and 2.4.4 on the most prominent place. Shouldn't this be changed to 2.5.x ?you're looking at the news section: the 2.3.6 and 2.4.4 maintenance releases were made after 2.5 was released. Did not notice that, maybe a subheding would be in order ? /F Norbert -- http://mail.python.org/mailman/listinfo/python-list
python.org not current
Hello all, the python website http://www.python.org/ mentions Version 2.3.6 and 2.4.4 on the most prominent place. Shouldn't this be changed to 2.5.x ? Regards Norbert -- http://mail.python.org/mailman/listinfo/python-list
EasyInstall under Windows - strange behaviour
Hello all, i try to install ZSI under python 2.5 and windows 2000. I Downloaded the egg and tried the following c:\Python25\Scriptseasy_install.exe c:\download\ZSI-2.0_rc3-py2.5.egg The result is that pythonwin pops up and shows the file : c:\Python25\Scripts\easy_install-script.py : !C:\Python25\Lib\site-packages\pythonwin\Pythonwin.exe # EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==0.6c3','console_scripts','easy_install' __requires__ = 'setuptools==0.6c3' import sys from pkg_resources import load_entry_point sys.exit( load_entry_point('setuptools==0.6c3', 'console_scripts', 'easy_install')() ) What is going on here ? I presume that there are some trivial things I don't understand, can someone provide apointer or hint ? Thank you for your time ! Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: EasyInstall under Windows - strange behaviour
[EMAIL PROTECTED] schrieb: I'm no expert, but it sounds like you associated the .py file extension with the pythonwin program, so that's what's being used to open it (instead of the desired python.exe). See http://support.microsoft.com/kb/320033 for more information. hth, Don Thank you for the tip, but I checked this and this is not the case. I presume that I missed a step in the ez_setup process. Thanks again Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: small python cgi webserver
Fabian Braennstroem wrote: [...] In your response (cgi-script) you have to divide the header from the content '\r\n\r\n'. I am not sure, what that means!? ... but it works :-) We are talking about HTTP, take a look at the HTTP response in version 1.1: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6 As you may see you separate the header of a response from the body by an empty line, generated with CRLF. Since one CRLF ends the line inside the header you need two of them. Bye Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: small python cgi webserver
Fabian Braennstroem wrote: [...] Maybe, I understood something wrong, but I thought that the above 'webserver' script would replace apache in my case; at least I hoped!? It does. The 'ServerRoot' and 'DocumentRoot' directories are the directories you are starting your webserver in. Create a 'cgi' directory inside this and consider that you have to name it in the serverscript in relation to the serverroot! quote cgi_directories=[/home/fab/Desktop/cgi-bin] /quote This means you have to start your server inside directory '/'. If you start your server in your home dir '/home/fab' then you have to name your cgi_directories ['/Desktop/cgi-bin']. In your response (cgi-script) you have to divide the header from the content '\r\n\r\n'. HTH Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: How do you practice Python?
Ray wrote: [...] Um, I mean, what if you have to use something other than Python/Jython/IronPython? :) How do you keep your Python skill sharp? You could use IPython as your primary shell. Than you have the opportunity to do all these nasty automation tasks -- create test data, deploy configuration files, search in logfiles for errors, etc. -- for your project in Python. Convince your project manager to develop prototypes. No one in your company is better and faster in prototyping than the Python expert Ray. HTH Norbert -- It is easier to get forgiveness than permission. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pywin32: How to import data into Excel?
Simon Brunning wrote: On 08/11/05, Dmytro Lesnyak [EMAIL PROTECTED] wrote: I need to import some big data into Excel from my Python script. I have TXT file (~7,5 Mb). Have you considered converting your text data to CSV format? Excel opens CSV files happily enough, and you could always automate save-as-workbook and any formatting you need afterwards. But there are thorny issues with different locales and number formats. Excel is also just too clever in recognising dates All the best Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: Formated String in optparse
Thank You for your help, its working! Now I have an additional question. The problem is the encoding of the Text I'm using German, Can you tell me how to encode the textstring that the Windows commandline shows the special letters right? For exampel i get 'f³r' but i want 'für' (maybe reader with only an english enabled browser wouldn't see a difference..) I tried to work with the encode method of string but It didn't work for me some hint what to do? Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading Problem
Thanks a lot, Steve, for your fast reply. But the behaviour is the same if 'threadfunction' sleeps longer than just 1 second. 'threadfunction' is of course a dummy to show the problem, imagine a longrunning background-task. If you are right, the question remains 'How can I assure that the starting function finishes, while the other thread still runs ?' . As I said, this is the purpose of threading. Thanks again Norbert -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading Problem
Thanks Alan, i hoped it would be something trivial :) Norbert -- http://mail.python.org/mailman/listinfo/python-list