[ python-Bugs-1519816 ] urllib2 proxy does not work in 2.4.3
Bugs item #1519816, was opened at 2006-07-10 10:29 Message generated for change (Comment added) made by mniklas You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1519816&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.4 Status: Open Resolution: None Priority: 5 Submitted By: Michal Niklas (mniklas) Assigned to: Nobody/Anonymous (nobody) Summary: urllib2 proxy does not work in 2.4.3 Initial Comment: My python app had to retrieve some web pages and while our network environment requires proxy it uses urllib2 opener (source is in attachment). It worked very well on older Python interpreters: ActivePython 2.4.2 Build 248 (ActiveState Corp.) based on Python 2.4.2 (#67, Oct 30 2005, 16:11:18) [MSC v.1310 32 bit (Intel)] on win32 It works on linux with 2.3 and 2.4.1: Python 2.4.1 (#2, May 5 2005, 11:32:06) [GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2 But it does not work with newest 2.4.3 on Linux: Python 2.4.3 (#1, Jul 10 2006, 09:57:52) [GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2 Desired result: isof-mark:~# python2.3 proxy_bug.py trying http://www.python.org ... OK. We have reply from http://www.python.org. Size: 13757 [b] http://www.w3.org/TR/xhtml1/DTD/ xhtml1-transitional.dtd"> http://www.w3.org/ 1999/xhtml"> design by pollenation Copyright ÃÅ 1990-2006, Python Software Foundation Legal Statements isof-mark:~# /usr/local/bin/python proxy_bug.py trying http://www.python.org ... Traceback (most recent call last): File "proxy_bug.py", line 37, in ? get_page() File "proxy_bug.py", line 27, in get_page f = urllib2.urlopen(request) File "/usr/local/lib/python2.4/urllib2.py", line 130, in urlopen return _opener.open(url, data) File "/usr/local/lib/python2.4/urllib2.py", line 364, in open response = meth(req, response) File "/usr/local/lib/python2.4/urllib2.py", line 471, in http_response response = self.parent.error( File "/usr/local/lib/python2.4/urllib2.py", line 402, in error return self._call_chain(*args) File "/usr/local/lib/python2.4/urllib2.py", line 337, in _call_chain result = func(*args) File "/usr/local/lib/python2.4/urllib2.py", line 480, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required I have raported it on ActiveState bug list (http:// bugs.activestate.com/show_bug.cgi?id=47018) while I first spot this bug on their destribution but it seems that bug is in others distributions too. Regards, Michal Niklas -- >Comment By: Michal Niklas (mniklas) Date: 2006-07-21 09:59 Message: Logged In: YES user_id=226518 I have just installed new virtual machine with Python 2.5b2 and my program works. It seems that only 2.4.3 is broken. Regards, Michal -- Comment By: John J Lee (jjlee) Date: 2006-07-20 20:09 Message: Logged In: YES user_id=261020 You're sure you didn't copy over the urllib2.py from 2.5b2 also? That might make the bug appear to go away, when really it's still there. The way to be sure is to try it on a different machine. Thanks for your report. -- Comment By: Michal Niklas (mniklas) Date: 2006-07-19 13:12 Message: Logged In: YES user_id=226518 I have checked that the last wersion my script works with is 2.4.2 and copied that version urllib2.py to 2.4.3 Lib directory. It works again. The only change in urllib2.py is in retry_http_basic_auth(), line 723: 2.4.2 user,pw = self.passwd.find_user_password(realm, host) 2.4.3 user, pw = self.passwd.find_user_password(realm, req.get_full_url()) So "host" is replaced by "req.get_full_url()". Checked again with 2.5b2 and it works! Probably I destroyed my test environment and tested it wrong way :( So the problem is only with 2.4.3. Previous versions and 2.5b works well. Regards, Michal Niklas -- Comment By: Michal Niklas (mniklas) Date: 2006-07-13 12:09 Message: Logged In: YES user_id=226518 2.5b2 does not work any better: Python 2.5b2 (r25b2:50512, Jul 11 2006, 10:16:14) [MSC v.1310 32 bit (Intel)] on win32 Result is the same as in 2.5b1 :( -- Comment By: Michal Niklas (mniklas) Date: 2006-07-11 08:27 Message: Logged In: YES user_id=226518 Tried it with 2.5 beta 1 and it is not better :( c:\tools\pyscripts\scripts>c:\python25\python2.5 Python 2.5b1 (r25b1:47027, Jun 20 2006, 09:31:33) [MSC v.1310 32 bit (Intel)] on win32 c:\tools\pyscripts\scripts>c:\python25\python2.5 proxy_bug.py trying http:
[ python-Feature Requests-1474577 ] feature requests for logging lib
Feature Requests item #1474577, was opened at 2006-04-22 09:50
Message generated for change (Settings changed) made by vsajip
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1474577&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: Invalid
Priority: 5
Submitted By: blaize rhodes (blaize)
Assigned to: Vinay Sajip (vsajip)
Summary: feature requests for logging lib
Initial Comment:
The logger module interface is a bit broken, I reckon.
My problems specifically are:
i) It's hard to get access to the LogRecord classes
for customization.
ii) the semantics of the debug, log, info, etc calls
is a bit strange/confusing...
Here are my proposed fixes:
a) Add a method
Logger.setLogRecordClass( myLogRecordSubClass )
which sets the class that is instantiated in the
makeRecord() fn/method (yes there are two of them).
This would make customizing the LogRecord easier...
Otherwise (I believe) in order to subclass the
LogRecord you also have to overload the Logger and
possibly the root makeRecord() function as well? This
bloke's writen up his approach to this (it's doable but
not as nice as it should be).
http://qix.it/~ludoo/archive/2004/05/python_logging_customization.html
Another problem is that LogRecords are instantiated in
Logger._log so it's difficult to customize __init__
behaviour for the LogRecord (and I argue that this is a
useful thing)..
b) A second problem is that the semantics of the log,
info, debug, etc fns is a bit broken. Currently the
defn looks like this:
def debug(self, msg, *args, **kwargs):
this suggests to me that a call like this is OK...
logger.debug("here we go %(foo)s", foo = 'bar')
but it's not. This is discussed further here...
http://groups.google.com.au/group/comp.lang.python/browse_thread/thread/322919fcac0113ec/98ceaf6fc0c56881?lnk=st&q=python+logging+keywords&rnum=1#98ceaf6fc0c56881
Instead kwargs are used for customizing the behaviour
of the debug method (e.g. exc_info, and extra). This
seems i) a bit incongrous with its definition and
therefore confusing, and ii) a bit of a hack (it's not
completely insane though when you think about what's
happening under the hood). Instead I propose using a
couple of calls along the lines of printf/fprintf. In
my world we'd have a simple printf-style function...
def debug(self, msg, *args):
and a more complex, more easily customizable
fprintf-style one
def x_debug(self, log_record, msg, *args):
In these calls *args is a valid argument for the string
formatting operator %, either a tuple of the right
length or a dictionary. Any customization of the
behaviour of the system can be done (using keyword args
if you wish) in the log_record initializer (an example
will follow).
(Having said that perhaps we can check whether the
first arg to the new simple debug() is a logrecord and
if it is call the (hidden) extended version - that's
more pythonic I imagine)
c) This is not so much a feature request but a
motivating mode of operation that I'd like to be able
to use...
Currently you can set up log filters. What you can
filter is largely based on what information appears in
the log record. It'd be nice to filter messages based
on metadata that you add at log time (i.e. in the
logger.debug(...) method). Currently it's quite
painfull to set this up. This is because we can't
customize the initialization of the log_record. The
call structure in ii) above allows us to setup nice
filtering mechanisms
eg..
class GUIFilter:
"A filter that only lets messges with gui tags
through."""
def filter(self, log_record):
return hasattr(log_record, 'gui')
# set up a log, and a handler...
log = logging.getLogger(..)
file_handler = FileHandler(..)
log.addHandler(file_handler)
gui_msg_bar_handler = StreamHandler(..)
log.addHandler(gui_msg_bar_handler)
gui_msg_bar_handler.addFilter(GUIFilter())
# msg only goes to the file_handler
log.debug("here we go %s", "here's an arg")
# msg goes to the file_handler and to the gui_handler.
log.x_debug(LogRecord(gui=True), "what you just tried
to do didn't work %s", "fool")
Change a) could be made with no backward compatability
problems (I can see), change b) could be made without
probs if you didn't overload the existing logging
methods with the new ones, and then deprecate the
existing ones (though what you'd call the new fns I
don't know).
That said I quite like the logger lib and I use it.
It's a lot better than anything I would have thought up.
cheers
blaize
--
Comment By: Vinay Sajip (vsajip)
Date: 2006-05-02 09:11
Message:
Logged In: YES
user_id=308438
Why does the recent introduction of the 'extra' keyword
argument,
[ python-Bugs-1526585 ] Concatenation on a long string breaks
Bugs item #1526585, was opened at 2006-07-21 13:18 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=1526585&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 Interpreter Core Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Jp Calderone (kuran) Assigned to: Nobody/Anonymous (nobody) Summary: Concatenation on a long string breaks Initial Comment: Consider this transcript: [EMAIL PROTECTED]:~/Projects/python/trunk$ ./python Python 2.5b2 (trunk:50698, Jul 18 2006, 10:08:36) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> x = 'x' * (2 ** 31 - 1) >>> x = x + 'x' Traceback (most recent call last): File "", line 1, in SystemError: Objects/stringobject.c:4103: bad argument to internal function >>> len(x) Traceback (most recent call last): File "", line 1, in NameError: name 'x' is not defined >>> I would expect some exception other than SystemError and for the locals namespace to not become corrupted. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1526585&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1526785 ] current directory added to sys.path on win32
Bugs item #1526785, was opened at 2006-07-22 00:27 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=1526785&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 Interpreter Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: John Ehresman (jpe) Assigned to: Nobody/Anonymous (nobody) Summary: current directory added to sys.path on win32 Initial Comment: The current directory at the time python starts is added to sys.path as the 3rd item (usually), regardless of whether the python file run is in this directory. This is apparently due to getpythonregpath in getpathp.c returning "" when skiphome is true and there are 0 subkeys in the registry. Since this is != NULL, it is appended to the path after the library zip file is and later is expanded to the current directory. Because of this, 'import string' fails when an empty re.py is in the current directory because this file is used when string tries to import re. I know it's not a good idea to have an empty re.py file, but I can't control what's on other people's machines. I've been debugging this in python 2.4, but 2.5 beta 2 seems to have the same behavior. This fix may be to set machinepath and userpath to NULL if they are "". -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1526785&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1526834 ] unbalanced parentheses from command line crash pdb
Bugs item #1526834, was opened at 2006-07-21 21:03 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=1526834&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 Submitted By: Ilya Sandler (isandler) Assigned to: Nobody/Anonymous (nobody) Summary: unbalanced parentheses from command line crash pdb Initial Comment: bagira:~/python-svn/patches> cat simple print 123 bagira:~/python-svn/patches> ../python/trunk/python -m pdb simple (Pdb) b f( #crashes your program Traceback (most recent call last): ... File "/home/ilya/python-svn/python/trunk/Lib/sre.py", line 233, in _compile raise error, v # invalid expression error: unbalanced parenthesis Uncaught exception. Entering post mortem debugging (Pdb) b f( # doing it post-mortem fully crashes pdb Traceback (most recent call last): .. raise error, v # invalid expression sre_constants.error: unbalanced parenthesis bagira:~/python-svn/patches> -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1526834&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
