[issue46960] Docs: Link from settrace to frame
New submission from Thomas Guettler : https://docs.python.org/3.10/library/sys.html#sys.settrace > Trace functions should have three arguments: frame, event, and arg. frame is > the current stack frame. It would be super cool, if "current stack frame" could be a hyperlink to the docs about "frame". -- messages: 414761 nosy: guettli priority: normal severity: normal status: open title: Docs: Link from settrace to frame ___ Python tracker <https://bugs.python.org/issue46960> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44684] Docs for mock.call
New submission from Thomas Guettler : The docs for `mock.call` could get improved: https://docs.python.org/3/library/unittest.mock.html#call Up to now it is not clear how to access individual members of the call. Example: I want to check if the call used the kwarg "foo" with the value of "bar". Usually you don't need this, since you check for the whole call (all args and all kwargs). But sometimes you jus twant to check for a single arg/kwarg. Then it would be nice to have more detailed docs for the class "call". BTW: Why has this class a lower-case name? Looks a bit strange. -- assignee: docs@python components: Documentation messages: 397874 nosy: docs@python, guettli priority: normal severity: normal status: open title: Docs for mock.call versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue44684> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue41755] Docs: Please remove `from distutils.core import setup`
New submission from Thomas Guettler : Please remove this page or at least the code snippet containing `from distutils.core import setup` on this page: https://docs.python.org/3/distutils/setupscript.html There is the more up to date doc here: https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py Quoting Zen o Py: There should be one-- and preferably only one --obvious way to do it. Thank you very much! -- messages: 376695 nosy: guettli priority: normal severity: normal status: open title: Docs: Please remove `from distutils.core import setup` ___ Python tracker <https://bugs.python.org/issue41755> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35275] Reading umask (thread-safe)
New submission from Thomas Guettler : Up to now there is no thread way to read the umask in Python https://stackoverflow.com/questions/53227072/reading-umask-thread-safe You can use this pattern: current_umask = os.umask(0) # line1 os.umask(current_umask) # line2 return current_umask A thread which executes between line1 and line2 will have a different umask. I would be great, if the python standard library would provide correspondig thread safe method. Related question at stackoverflow: https://stackoverflow.com/questions/53227072/reading-umask-thread-safe -- messages: 330083 nosy: guettli priority: normal severity: normal status: open title: Reading umask (thread-safe) ___ Python tracker <https://bugs.python.org/issue35275> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30948] Docs for __subclasses__(): Add hint that Python imports are lazy
New submission from Thomas Guettler: AFAIK cls.__subclasses__() only returns the classes which the interpreter has already loaded. This means there can be more subclasses in modules where not imported by the current interpreter up to now. https://docs.python.org/3.7/library/stdtypes.html?highlight=subclasses#class.__subclasses__ I think it would be nice to add a hint to the docs that python imports are lazy. What do you think? -- messages: 298527 nosy: guettli priority: normal severity: normal status: open title: Docs for __subclasses__(): Add hint that Python imports are lazy ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30948> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29612] TarFile.extract() suffers from hard links inside tarball
Thomas Guettler added the comment: I have the same issue on Python 2.7.12 (Ubuntu 16.04) I tried to execute tartest.py. But I could not find a way how to create the tar which is needed for tartest.py. -- nosy: +guettli ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29612> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26869] unittest longMessage docs
Thomas Guettler added the comment: @Mariatta thank you very much. This update makes the docs easy to read and understand. Thank you :-) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26869> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26869] unittest longMessage docs
Thomas Guettler added the comment: Thank you for understanding my concern. > The standard failure message for each *assert method* contains useful > information about the objects involved. For example the message from > assertEqual shows the repr of the two unequal objects. It is usually > easier to augment rather than replace this message I think above is not needed. > The class setting can be overridden in individual test methods by > assigning an instance attribute, self.longMessage, to True or False > before calling the assert methods. I would add "the default value of the class gets reset before each test call". That is more explicit (I hope my text is what happens behind the scene) Again, thank you, that you care. Regards, Thomas Güttler -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26869> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26869] unittest longMessage docs
New submission from Thomas Guettler: The first message of the longMessage docs is confusing: https://docs.python.org/3/library/unittest.html#unittest.TestCase.longMessage > If set to True then This reads between the lines, that the default is False. But that was long ago in Python2. In Python3 the default is True (which I prefer to the old default). I think the docs should be like. And the term "normal message" is not defined. For new comers the "normal message" is what I get if you don't change the default, not the behaviour of the Python2 version :-) I think "normal message" should be replaced with "short message" or "diff message" .. I am unsure. What do you think? -- assignee: docs@python components: Documentation messages: 264359 nosy: docs@python, guettli priority: normal severity: normal status: open title: unittest longMessage docs versions: Python 3.6 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26869> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26817] Docs for StringIO should link to io.BytesIO
New submission from Thomas Guettler: I think a warning at the top of StringIO docs is needed. And it should link to io.BytesIO. Maybe even deprecate StringIO and cStringIO in Python2? StringIO docs: https://docs.python.org/2/library/stringio.html io.BytesIO docs: https://docs.python.org/2/library/io.html#io.BytesIO I would like to see this at the top of StringIO: {{{ Please use io.BytesIO and io.StringIO since this module is not supported in Python3 }} -- assignee: docs@python components: Documentation messages: 263917 nosy: docs@python, guettli priority: normal severity: normal status: open title: Docs for StringIO should link to io.BytesIO versions: Python 2.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26817> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25017] htmllib deprecated: Which library to use? Missing sane default in docs
New submission from Thomas Guettler: At the top of the htmllib module: > Deprecated since version 2.6: The htmllib module has been removed in > Python 3. Source: https://docs.python.org/2/library/htmllib.html#module-htmllib Newcomers need more advice: Which library should be used? I know there are many html parsing libraries. But there should be a sane default for newcomers. Is there already an agreement of a sane default html parsing library? -- assignee: docs@python components: Documentation messages: 250088 nosy: docs@python, guettli priority: normal severity: normal status: open title: htmllib deprecated: Which library to use? Missing sane default in docs ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25017> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25017] htmllib deprecated: Which library to use? Missing sane default in docs
Thomas Guettler added the comment: This issue is just about documentation. No code change is required for it. How to update the docs, to point to html.parser? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25017> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24941] classproperty
New submission from Thomas Guettler: Quoting Guido van Rossum Aug 20 2015. Thread Properties for classes possible? https://mail.python.org/pipermail/python-ideas/2015-August/035354.html {{{ think it's reasonable to propose @classproperty as a patch to CPython. It needs to be C code. Not sure about the writable version. The lazy=True part is not appropriate for th he stdlib (it's just a memoize pattern). }}} The solution I use at the moment: {{{ # From http://stackoverflow.com/a/5192374/633961 class classproperty(object): def __init__(self, f): self.f = f def __get__(self, obj, owner): return self.f(owner) }}} According to Terry Jan Reedy the next step is to find someone to translate this to C. Sorry, my C knowledge is limited. Can anybody help? -- messages: 249182 nosy: guettli priority: normal severity: normal status: open title: classproperty ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24941 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24259] tar.extractall() does not recognize unexpected EOF
Thomas Guettler added the comment: With Python 3.4.0 you get an OSError if you try to extractall() the uploaded tar_which_is_cut.tar. That's nice. Seems like only 2.7 seems to be buggy. === python3 Python 3.4.0 (default, Apr 11 2014, 13:05:11) [GCC 4.8.2] on linux Type help, copyright, credits or license for more information. import tarfile tarfile.TarFile('tar_which_is_cut.tar').extractall() Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.4/tarfile.py, line 1979, in extractall self.extract(tarinfo, path, set_attrs=not tarinfo.isdir()) File /usr/lib/python3.4/tarfile.py, line 2018, in extract set_attrs=set_attrs) File /usr/lib/python3.4/tarfile.py, line 2087, in _extract_member self.makefile(tarinfo, targetpath) File /usr/lib/python3.4/tarfile.py, line 2133, in makefile copyfileobj(source, target, tarinfo.size) File /usr/lib/python3.4/tarfile.py, line 247, in copyfileobj raise OSError(end of file reached) OSError: end of file reached -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24259 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24259] tar.extractall() does not recognize unexpected EOF
Thomas Guettler added the comment: I thought about this again. It could be solved with the help of a ByteCountingStreamReader. With ByteCountingStreamReader I mean a wrapper around a stream like codescs.StreamReader. But the ByteCountingStreamReader should not changes the content, but just count the bytes it passed. The ByteCountingStreamReader would be wrapped around ExFileObject. This class could be handy in other situations. What do you think? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24259 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24259] tar.extractall() does not recognize unexpected EOF
Thomas Guettler added the comment: Who has enough knowledge of the tarfile module to create a good patch? -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24259 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23625] load_module() docs: zipped eggs are not loaded.
Thomas Guettler added the comment: The docs should be where new users look. I don't speak about several hundret words Where do you think new users look for documentation if they want a method which does find a module? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23625 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23625] load_module() docs: zipped eggs are not loaded.
Thomas Guettler added the comment: In this case I am wearing newbee user glasses. And with this glasses on my nose, I don't care for implementation. I am confused that imp module does not work like import foo. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23625 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23625] load_module() docs: zipped eggs are not loaded.
Thomas Guettler added the comment: Dear Bret Cannon, I don't ask for egg support in the imp module. I don't want to change the implemenation of imp.find_module() I just want to update the docs. Most people run a python version which supports loading zipped eggs. Please reopened this, since I think you misunderstood me. If not, and you don't care about the docs. Leave it closed :-) -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23625 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18675] Daemon Threads can seg fault
Thomas Guettler added the comment: What kind of patch do you want? Documentation patch or fixing the bug in the interpreter? I am not a native speaker, that's why I avoid documentation patches. For me, the issue is solved. It is documented in stackoverflow and here. Since Python2 will be gone sooner or later, I don't want to invest hours into fixing this at interpreter level. Should I close the issue? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18675 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14102] argparse: add ability to create a man page
Changes by Thomas Guettler guet...@thomas-guettler.de: -- nosy: -guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14102 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21495] Sane default for logging config
Thomas Guettler added the comment: Just for the record. Here are the discussions about this topic on the python-ideas mailing list: https://mail.python.org/pipermail/python-ideas/2014-May/027839.html https://mail.python.org/pipermail/python-ideas/2014-May/027858.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21495 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21495] Sane default for logging config
New submission from Thomas Guettler: Imagine you write a small console script which is implemented like a library. This tool has to do two things: the console script needs to configure the logging, and the library needs to use it. The library usage of logging it easy well documented: {{{ logger=logging.getLogger(__name__) }}} But the part in the console script has no sane default in the python world. I know how to set up the logging config with BasicConfig, DictConfig, ... There needs to be something like DefaultConfig() which reads its config from well known places. This bug report is not about clever code solutions. It is about a sane and easy default agreement on how to load the logging configuration. -- messages: 218453 nosy: guettli priority: normal severity: normal status: open title: Sane default for logging config ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21495 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21495] Sane default for logging config
Thomas Guettler added the comment: Thank you for reading and replying. Yes, I wrote no concret proposal up to now. I have this solutions in mind: logging.config.defaultConfig() Related https://docs.python.org/2/library/logging.config.html Loading a python module: load a module loggingconfig this module gets imported like any other python module. It is like django loads its settings. It could be possible to check the environment variable LOGGINGCONFIG first. It could contain a string which defaults to loggingconfig. This module has a method set_up() which sets up the logging for this environment. Loading from a file: - A file searched in this places: - CWD/.loggingconfig.conf - VIRTUAL_ENV/.loggingconfig.conf - HOME/.loggingconfig.conf - etc/loggingconfig.conf The file gets loaded with fileConfig() Module or file config loading - I think the module loading is better than the file based solution. That's why I think it should be done first. If there is no module found, the file loading should be tried. If not config found If not config was found, default gets set. My proposal: - loglevel is set to INFO. (Debug gets suppressed) - format: '%(asctime)s %(name)s: %(levelname)-8s [%(process)d] %(message)s' - logging goes to stdout --- What is the best way to get this into the python standard library? Should I create a PEP? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21495 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20598] argparse docs: '7'.split() is confusing magic
New submission from Thomas Guettler: I think the docs of argparse still contain confusing magic: parser.parse_args('7'.split()) You know what it does and I know it. But a lot of people new to Python, don't understand what this should be. Please use: parser.parse_args(['7']) Close this ticket, if you don't care for people new to Python. -- assignee: docs@python components: Documentation messages: 210950 nosy: docs@python, guettli priority: normal severity: normal status: open title: argparse docs: '7'.split() is confusing magic versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20598 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5673] Add timeout option to subprocess.Popen
Thomas Guettler added the comment: For Python 2.x there is a backport of the subprocess module of 3.x: https://pypi.python.org/pypi/subprocess32. It has the timeout argument for call() and pipe.wait(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5673 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19039] sphinx search, result sorting
New submission from Thomas Guettler: If you search for printf in the docs you get this result: http://docs.python.org/3.3/search.html?q=printfcheck_keywords=yesarea=default Please have a look at the first results. I guess most people don't want to see docs about PyOS_snprintf Most people want to see this: http://docs.python.org/3.3/library/stdtypes.html?highlight=printf#printf-style-string-formatting The good page (stdtypes.html) is the fourth search result. And this page is huge. Unfortunately the link from the search result does not link to the section, it links to the top of the page. Since printf is in the heading, sphinx should be able to create a link to the relevant section in this page (in this example #printf-style-string-formatting). Thank you -- assignee: docs@python components: Documentation messages: 197963 nosy: docs@python, guettli priority: normal severity: normal status: open title: sphinx search, result sorting ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19039 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1596321] KeyError at exit after 'import threading' in other thread
Thomas Guettler added the comment: Only few people seem to use daemon threads. We do and see this problem often with Python 2.7. How difficult is it to get this fixed for 2.7? Is there a way to work around this problem? -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1596321 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1856] shutdown (exit) can hang or segfault with daemon threads running
Thomas Guettler added the comment: There are some examples to work around this for Python2: http://stackoverflow.com/questions/18098475/detect-interpreter-shut-down-in-daemon-thread -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1856 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18675] Daemon Threads can seg fault
New submission from Thomas Guettler: This is a documentation bug: Since #1856 is not solved for Python2, it needs to be documented. Daemon Threads on Python2 can seg fault. Work arounds: http://stackoverflow.com/questions/18098475/detect-interpreter-shut-down-in-daemon-thread -- assignee: docs@python components: Documentation messages: 194601 nosy: docs@python, guettli priority: normal severity: normal status: open title: Daemon Threads can seg fault versions: Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18675 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18336] codecs: Link to readline module (history) instead of fd.readline()
New submission from Thomas Guettler: The documentation of codecs.readline() has a link to the readline module. That the same word with a total different meaning! http://docs.python.org/2/library/codecs.html?highlight=readline#codecs.StreamReader.readline The GNU readline module is about the history like bash or interactive python. -- assignee: docs@python components: Documentation messages: 192111 nosy: docs@python, guettli priority: normal severity: normal status: open title: codecs: Link to readline module (history) instead of fd.readline() versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18336 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18337] codecs: StremReader readline() breaks on undocumented characters
New submission from Thomas Guettler: The stream reader of codecs.open() breaks on undocumented characters: http://docs.python.org/2/library/codecs.html?highlight=codecs%20readline#codecs.StreamReader.readline import tempfile temp=tempfile.mktemp() fd=open(temp, 'wb') fd.write('abc\ndef\x85ghi') fd.close() import codecs fd=codecs.open(temp, 'rb', 'latin1') while True: line=fd.readline() if not line: break print repr(line) Result: u'abc\n' u'def\x85' u'ghi' Related: http://stackoverflow.com/questions/16227114/utf-8-files-read-in-python-will-line-break-at-character-x85 -- assignee: docs@python components: Documentation messages: 192112 nosy: docs@python, guettli priority: normal severity: normal status: open title: codecs: StremReader readline() breaks on undocumented characters versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18337 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14102] argparse: add ability to create a man page
Changes by Thomas Guettler guet...@thomas-guettler.de: -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16933] argparse: remove magic from examples
New submission from Thomas Guettler: The current argparse documentation is not easy to read people new to python. http://docs.python.org/dev/library/argparse.html#choices {{{ current: parser.add_argument('foo', choices='abc') }}} Please make this more explicit: {{{ better: parser.add_argument('foo', choices=['one', 'two', 'three']) }}} {{{ current: parser.parse_args('c'.split()) # looks like perl to me }}} {{{ better: parser.parse_args(['c']) }}} Next: Please use a more common type, not complex in the choices example. It confuses a lot of people. -- messages: 179679 nosy: guettli priority: normal severity: normal status: open title: argparse: remove magic from examples ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16933 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
get date from email
Hi, up to now I use this code to parse date values from emails: msg=email.message_from_file(open(file_name)) date=None date_str=msg.get('date') if date_str: date_tuple=email.utils.parsedate_tz(date_str) if date_tuple: date=datetime.datetime.fromtimestamp(email.utils.mktime_tz(date_tuple)) if date: ... # valid date found Somehow this looks too complicated. Any chance to integrate the datetime module into the email module? related: http://stackoverflow.com/questions/1790795/python-parsing-date-with-timezone-from-an-email -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue13232] Logging: Unicode Error
Changes by Thomas Guettler guet...@thomas-guettler.de: Added file: http://bugs.python.org/file23486/unicodedecodeerror-in-logging.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13232 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13232] Logging: Unicode Error
Thomas Guettler guet...@thomas-guettler.de added the comment: I attached a testcase (unicodedecodeerror-in-logging.py). If the filesystemencoding is UTF-8 and the source code is encoded in latin1, then the logging fails. It happens because there is a German umlaut in the comment behind 1/0. I added 'replace' to the decode() in __init__.py and the it works. The German umlaut gets displayed as inverted question mark. But this is better than no logging message. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13232 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13232] Logging: Unicode Error
New submission from Thomas Guettler guet...@thomas-guettler.de: In changeset fe6be0426e0d the format() method was changed. Unfortunately it does not catch all unicode decode errors. I think line 482 of logging/__init__.py should be modified: to this (add 'replace'): s = s + record.exc_text.decode(sys.getfilesystemencoding(), 'replace') http://hg.python.org/cpython/file/f35514dfadf8/Lib/logging/__init__.py#l482 Here is the stacktrace we get: {{{ Traceback (most recent call last): File /usr/lib64/python2.7/logging/__init__.py, line 838, in emit msg = self.format(record) File /usr/lib64/python2.7/logging/__init__.py, line 715, in format return fmt.format(record) File /home/modbau_esg_p/djangotools/utils/logutils.py, line 32, in format msg=logging.Formatter.format(self, record) File /usr/lib64/python2.7/logging/__init__.py, line 482, in format s = s + record.exc_text.decode(sys.getfilesystemencoding()) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 662: ordinal not in range(128) Logged from file base.py, line 209 }}} -- components: Library (Lib) messages: 146018 nosy: guettli priority: normal severity: normal status: open title: Logging: Unicode Error versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13232 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: HeaderParseError
On 04.07.2011 13:20, Peter Otten wrote: Thomas Guettler wrote: On 04.07.2011 11:51, Peter Otten wrote: Thomas Guettler wrote: I get a HeaderParseError during decode_header(), but Thunderbird can display the name. from email.header import decode_header Hi, I created a ticket: http://bugs.python.org/issue12489 Thomas Güttler -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue12489] email.errors.HeaderParseError if base64url is used
Thomas Guettler guet...@thomas-guettler.de added the comment: I received this email. Here is the creator: X-Mailer: CommuniGate Pro MAPI Connector 1.52.53.10/1.53.10.1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
HeaderParseError
Hi, I get a HeaderParseError during decode_header(), but Thunderbird can display the name. from email.header import decode_header decode_header('=?iso-8859-1?B?QW5tZWxkdW5nIE5ldHphbnNjaGx1c3MgU_xkcmluZzNwLmpwZw==?=') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python2.6/email/header.py, line 101, in decode_header raise HeaderParseError email.errors.HeaderParseError How can I parse this in Python? Thomas Same question on Stackoverflow: http://stackoverflow.com/questions/6568596/headerparseerror-in-python -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: HeaderParseError
On 04.07.2011 11:51, Peter Otten wrote: Thomas Guettler wrote: I get a HeaderParseError during decode_header(), but Thunderbird can display the name. from email.header import decode_header decode_header('=?iso-8859-1?B?QW5tZWxkdW5nIE5ldHphbnNjaGx1c3MgU_xkcmluZzNwLmpwZw==?=') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python2.6/email/header.py, line 101, in decode_header raise HeaderParseError email.errors.HeaderParseError How can I parse this in Python? Trying to decode as much as possible: s = QW5tZWxkdW5nIE5ldHphbnNjaGx1c3MgU_xkcmluZzNwLmpwZw==?= for n in range(len(s), 0, -1): ... try: t = s[:n].decode(base64) ... except: pass ... else: break ... n, t (49, 'Anmeldung Netzanschluss S\x19\x1c\x9a[\x99\xcc\xdc\x0b\x9a\x9c\x19') print t.decode(iso-8859-1) Anmeldung Netzanschluss S[ÌÜ s[n:] 'w==?=' The characters after ...Netzanschluss look like garbage. What does Thunderbird display? Hi Peter, Thunderbird shows this: Anmeldung Netzanschluss Südring3p.jpg Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue12489] email.errors.HeaderParseError if base64url is used
New submission from Thomas Guettler guet...@thomas-guettler.de: from email.header import decode_header decode_header('=?iso-8859-1?B?QW5tZWxkdW5nIE5ldHphbnNjaGx1c3MgU_xkcmluZzNwLmpwZw==?=') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib64/python2.6/email/header.py, line 101, in decode_header raise HeaderParseError email.errors.HeaderParseError thunderbird is able to decode the header: Anmeldung Netzanschluss Südring3p.jpg According to Peter Otten base64url encoding was used: My question in the newsgroup: http://groups.google.com/group/comp.lang.python/browse_thread/thread/9cf9ccd4109481cc/9f76bd627676b5f1?show_docid=9f76bd627676b5f1 -- components: Library (Lib) messages: 139776 nosy: guettli priority: normal severity: normal status: open title: email.errors.HeaderParseError if base64url is used versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12489] email.errors.HeaderParseError if base64url is used
Thomas Guettler guet...@thomas-guettler.de added the comment: This happens on Python3: root@ubuntu1004devel64:~# python3 Python 3.1.2 (r312:79147, Sep 27 2010, 09:57:50) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. from email.header import decode_header decode_header('=?iso-8859-1?B?QW5tZWxkdW5nIE5ldHphbnNjaGx1c3MgU_xkcmluZzNwLmpwZw==?=') Traceback (most recent call last): File /usr/lib/python3.1/email/header.py, line 98, in decode_header word = email.base64mime.decode(encoded_string) File /usr/lib/python3.1/email/base64mime.py, line 112, in decode return a2b_base64(string.encode('raw-unicode-escape')) binascii.Error: Incorrect padding During handling of the above exception, another exception occurred: Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.1/email/header.py, line 100, in decode_header raise HeaderParseError('Base64 decoding error') email.errors.HeaderParseError: Base64 decoding error -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12489 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: Is the Usenet to mailing list gateway borked?
On 30.06.2011 03:24, Thomas 'PointedEars' Lahn wrote: Andrew Berg wrote: […] As for your question in the Subject, I do not know since I am reading the newsgroup. Therefore, however, I can tell you that the mailing list to Usenet gateway is seriously borked, as missing References header fields are not generated by the gateway. As a result, there are few if any threads left in the newsgroup, which makes it an increasing PITA to read. (And no, threading by Subject is a stupid idea.) Would someone responsible *please* fix this? I am willing to provide assistance, see also my suggestion in news:5337093.9j7nak4...@pointedears.de. Hi, Who is responsible? I think in the past there were not many broken threads. I wonder what changed this. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
coverage.py: Highlight hot spots in source code
Hi, I just used coverage.py for the first time, and like it very much. Is it possible to display how many times a line was executed? I want to see lines which are executed very often red and lines which are executed not often green. I know there are other tools like hotshot, but AFAIK they don't have a nice HTML output for every python source file. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: best book about Webdesign with Django
On 08.06.2011 12:29, News123 wrote: Hi, Do you have any recommendations for a good book about Web design with Django? You can do web design with HTML, CSS and Javascript. There are a lot of books about this. Django is a good web framework. It does not care much about CSS and Javascript. I guess you need buy two books :-) Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue11465] Set documentation: Link to wikipedia
New submission from Thomas Guettler guet...@thomas-guettler.de: A link from http://docs.python.org/library/stdtypes.html#set.union to http://en.wikipedia.org/wiki/Union_%28set_theory%29 would help young people to understand sets. Of course it is the same for intersection(), difference(), and symmetric_difference(). The images of the wikipedia article explain it very good. -- assignee: docs@python components: Documentation messages: 130555 nosy: docs@python, guettli priority: normal severity: normal status: open title: Set documentation: Link to wikipedia versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11465 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
hashlib in one line
Hi, I think it would be nice if you could use the hashlib in one line: hashlib.sha256().update('abc').hexdigest() Unfortunately update() returns None. Is there a way to convert a string to the hexdigest of sha256 in one line? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: hashlib in one line
Thank you, I was blind: See condensed: http://docs.python.org/library/hashlib.html Stefan Sonnenberg-Carstens wrote: Am 29.11.2010 14:50, schrieb Thomas Guettler: Hi, I think it would be nice if you could use the hashlib in one line: hashlib.sha256().update('abc').hexdigest() Unfortunately update() returns None. Is there a way to convert a string to the hexdigest of sha256 in one line? Thomas Like so ? hashlib.sha256('abc').hexdigest() 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue10151] Docs: can globals() be updated?
New submission from Thomas Guettler guet...@thomas-guettler.de: Hi, the documentation of globals() is missing a note if you can update the dictionary: http://docs.python.org/library/functions.html?highlight=globals#globals For locals() it is documented: http://docs.python.org/library/functions.html?highlight=locals#locals -- assignee: d...@python components: Documentation messages: 119192 nosy: d...@python, guettli priority: normal severity: normal status: open title: Docs: can globals() be updated? versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10151 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10004] email/quoprimime.py Exception (with patch)
New submission from Thomas Guettler guet...@thomas-guettler.de: I get the following traceback. I created a patch against email/quoprimime.py from SVN branch python2.7 File /usr/lib64/python2.6/email/header.py, line 93, in decode_header dec = email.quoprimime.header_decode(encoded) File /usr/lib64/python2.6/email/quoprimime.py, line 336, in header_decode return re.sub(r'=\w{2}', _unquote_match, s) File /usr/lib64/python2.6/re.py, line 150, in sub return _compile(pattern, 0).sub(repl, string, count) File /usr/lib64/python2.6/email/quoprimime.py, line 324, in _unquote_match return unquote(s) File /usr/lib64/python2.6/email/quoprimime.py, line 106, in unquote return chr(int(s[1:3], 16)) ValueError: invalid literal for int() with base 16: 'ih' -- components: Library (Lib) files: quoprimime.py.diff keywords: patch messages: 117784 nosy: guettli priority: normal severity: normal status: open title: email/quoprimime.py Exception (with patch) versions: Python 2.7 Added file: http://bugs.python.org/file19080/quoprimime.py.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10004 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10004] email/quoprimime.py Exception (with patch)
Changes by Thomas Guettler guet...@thomas-guettler.de: Added file: http://bugs.python.org/file19081/broken-subject.msg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10004 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1982] Feature: extend strftime to accept milliseconds
Thomas Guettler guet...@thomas-guettler.de added the comment: Yes, I think this can be closed, too. -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1982 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9427] logging.error('...', exc_info=True) should display upper frames, too
Thomas Guettler guet...@thomas-guettler.de added the comment: Until exc_info=True prints the current stack, I use this pattern: import traceback logging.error(u's...\nStack: %s' % ( ''.join(traceback.format_stack())), exc_info=True) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9427 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1553375] Add traceback.print_full_exception()
Changes by Thomas Guettler guet...@thomas-guettler.de: -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1553375 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1553375] Add traceback.print_full_exception()
Thomas Guettler guet...@thomas-guettler.de added the comment: It would be very nice if logging.info('...', exc_info=True) shows the calling/upper frames, too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1553375 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9427] logging.error('...', exc_info=True) should display upper frames, too
New submission from Thomas Guettler guet...@thomas-guettler.de: logging.error('...', exc_info=True) only displays the frames downward. But I often need the upper frames, to debug a problem. This example shows, that you don't see the upper frame in the stactrace. But that's information is important. pre import logging def foo(): try: raise Exception() except Exception, exc: logging.error('Exception occured: %s' % exc, exc_info=True) def upper(): foo() upper() /pre pre === python tmp/t.py ERROR:root:Exception occured: Traceback (most recent call last): File tmp/t.py, line 6, in foo raise Exception() Exception /pre -- components: Library (Lib) messages: 112063 nosy: guettli priority: normal severity: normal status: open title: logging.error('...', exc_info=True) should display upper frames, too versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9427 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9427] logging.error('...', exc_info=True) should display upper frames, too
Thomas Guettler guet...@thomas-guettler.de added the comment: Related: #1553375 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9427 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1553375] Add traceback.print_full_exception()
Thomas Guettler guet...@thomas-guettler.de added the comment: Related #9427 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1553375 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9427] logging.error('...', exc_info=True) should display upper frames, too
Thomas Guettler guet...@thomas-guettler.de added the comment: I tested it only on python 2.6. Can someone please look at more reset versions? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9427 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: non-blocking IO EAGAIN on write
John Nagle wrote: On 7/23/2010 1:45 AM, Thomas Guettler wrote: Hi, I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource temporarily unavailable) on write(). My working code looks like this. But I am unsure how many bytes have been written to the pipe if I get an EAGAIN IOError. Since your code isn't doing anything else while waiting for a write to complete on the pipe, why use non-blocking I/O at all? (I know, the Python I/O timeout logic is broken in some versions. You're probably working around that.) I want to handle timeouts. The app runs on linux, but I don't want to use signals, since it is in a wsgi context: http://code.google.com/p/modwsgi/wiki/ApplicationIssues .. As a general rule therefore, no WSGI application component should attempt to register its own signal handlers. The hint of Kushal was right: The timeout was reached, and I didn't check the result of the select call. -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
non-blocking IO EAGAIN on write
Hi, I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource temporarily unavailable) on write(). My working code looks like this. But I am unsure how many bytes have been written to the pipe if I get an EAGAIN IOError. Up to now I retry with the same chunk. If I get EAGAIN can I just sleep, and then retry with the same data chunk? pipe=subprocess.Popen(cmd, stdin=subprocess.PIPE, bufsize=-1) fcntl.fcntl(pipe.stdin, fcntl.F_SETFL, os.O_NONBLOCK) chunk_size=1024 while select.select([], [pipe.stdin], [], 5): check_timeout() chunk=fd.read(chunk_size) for i_eagain in range(10): try: pipe.stdin.write(chunk) except IOError, exc: if exc.errno==errno.EAGAIN: logging.info('write to pipe %s EAGAIN. I will try again i=%s. %s' % (cmd, i_eagain, exc)) time.sleep(.3) continue logging.error('write to pipe %s failed: %s' % (cmd, exc), exc_info=True) raise break # write was successful (default) else: raise Exception('Too many EAGAIN on write %s %s' % (cmd, exc), exc_info=True) Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Imports again...
Hi, please post your traceback. I guess you have a recursive import. This can lead to strange exceptions (for example AttributeError) Thomas Alex Hall wrote: Hello all, once again: http://www.gateway2somewhere.com/sw/sw.zip The above link is to a project. I am new to using multiple files in Python, and I have a lot of tangled imports where many files in the same folder are importing each other. When I tried to follow the manual to make some files into packages, it did not work. Can anyone explain why I am getting an import error in the above project, and/or how I can clean up the file structure and imports to avoid problems like this in the future? Thanks in advance for any help, and I apologize for the broken link the other day. -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
crypto: verify external pkcs7 signature
Hi, some black box system gives me secKey.pkcs7 signature and a data file. The signature should be correct, but it fails. On newer system I get this: M2Crypto.SMIME.PKCS7_Error: digest failure on older systems (openssl-0.9.8h-28.10.1) I get PKCS7 routines:PKCS7_verify:signature failure:pk7_smime.c:312 On a system with openssl-0.9.8e-45.13 the script creates a core dump. Any hints? {{{ def verify(file): s = SMIME.SMIME() cert_file='CN=NW4.cert' x509=X509.load_cert(cert_file) sk=X509.X509_Stack() sk.push(x509) s.set_x509_stack(sk) # Load the signer's CA cert. In this case, because the signer's # cert is self-signed, it is the signer's cert itself. st = X509.X509_Store() st.load_info(cert_file) # CA Cert s.set_x509_store(st) from M2Crypto.BIO import File # Load the data, verify it. p7=SMIME.load_pkcs7('secKey.pkcs7') try: print s.verify(p7, File(open(file))) except (M2Crypto.SMIME.PKCS7_Error, M2Crypto.SMIME.SMIME_Error), exc: print '%s failed: %s' % (file, str(exc).strip()) return False return True }}} -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Parsing Email Headers
T wrote: Thanks for your suggestions! Here's what seems to be working - it's basically the same thing I originally had, but first checks to see if the line is blank response, lines, bytes = M.retr(i+1) # For each line in message for line in lines: if not line.strip(): M.dele(i+1) break emailMessage = email.message_from_string(line) # Get fields fields = emailMessage.keys() # If email contains From field if emailMessage.has_key(From): # Get contents of From field from_field = emailMessage.__getitem__(From) Hi T, wait, this code looks strange. You delete the email if it contains an empty line? I use something like this: message='\n'.join(connection.retr(msg_num)[1]) Your code: emailMessage = email.message_from_string(line) create an email object from only *one* line! You retrieve the whole message (you don't save bandwith), but maybe that's what you want. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: os.rename [Errno 31] Too many links
Richard wrote: I want to atomically write to a file so have been using temporary files and renaming: temp = tempfile.NamedTemporaryFile(delete=False) temp.file.write(data) temp.file.close() os.rename(temp.name, output_file) This worked but after 39567 files os.rename raises an OSError: [Errno 31] Too many links I can still create files in this directory so I doubt it is a platform limitation. Can you tell what is wrong? Am I not freeing the temporary file resources properly? If you are on linux you can have a look at the open file descriptors of a running process like this: ls -l /proc/PID/fd/ But I guess it is a limitation of your filesystem. What do you use? I once had this problem with ext2. It has a low limit for subdirectories. With xfs the limits are much greater. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue5115] Extend subprocess.kill to be able to kill process groups
Changes by Thomas Guettler guet...@thomas-guettler.de: -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5115 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
SMTPException: No suitable authentication method found (Server: Microsoft ESMTP MAIL Service)
Hi, I try to login, but I get this exception: File /home/foo/django/core/mail.py, line 137, in open self.connection.login(self.username, self.password) File /home/foo/smtplib.py, line 587, in login raise SMTPException(No suitable authentication method found.) Trace from tcpdump+wireshark 220 remote.example.com Microsoft ESMTP MAIL Service ready at Thu, 14 Jan 2010 17:20:38 +0100 client: ehlo foo.example.com 250-remote.example.com Hello [127] 250-SIZE 10485760 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-AUTH 250-8BITMIME 250-BINARYMIME 250 CHUNKING The same happens if I use TLS. Any hints? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue1100942] Add datetime.time.strptime and datetime.date.strptime
Changes by Thomas Guettler guet...@thomas-guettler.de: -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1100942 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
'classmethod' object has only read-only attributes
Hi, why have classmethods only readonly attributes? It works for other methods. exmpale code: {{{ class Foo(object): @classmethod def bar(cls): pass bar.myattr='test' }}} u...@host:~ python ~/tmp/t.py Traceback (most recent call last): File /home/user/tmp/t.py, line 1, in module class Foo(object): File /home/user/tmp/t.py, line 5, in Foo bar.myattr='test' TypeError: 'classmethod' object has only read-only attributes (assign to .myattr) -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue5673] Add timeout option to subprocess.Popen
Changes by Thomas Guettler guet...@thomas-guettler.de: -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5673 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3244] multipart/form-data encoding
Changes by Thomas Guettler guet...@thomas-guettler.de: -- nosy: +guettli ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: PyGTK problems after Linux update...
Looks like your pygtk package does not fit to the installed python package. from glib._glib import * ImportError: /usr/lib/python2.6/site-packages/gtk-2.0/glib/_glib.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8 -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: best way to display photos
Some years ago I had the same problem. I wrote a simple app with pygtk. You get get it from here: http://guettli.sourceforge.net/gthumpy/src/README.html The next pictures get loaded in background. Switching from one image to the next is faster then in some other apps. But somehow it is not ready for the public. I guess I am the only one who uses it. Flags are symlinks in the home directory .local/share/app/gthumpy. This means you should not move your images, otherwise the flags get lost. I don't think it will work on ms-windows, but it could be ported. Or you use mirage: http://mirageiv.berlios.de/index.html It is a pygtk image viewer. You can define shortcuts that execute user defined commands. Thomas samwyse schrieb: I have several thousand photographs that I need to quickly classify, all by myself. After extensive searches, I have been unable to find anything to my liking, so desire to write something myself. I'm thinking about displaying a photo and waiting for keystrokes to tag it; 'i' for interior, 'e' for exterior, etc., while hitting space or enter will advance to the next photo. My big question is, what's the best way to display the photos. I've used PIL in the past, but IIRC it uses an external program. Pygame is the next obvious choice, but like PIL it requires an add-in. That leaves Tkinter. Has anyone used it to display .JPG files, perhaps with rescaling to fit my screen? How is its performance? Is there any other possibilities that I've missed? Thanks. -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: os.popen output different from native shell output
hi, you get the popen output like this: u...@unixhost ls | cat nickname schrieb: Hi all, I am a relative newbie to python, I am using os.popen to run an ls command. The output that I get using the read() function is different in look and feel from when I run the ls command natively from the shell (not via python). I display the ouput via python by using the print function on the variable that accepts the os.popen ().read() function. ... Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: os.popen output different from native shell output
In one of the first chapters of Advanced programming in the unix environment (second edition) there is explained how a unix shell works. You could write you own shell using python. This way the python interpreter gets stared only once, and not for every call to ls. Have fun, Thomas nickname schrieb: wow guys! thanks for all the great leads! this is awesome! The reason why I want to do this is because I am going to do a little project. I will write a python script called ls which will log the time and username and then will show the actual ls output. I want this to be transparent and so want to throw the ls output (via python) exactly as it will be in native shell execution. -- http://mail.python.org/mailman/listinfo/python-list
Re: Workflow Libraries (DB vs Code)
Diez B. Roggisch schrieb: Thomas Guettler wrote: Hi, I need to write some simple workflows with web interface. For the web stuff I will use django, but I am not sure how to do the workflow part. Did you consider using OpenERP? It comes with a web-frontend (TG1.0.8-based), but also offers a XMLRPC-server to connect to, so using it from within django shouldn't be any difficult. Workflow-definitions are stored in the DB, and can be generated visually, not sure if they have to though. Thank you for this hint. OpenERP seems well done. But the licence is GPL and the dependency is too big. But I will have a look at how they did it. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Mutable Strings - Any libraries that offer this?
casebash schrieb: Hi, I have searched this list and found out that Python doesn't have a mutable string class (it had an inefficient one, but this was removed in 3.0). Are there any libraries outside the core that offer this? Hi, you could use a list of characters. It would not be difficult to implement this as a class with all fancy methods like startswith() ... Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Workflow Libraries (DB vs Code)
Hi, I need to write some simple workflows with web interface. For the web stuff I will use django, but I am not sure how to do the workflow part. Here are ideas: Do it myself. I don't think it will be difficult, I did things like this before. But they were not reusable. Use spiff Workflow library http://code.google.com/p/spiff-workflow/ Use goflow for django (port of OpenFlow of Zope). It does not look like a active project. Has anyone worked with spiff, goflow or other workflow software? What do you like and dislike? Somehow I like it the way goflow does it: The process definitions are stored in the database. But on the other hand I prefer to have things like this in a SVN-Repository. Creating the workflow definitions will be done by python programmers. I don't need a GUI to build them. There are many languages to define processes (BPML, XPDL, BPEL or YAWL). But I prefer python. Feedback welcome, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: logging of strings with broken encoding
Stefan Behnel schrieb: Thomas Guettler wrote: My quick fix is this: class MyFormatter(logging.Formatter): def format(self, record): msg=logging.Formatter.format(self, record) if isinstance(msg, str): msg=msg.decode('utf8', 'replace') return msg But I still think handling of non-ascii byte strings should be better. A broken logging message is better than none. Erm, may I note that this is not a problem in the logging library but in the code that uses it? I know that my code passes the broken string to the logging module. But maybe I get the non-ascii byte string from a third party (psycopg2 sometime passes latin1 byte strings from postgres in error messages). I like Python very much because it refused to guess. But in this case, best effort is a better approach. It worked in 2.5 and will in py3k. I think it is a bug, that it does not in 2.6. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
logging of strings with broken encoding
Hi, I have bug in my code, which results in the same error has this one: https://bugs.launchpad.net/bzr/+bug/295653 {{{ Traceback (most recent call last): File /usr/lib/python2.6/logging/__init__.py, line 765, in emit self.stream.write(fs % msg.encode(UTF-8)) .. UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 8: ordinal not in range(128) }}} I run Python 2.6. In SVN the code is the same (StreamHandler ... def emit...): http://svn.python.org/view/python/branches/release26-maint/Lib/logging/__init__.py?revision=72507view=markup I think msg.encode(UTF-8, 'backslashreplace') would be better here. What do you think? Should I fill a bugreport? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: logging of strings with broken encoding
My quick fix is this: class MyFormatter(logging.Formatter): def format(self, record): msg=logging.Formatter.format(self, record) if isinstance(msg, str): msg=msg.decode('utf8', 'replace') return msg But I still think handling of non-ascii byte strings should be better. A broken logging message is better than none. And, if there is a UnicodeError, handleError() should not send the message to sys.stderr, but it should use emit() of the current handler. In my case sys.stderr gets discarded. Its very hard to debug, if you don't see any logging messages. Thomas Thomas Guettler schrieb: Hi, I have bug in my code, which results in the same error has this one: ... -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Advanced Python books?
kj schrieb: I have read a couple of learn Python-type books, and now I'm looking for some more advanced books on Python, ... Basically I'm looking for a book that assumes that one has the basics of the language down, and instead focuses on standard problems of software development, such as application architecture and design, prototyping, debugging, profiling and performance-tuning, testing, packaging/distribution, extending/embedding, threading and IPC, persistence, etc., and on various prototypical cases such as command-line utilities, GUI-apps, webapps, database-backed apps, simulations, etc. I think there is no such book. Maybe the Python Cookbook comes near. webapps: I use django, other use turbogears, other even different stuff... There are several books about e.g. django. It would be hard to put all the magic of all web apps into one chapter. GUI-apps: You can use tkinter, qt or gtk again it would be hard to put something useable into one chapter. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
[issue6051] smtplib docs should link to email module examples
New submission from Thomas Guettler guet...@thomas-guettler.de: On smtplib example: http://docs.python.org/library/smtplib.html#smtp-example should be a link to: http://docs.python.org/library/email-examples.html I think the smtplib example is bad, since the email gets created with a string. That's not solid. Using the email module is better. -- assignee: georg.brandl components: Documentation messages: 88020 nosy: georg.brandl, guettli severity: normal status: open title: smtplib docs should link to email module examples type: feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6051 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: file locking...
Hi Bruce, you can do it like Maildir [1] you move (os.rename()) file or directories. Maybe something like this: You have three directories: todo, in-process and done. A process tries to os.rename from todo to in-process. If it fails, some other process has done it before. If the process is done it moves the file/directory to done. To avoid stressing the directories, too much, It might be good to use subdirectories like todo/NN/MM/. I think git (version control system created by Linus Torvalds) does something like this. Thomas [1] http://wiki.dovecot.org/MailboxFormat/Maildir This page describes Maildir and some unneeded parts of the specification. bruce schrieb: Hi. Got a bit of a question/issue that I'm trying to resolve. I'm asking this of a few groups so bear with me. I'm considering a situation where I have multiple processes running, and each process is going to access a number of files in a dir. Each process accesses a unique group of files, and then writes the group of files to another dir. I can easily handle this by using a form of locking, where I have the processes lock/read a file and only access the group of files in the dir based on the open/free status of the lockfile. However, the issue with the approach is that it's somewhat synchronous. I'm looking for something that might be more asynchronous/parallel, in that I'd like to have multiple processes each access a unique group of files from the given dir as fast as possible. So.. Any thoughts/pointers/comments would be greatly appreciated. Any pointers to academic research, etc.. would be useful. thanks -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: handling multiple software repositories
Luis Zarrabeitia schrieb: ... It's quite good (and easy to install, unlike gforge), but the developers are moving on to a version 2.0 that you can find around here: http://basieproject.org/ (yeah, the website is ugly). Is uses django. That's nice since I know it. But the page looks like it is not ready for public. But it looks promising. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
OT: handling multiple software repositories
Hi, this is a bit off topic. In our company we have several SVN repositories. According to [1] Trac by default only handles one repository. Of course Trac links like changeset [1234] would not work anymore. You would need [repro/1234] or something like this. I think many (python) programmer have several repositories and need to handle this somehow. How do you do this? I want a common wiki and a common bug tracker. It should be possible to attach a bug to several repositories. Up to now I don't use Trac, if someone has an alternative, please tell me! Thomas [1] http://trac.edgewall.org/wiki/MultipleRepositorySupport -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Start Python at client side from web app
Bryan Olson schrieb: Thomas Guettler wrote: Sorry, I described my problem not well. Here is more information: Actually you did pretty well. [...] The main application is the intranet web application used with IE (ms windows client). Your idea of a custom mime-type, with a browser extension, should work. I don't know of any open-source implementation. Do you plan to have just one public key for verifying the downloaded Python scripts, hard-coded into the extension? Yes, that's what plan: one hard-coded public key is on the client. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Start Python at client side from web app
Diez B. Roggisch schrieb: 2) create a localhost web server, for the client side manipulation. Then have your remote webserver render a form that posts via javavscript to the localhost webserver. The localhost server would post back in the same way. AFAIK the JS security model prevents that. A page requested from http://myintranetserver/; can redirect to http://localhost:myport/myapp/?foo=...; this would work. But how should the web server at localhost be started? You need to write a Windows service. I guess that's not very easy, since I am not used to windows programming. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Start Python at client side from web app
Paul Rubin schrieb: Thomas Guettler h...@tbz-pariv.de writes: 1. The user pushes a button in the web app. 2. Webserver sends signed python code to the client with own mime type 3. IE sends code to the python application. 4. Signature gets checked, Python code on the client gets executed. 5. Maybe send some data to the server with http. I think someone else already suggested using an hta. Does that not do what you want? More info is at: http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx Also, rather than concocting your own code signing system, maybe you want to use standard Python .exe packaging, signed with Authenticode. Authenticode looks like a Microsoft invention. Although I need this for windows now, it should be portable. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Start Python at client side from web app
Hi, I want to start Python at the client side from a web application. The app is an intranet application, and all client PCs are under our control (we can install software on them). But I don't want to update the installation too often. Here is my idea: We create a custom mime-type and register it on the client PC. The web application can send signed python code to the client PC. If the signature is correct, the code will be executed at the client. The signature prevents others from executing code. Has someone seen or done something like this before? I can code this myself, but prefer to use some open source project, if it exists. Thanks in advance, Thomas Güttler -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Start Python at client side from web app
Sorry, I described my problem not well. Here is more information: The main application is the intranet web application used with IE (ms windows client). But some action needs to be done on the client since you can't do it with html or javascript. 1. The user pushes a button in the web app. 2. Webserver sends signed python code to the client with own mime type 3. IE sends code to the python application. 4. Signature gets checked, Python code on the client gets executed. 5. Maybe send some data to the server with http. Thomas Server runs Linux with Django and Postgres. Thomas Guettler schrieb: Hi, I want to start Python at the client side from a web application. The app is an intranet application, and all client PCs are under our control (we can install software on them). But I don't want to update the installation too often. Here is my idea: We create a custom mime-type and register it on the client PC. The web application can send signed python code to the client PC. If the signature is correct, the code will be executed at the client. The signature prevents others from executing code. Has someone seen or done something like this before? I can code this myself, but prefer to use some open source project, if it exists. Thanks in advance, Thomas Güttler -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Force exception on attribute write access only one object
Hi Peter and others, your idea was good, but it does not work with Django ORM Models: Traceback (most recent call last): File /localhome/modw/django/core/handlers/base.py, line 87, in get_response response = callback(request, *callback_args, **callback_kwargs) File /localhome/modw/foo/views/filter.py, line 473, in add return edit(request, 'add') File /localhome/modw/foo/views/filter.py, line 493, in edit filter=form.save() File /localhome/modw/foo/views/filter.py, line 457, in save action=form.save() File /localhome/modw/django/forms/models.py, line 315, in save if self.instance.pk is None: File /localhome/modw/django/db/models/base.py, line 292, in _get_pk_val return getattr(self, meta.pk.attname) AttributeError: 'MyAction' object has no attribute 'filter_action_ptr_id' Peter Otten schrieb: Thomas Guettler wrote: for debugging I want to raise an exception if an attribute is changed on an object. Since it is only for debugging I don't want to change the integer attribute to a property. Why? This should raise an exception: myobj.foo=1 Background: Somewhere this value gets changed. But I don't now where. If you change your mind: class A(object): def __init__(self): self.foo = 42 a = A() b = A() class B(A): @property def foo(self): return self.__dict__[foo] b.__class__ = B a.foo = whatever print b.foo b.foo = whatever Peter -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: eval('07') works, eval('08') fails, why?
Hi, 07 is octal. That's way 08 is invalid. Try this: === python print 011 9 print int('011') 11 -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Force exception on attribute write access only one object
Hi, for debugging I want to raise an exception if an attribute is changed on an object. Since it is only for debugging I don't want to change the integer attribute to a property. This should raise an exception: myobj.foo=1 Background: Somewhere this value gets changed. But I don't now where. -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: What would you like to see in a book about Matplotlib?
Sandro Tosi schrieb: Some basic question I'd like to ask are: - what are you using matplotlib for? I use the API to create PNGs from data stored in postgres. Webframework: Django. - what are the (basic) things that, when you were beginning to use matplotlib, you wanted to see grouped up but couldn't find? The API is not good documented. It was very hard for me to understand what was going on the source. - what would you like to see in a book about matplotlib? How to use the API. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: Which PostgreSQL adapter to use?
Hussein B schrieb: Hey, Which Adapter to use with PostgreSQL: PyPgSQL, psycopg or PyGreSQL? Thanks. I think psycopg2 is a good choice. Never tried anything else. Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
urlencode() doseq and Python 3.0
Hi, I think the default of urlencode doseq being false is just there to preserve the old behavior. http://svn.python.org/view/python/branches/py3k/Lib/urllib/parse.py?rev=66199sortby=dateview=markup {{{ ... if not doseq: # preserve old behavior }}} I guess no one want really wants this: urllib.urlencode({'key': ['value1', 'value2']}) 'key=%5B%27value1%27%2C+%27value2%27%5D' I think this is what most people want: urllib.urlencode({'key': ['value1', 'value2']}, doseq=True) 'key=value1key=value2' Should I open a bug against 3.0? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list
Re: parse a table in HTML page.
Have you looked at beautiful soup? http://www.crummy.com/software/BeautifulSoup/ antonio_wn8 schrieb: Hi all, I have a need to read and parse a table in HTML page. I’m using the following script: http://trac.davidgrant.ca/browser/src/python/misc/siteuptime/TableParser.py It works fine aside from link in href. Example: String to parse: trtda href='vaffa.html'elog/a/tdtdnormal text/td/tr Output: [[['elog', 'normal text']]] as you can see it misses the info about href... how can get this information 'vaffa.html'? -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list