[ python-Bugs-1605110 ] logging %(module)s reporting wrong modules
Bugs item #1605110, was opened at 2006-11-29 09:29 Message generated for change (Comment added) made by vsajip You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1605110&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None >Status: Pending >Resolution: Works For Me Priority: 5 Private: No Submitted By: Pieter Zieschang (mad-marty) Assigned to: Vinay Sajip (vsajip) Summary: logging %(module)s reporting wrong modules Initial Comment: I recently upgraded from python 2.4.2 to 2.4.4 and the logging seems to be working wrong now. I have a formatter which uses the %(module)s and %(filename)s and the point to the wrong file/module. I have some plugins in .py files, which mainly have one class derived from threading.Thread. Those classes logging calls will now log as 2006-11-29 10:17:50 - threading.py - threading - INFO - ... instead of 2006-11-29 10:17:50 - myplugin.py - myplugin - INFO - ... -- >Comment By: Vinay Sajip (vsajip) Date: 2006-11-30 09:18 Message: Logged In: YES user_id=308438 Originator: NO I need more information. For example (N.B. lines may wrap, please adjust if copy/pasting the code below): #-- test.py import module import logging logging.basicConfig(level=logging.DEBUG, format="%(relativeCreated)-6d %(module)s %(filename)s %(lineno)d - %(message)s") logging.getLogger("test").debug("Test starting, about to start thread...") threads = module.start() for t in threads: t.join() logging.getLogger("test").debug("All done.") #-- test.py ends #-- module.py import logging import threading import random import time class MyThread(threading.Thread): def run(self): loops = 5 while True: logging.getLogger("module").debug("Running in thread: %s", threading.currentThread().getName()) time.sleep(random.random()) loops -= 1 if loops < 0: break class MyOtherThread(threading.Thread): def run(self): loops = 5 while True: logging.getLogger("module").debug("Running in thread: %s", threading.currentThread().getName()) time.sleep(random.random()) loops -= 1 if loops < 0: break def start(): t1 = MyThread(name="Thread One") t2 = MyOtherThread(name="Thread Two") t1.start() t2.start() return t1, t2 #-- module.py ends When I run test, I get the following output: 15 test test.py 7 - Test starting, about to start thread... 15 module module.py 11 - Running in thread: Thread One 15 module module.py 22 - Running in thread: Thread Two 327module module.py 11 - Running in thread: Thread One 343module module.py 22 - Running in thread: Thread Two 655module module.py 11 - Running in thread: Thread One 780module module.py 22 - Running in thread: Thread Two 1000 module module.py 11 - Running in thread: Thread One 1546 module module.py 22 - Running in thread: Thread Two 1890 module module.py 11 - Running in thread: Thread One 2046 module module.py 11 - Running in thread: Thread One 2218 module module.py 22 - Running in thread: Thread Two 2562 module module.py 22 - Running in thread: Thread Two 3187 test test.py 11 - All done. This is the expected output. Python version used: ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on win32 -- Comment By: Pieter Zieschang (mad-marty) Date: 2006-11-29 12:02 Message: Logged In: YES user_id=1269426 Originator: YES Checked again and found that the bug was introduced with Python 2.4.2. Last correctly working version is python-2.4.1.msi. -- Comment By: Pieter Zieschang (mad-marty) Date: 2006-11-29 09:32 Message: Logged In: YES user_id=1269426 Originator: YES Forgot to add, that is is the 2.4.4 windows package used on windows xp. ;-) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1605110&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1606092 ] csv module broken for unicode
Bugs item #1606092, was opened at 2006-11-30 16:46 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1606092&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Unicode Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: JettLogic (jettlogic) Assigned to: M.-A. Lemburg (lemburg) Summary: csv module broken for unicode Initial Comment: The csv module does not accept data to write/read as anything other than ascii-or-utf-8 str, and the do-it-yourself example in the Python 2.5 Manual to write in another encoding is extremely clunky: 1) convert unicode to utf-8 2) use csv on utf-8 with cStringIO output 3) convert utf-8 to unicode 4) convert unicode to target encoding (may be utf-8...) So clunky as to be a bug - csv clearly can't handle unicode at all. The module functions are in dire need of either accepting unicode objects (letting the output stream worry about the encoding, like codecs.StreamWriter), or at the very least accepting data directly in a target encoding instead of roundabout utf-8. To read another encoding is a bit less onerous than writing: 1) wrap file to return utf-8 2) use csv, getting utf-8 output 3) convert utf-8 to unicode object Anyone willing to fix the csv module? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1606092&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1606233 ] readline on popen3 file returns empty string before end
Bugs item #1606233, was opened at 2006-11-30 12:51 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1606233&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Bill Wallace (wayfarer3130) Assigned to: Nobody/Anonymous (nobody) Summary: readline on popen3 file returns empty string before end Initial Comment: When readline encounters some binary data (I'm not sure which character causes this) in a stream opened with popen3, it returns the empty string indicating end of file BEFORE the file is actually finished. This causes programs to terminate early. The exact same file as a local file opened in "r" mode does not have this behaviour. The stream is created using: strm1, strm2, strm3 = popen2.popen3("cvs log") and the problem is that one of the cvs log messages I'm looking at has some garabage data in it - I think it has some unix end of line's, but I'm not sure exactly what causes this. The work-around is to readline another time to see if it returns '' again - this allows it to continue reading successfully. I can attach a portion of the file if that would help, or do an od -x on the section that causes the problem. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1606233&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1595164 ] texinfo library documentation fails to build
Bugs item #1595164, was opened at 2006-11-12 14:15 Message generated for change (Comment added) made by pekon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1595164&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mark Diekhans (diekhans) Assigned to: Nobody/Anonymous (nobody) Summary: texinfo library documentation fails to build Initial Comment: Attempting to build the texinfo documentation generates the error (args-out-of-range 2931944 2931946). This occurs in download of 2.5 latex doc and from trunk of svn tree. elisp stack trace attached. It would be really nice if texinfo doc was still available for download. -- Comment By: Petr Konecny (pekon) Date: 2006-11-30 15:42 Message: Logged In: YES user_id=828085 Originator: NO I believe this problem is triggered by a typo in lib/libmsilib.tex:347 \begin{classdesc}{Feature}{database, id, title, desc, display\optional{, level=1\optional{, parent\optional\{, directory\optional{, attributes=0 I think it should look like this: \begin{classdesc}{Feature}{database, id, title, desc, display\optional{, level=1\optional{, parent\optional{, directory\optional{, attributes=0} With this change I am able to build python-lib.texi. However makeinfo fails: makeinfo --footnote-style end --fill-column 72 --paragraph-indent 0 --output=python-lib.info python-lib.texi python-lib.texi:30398: Unmatched }. python-lib.texi:30398: Misplaced {. python-lib.texi:36389: warning: @strong{Note...} produces a spurious cross-reference in Info; reword to avoid that. python-lib.texi:49309: Unmatched [EMAIL PROTECTED]'. python-lib.texi:51076: Unknown command `example>>>'. python-lib.texi:51082: Unmatched [EMAIL PROTECTED]'. python-lib.texi:51104: Unknown command `example>>>'. python-lib.texi:51110: Unmatched [EMAIL PROTECTED]'. python-lib.texi:59355: Unknown command `examplefrom'. python-lib.texi:59366: [EMAIL PROTECTED]' expected `table', but saw `example'. makeinfo: Removing output file `python-lib.info' due to errors; use --force to preserve. -- Comment By: Martin v. Löwis (loewis) Date: 2006-11-12 16:47 Message: Logged In: YES user_id=21627 Can you find out what is causing this error? If not, would you be interested in rewriting this in Python? (AFAICT, there really is no reason that this conversion is written in elisp) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1595164&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1595164 ] texinfo library documentation fails to build
Bugs item #1595164, was opened at 2006-11-12 14:15 Message generated for change (Comment added) made by pekon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1595164&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mark Diekhans (diekhans) Assigned to: Nobody/Anonymous (nobody) Summary: texinfo library documentation fails to build Initial Comment: Attempting to build the texinfo documentation generates the error (args-out-of-range 2931944 2931946). This occurs in download of 2.5 latex doc and from trunk of svn tree. elisp stack trace attached. It would be really nice if texinfo doc was still available for download. -- Comment By: Petr Konecny (pekon) Date: 2006-11-30 15:55 Message: Logged In: YES user_id=828085 Originator: NO After changing libmsilib.tex I made some manual fixes in python-lib.texi and was able to get .info files. I am attaching diff, which shows what is broken. --- python-lib.texi 2006-11-30 12:54:04.626177825 -0800 +++ python-lib.texi.fixed 2006-11-30 12:53:28.767367718 -0800 @@ -30395,7 +30395,7 @@ QName wrapper. This can be used to wrap a QName attribute value, in order to get proper namespace handling on output. @var{text_or_uri} is a string containing the QName value, -in the form @[EMAIL PROTECTED]@[EMAIL PROTECTED], or, if the tag argument is given, +in the form @[EMAIL PROTECTED], or, if the tag argument is given, the URI part of a QName. If @var{tag} is given, the first argument is interpreted as an URI, and this argument is interpreted as a local name. @@ -49305,8 +49305,6 @@ @findex EDQUOT Quota exceeded @end table [EMAIL PROTECTED]@[EMAIL PROTECTED] ifinfo [EMAIL PROTECTED]@[EMAIL PROTECTED]@} @node ctypes, , errno, Generic Operating System Services @section A foreign function library for Python. @@ -51073,12 +51071,14 @@ Here is the wrapping with @code{ctypes}: [EMAIL PROTECTED]>>> from ctypes import c_int, WINFUNCTYPE, windll [EMAIL PROTECTED] +>>> from ctypes import c_int, WINFUNCTYPE, windll >>> from ctypes.wintypes import HWND, LPCSTR, UINT >>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, c_uint) >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) ->>>@end example +>>> [EMAIL PROTECTED] example The MessageBox foreign function can now be called in these ways: @example @@ -51101,12 +51101,14 @@ Here is the wrapping with @code{ctypes}: [EMAIL PROTECTED]>>> from ctypes import POINTER, WINFUNCTYPE, windll [EMAIL PROTECTED] +>>> from ctypes import POINTER, WINFUNCTYPE, windll >>> from ctypes.wintypes import BOOL, HWND, RECT >>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT)) >>> paramflags = (1, "hwnd"), (2, "lprect") >>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags) ->>>@end example +>>> [EMAIL PROTECTED] example Functions with output parameters will automatically return the output parameter value if there is a single one, or a tuple containing the @@ -59352,7 +59354,8 @@ . Example usage: [EMAIL PROTECTED] wsgiref.simple_server import make_server, demo_app [EMAIL PROTECTED] +from wsgiref.simple_server import make_server, demo_app httpd = make_server('', 8000, demo_app) print "Serving HTTP on port 8000..." -- Comment By: Petr Konecny (pekon) Date: 2006-11-30 15:42 Message: Logged In: YES user_id=828085 Originator: NO I believe this problem is triggered by a typo in lib/libmsilib.tex:347 \begin{classdesc}{Feature}{database, id, title, desc, display\optional{, level=1\optional{, parent\optional\{, directory\optional{, attributes=0 I think it should look like this: \begin{classdesc}{Feature}{database, id, title, desc, display\optional{, level=1\optional{, parent\optional{, directory\optional{, attributes=0} With this change I am able to build python-lib.texi. However makeinfo fails: makeinfo --footnote-style end --fill-column 72 --paragraph-indent 0 --output=python-lib.info python-lib.texi python-lib.texi:30398: Unmatched }. python-lib.texi:30398: Misplaced {. python-lib.texi:36389: warning: @strong{Note...} produces a spurious cross-reference in Info; reword to avoid that. python-lib.texi:49309: Unmatched [EMAIL PROTECTED]'. python-lib.texi:51076: Unknown command `example>>>'. python-lib.texi:51082: Unmatched [EMAIL PROTECTED]'. python-lib.texi:51104: Unknown command `example>>>'. python-lib.texi:51110: Unmatched [EMAIL PROTECTED]'. python-lib.texi:59355: Unknown command `examplefrom'. python-lib.texi:59366: [EMAIL PROTECT
[ python-Bugs-1595164 ] texinfo library documentation fails to build
Bugs item #1595164, was opened at 2006-11-12 20:15 Message generated for change (Comment added) made by loewis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1595164&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Mark Diekhans (diekhans) Assigned to: Nobody/Anonymous (nobody) Summary: texinfo library documentation fails to build Initial Comment: Attempting to build the texinfo documentation generates the error (args-out-of-range 2931944 2931946). This occurs in download of 2.5 latex doc and from trunk of svn tree. elisp stack trace attached. It would be really nice if texinfo doc was still available for download. -- >Comment By: Martin v. Löwis (loewis) Date: 2006-11-30 21:59 Message: Logged In: YES user_id=21627 Originator: NO pekon, it would be quite helpful if you could resolve this. It would be best if you could check out the subversion trunk or release25-maint branch, and then provide a patch that solves it all :-) After applying your (correct) patch, I still get such an error, so I guess there are more problems in the tex source. -- Comment By: Petr Konecny (pekon) Date: 2006-11-30 21:55 Message: Logged In: YES user_id=828085 Originator: NO After changing libmsilib.tex I made some manual fixes in python-lib.texi and was able to get .info files. I am attaching diff, which shows what is broken. --- python-lib.texi 2006-11-30 12:54:04.626177825 -0800 +++ python-lib.texi.fixed 2006-11-30 12:53:28.767367718 -0800 @@ -30395,7 +30395,7 @@ QName wrapper. This can be used to wrap a QName attribute value, in order to get proper namespace handling on output. @var{text_or_uri} is a string containing the QName value, -in the form @[EMAIL PROTECTED]@[EMAIL PROTECTED], or, if the tag argument is given, +in the form @[EMAIL PROTECTED], or, if the tag argument is given, the URI part of a QName. If @var{tag} is given, the first argument is interpreted as an URI, and this argument is interpreted as a local name. @@ -49305,8 +49305,6 @@ @findex EDQUOT Quota exceeded @end table [EMAIL PROTECTED]@[EMAIL PROTECTED] ifinfo [EMAIL PROTECTED]@[EMAIL PROTECTED]@} @node ctypes, , errno, Generic Operating System Services @section A foreign function library for Python. @@ -51073,12 +51071,14 @@ Here is the wrapping with @code{ctypes}: [EMAIL PROTECTED]>>> from ctypes import c_int, WINFUNCTYPE, windll [EMAIL PROTECTED] +>>> from ctypes import c_int, WINFUNCTYPE, windll >>> from ctypes.wintypes import HWND, LPCSTR, UINT >>> prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, c_uint) >>> paramflags = (1, "hwnd", 0), (1, "text", "Hi"), (1, "caption", None), (1, "flags", 0) >>> MessageBox = prototype(("MessageBoxA", windll.user32), paramflags) ->>>@end example +>>> [EMAIL PROTECTED] example The MessageBox foreign function can now be called in these ways: @example @@ -51101,12 +51101,14 @@ Here is the wrapping with @code{ctypes}: [EMAIL PROTECTED]>>> from ctypes import POINTER, WINFUNCTYPE, windll [EMAIL PROTECTED] +>>> from ctypes import POINTER, WINFUNCTYPE, windll >>> from ctypes.wintypes import BOOL, HWND, RECT >>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT)) >>> paramflags = (1, "hwnd"), (2, "lprect") >>> GetWindowRect = prototype(("GetWindowRect", windll.user32), paramflags) ->>>@end example +>>> [EMAIL PROTECTED] example Functions with output parameters will automatically return the output parameter value if there is a single one, or a tuple containing the @@ -59352,7 +59354,8 @@ . Example usage: [EMAIL PROTECTED] wsgiref.simple_server import make_server, demo_app [EMAIL PROTECTED] +from wsgiref.simple_server import make_server, demo_app httpd = make_server('', 8000, demo_app) print "Serving HTTP on port 8000..." -- Comment By: Petr Konecny (pekon) Date: 2006-11-30 21:42 Message: Logged In: YES user_id=828085 Originator: NO I believe this problem is triggered by a typo in lib/libmsilib.tex:347 \begin{classdesc}{Feature}{database, id, title, desc, display\optional{, level=1\optional{, parent\optional\{, directory\optional{, attributes=0 I think it should look like this: \begin{classdesc}{Feature}{database, id, title, desc, display\optional{, level=1\optional{, parent\optional{, directory\optional{, attributes=0} With this change I am able to build python-lib.texi. However makeinfo fails: makeinfo --footnote-style end --fill-column 72 --paragraph-indent 0 --output=python-lib.info python-lib.texi python-lib.texi:30398: Unmatched }. py
[ python-Bugs-1599055 ] csv module does not handle '\x00'
Bugs item #1599055, was opened at 2006-11-19 01:47 Message generated for change (Comment added) made by j_70 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1599055&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.5 Status: Closed Resolution: Wont Fix Priority: 5 Private: No Submitted By: Stephen Day (shday) Assigned to: Nobody/Anonymous (nobody) Summary: csv module does not handle '\x00' Initial Comment: The following from an interactive session failed instead of just returning the '\x00': >>> r = csv.reader(['a,line,with,a,null,\x00,byte']) >>> r.next() Traceback (most recent call last): File "", line 1, in -toplevel- r.next() Error: string with NUL bytes >>> -- Comment By: j_70 (j_70) Date: 2006-11-30 21:14 Message: Logged In: YES user_id=1437039 Originator: NO Could someone post a try / except block that handles this. -- Comment By: Skip Montanaro (montanaro) Date: 2006-11-19 20:17 Message: Logged In: YES user_id=44345 Originator: NO If the device is transmitting the occasional spurious you might try wrapping your file object in a class which simply deletes any NUL bytes it encounters. -- Comment By: Georg Brandl (gbrandl) Date: 2006-11-19 17:23 Message: Logged In: YES user_id=849994 Originator: NO The core of the csv module is coded in C, so null bytes are as always notoriously problematic when handling strings. (This is why there's a specific error message only for null bytes.) I think that the try-except is the sanest solution to this. -- Comment By: Stephen Day (shday) Date: 2006-11-19 17:08 Message: Logged In: YES user_id=948502 Originator: YES I've been using the csv module to parse data coming from a serial port of a lab instrument. Occasionally the instrument transmits a lone /x00 (maybe when the power cycles, I'm not sure). Anyhow, I'm now using a try-except statement to catch the error. I guess my answer to your question is that I think the module should handle whatever string you pass it. Is there a specific reason not to handle /x00? -- Comment By: Georg Brandl (gbrandl) Date: 2006-11-19 15:09 Message: Logged In: YES user_id=849994 Originator: NO Why do you think a CSV reader should support null bytes? CSV is a text format, not a binary one. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1599055&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com