Sounds good! Wayne
On Wed, 26 Mar 2008, Jeremy wrote:
> Hi Wayne,
> Well, that seemed to work! Somehow, my proxies were set and I just had to
> unsetenv the http_proxy variable to get it to work. I suspect out IT guys
> configured my Mac strangely when they built it for me.
>
> Thanks for the help! Now I can get to playing with CCPN.
>
> Cheers,
> Jeremy
>
>
> On Wed, Mar 26, 2008 at 10:39 AM, Wayne Boucher <[log in to unmask]>
> wrote:
>
> > Yes, self.proxies is knackered (it's pointing the http protocol to a
> > nonsense url). I'm not sure why it is knackered. If I am reading the
> > code correctly this could be being set up in one of two functions, either
> > getproxies_environment or getproxies_internetconfig (in the same file).
> > On my Mac they both return an empty dictionary but on yours one of them
> > must be returning something.
> >
> > Just before the return statement in both these functions you can add a
> >
> > print 'HERE2*', proxies
> >
> > at the same indentation level as the return statment (so four spaces for
> > the first function and eight for the second), and where *=1,2 for the two
> > functions (so we know what is what).
> >
> > If it is the first function that is returning something (in which case the
> > second function is not being called) then it should be easy to sort
> > because that means something in your environment is setting this. Indeed
> > at the OS prompt you could do a:
> >
> > printenv | grep _proxy
> >
> > and see if anything comes up.
> >
> > If it is the second function that is returning something (which is more
> > likely) then that is harder (for me) to sort because it involves something
> > Mac-specific called Internet Config, which I don't know anything about, in
> > particular how to modify, although the Python documentation for the
> > module:
> >
> > http://docs.python.org/mac/module-ic.html
> >
> > implies one should be able to set (or in our case unset) it somehow in the
> > System Preferences (in the Network?)
> >
> > Wayne
> >
> > On Wed, 26 Mar 2008, Jeremy wrote:
> >
> > > Hi Wayne,
> > > I did as you suggested, and here is the output:
> > >
> > > >>> *********************
> > > HERE10 ('http',
> > > '//mole.bio.cam.ac.uk/~ccpn/ccpNmrUpdate/__UpdateAgentData.db')
> > > HERE11 {'http': 'http://'}
> > > HERE12 http://
> > > HERE13 ('http', '//')
> > > HERE14 ('', '')
> > > HERE3 ('', '
> > > http://mole.bio.cam.ac.uk/~ccpn/ccpNmrUpdate/__UpdateAgentData.db')
> > > HERE4
> > > Exception in Tkinter callback
> > > Traceback (most recent call last):
> > > File "/sw/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
> > > return self.func(*args)
> > > (...etc...)
> > >
> > > Hope that gives some clue.
> > >
> > > -Jeremy
> > >
> > > On Wed, Mar 26, 2008 at 1:41 AM, Wayne Boucher <[log in to unmask]
> > >
> > > wrote:
> > >
> > > > Right, when the code is getting to that point the host
> > > > (mole.bio.cam.ac.uk) has been lost for some reason. The only way I
> > can
> > > > see this happening is further upstream in lines 173-177, which
> > involves
> > > > proxies. So you could try modifying those lines to:
> > > >
> > > > print 'HERE10', (urltype, url)
> > > > if urltype in self.proxies:
> > > > print 'HERE11', self.proxies
> > > > proxy = self.proxies[urltype]
> > > > print 'HERE12', proxy
> > > > urltype, proxyhost = splittype(proxy)
> > > > print 'HERE13', (urltype, proxyhost)
> > > > host, selector = splithost(proxyhost)
> > > > print 'HERE14', (host, selector)
> > > > url = (host, fullurl) # Signal special case to open_*()
> > > >
> > > > By the time you get to HERE14 the host has been splatted. It's
> > possibly
> > > > this is because the proxy in HERE12 is just rubbish. Looking at the
> > code
> > > > it looks like self.proxies ought to be empty, in which case going into
> > > > that "if" block would not happen. But that's the only bit of code I
> > can
> > > > see that is modifying the url in the way indicated by the messages
> > further
> > > > downstream.
> > > >
> > > > Wayne
> > > >
> > > > On Tue, 25 Mar 2008, Jeremy wrote:
> > > >
> > > > > Hi Wayne,
> > > > > Thanks for the reply. My coworkers actually use Python 2.5, so that
> > is
> > > > > likely not the problem. I added the five lines and the output was
> > as
> > > > > follows:
> > > > >
> > > > > HERE3 ('', '
> > > > > http://mole.bio.cam.ac.uk/~ccpn/ccpNmrUpdate/__UpdateAgentData.db')
> > > > > HERE4
> > > > > Exception in Tkinter callback
> > > > > Traceback (most recent call last):
> > > > > File "/sw/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
> > > > > return self.func(*args)
> > > > > (...etc...)
> > > > >
> > > > > Hope this gives you some information.
> > > > >
> > > > > Jeremy
> > > > >
> > > > >
> > > > >
> > > > > On Tue, Mar 25, 2008 at 1:39 PM, Wayne Boucher <
> > [log in to unmask]
> > > > >
> > > > > wrote:
> > > > >
> > > > > > Hello,
> > > > > >
> > > > > > That bit of urllib.py is a bit opaque, but the only thing I can
> > see
> > > > that
> > > > > > might be going on weird is to do with proxies. Are your coworkers
> > > > using
> > > > > > Python <=2.4? I did a diff between the Python 2.4 and 2.5
> > urllib.pycode
> > > > > > and the main differences are to do with proxy handling, but not
> > > > obviously
> > > > > > at the root of this problem so this could be irrelevant. The one
> > way
> > > > to
> > > > > > really find out what is going on is to edit
> > > > > >
> > > > > > /sw/lib/python2.5/urllib.py
> > > > > >
> > > > > > and to put in various checks along the way. If you have
> > adminstrator
> > > > > > access (which I assume you do) then you could add some debugging
> > to
> > > > the
> > > > > > function open_http to get (I've added five debugging lines below):
> > > > > >
> > > > > > def open_http(self, url, data=None):
> > > > > > """Use HTTP protocol."""
> > > > > > import httplib
> > > > > > user_passwd = None
> > > > > > proxy_passwd= None
> > > > > > if isinstance(url, str):
> > > > > > host, selector = splithost(url)
> > > > > > print 'HERE1', url, host
> > > > > > if host:
> > > > > > user_passwd, host = splituser(host)
> > > > > > host = unquote(host)
> > > > > > realhost = host
> > > > > > print 'HERE2', host
> > > > > > else:
> > > > > > host, selector = url
> > > > > > print 'HERE3', url, host
> > > > > > # check whether the proxy contains authorization
> > > > information
> > > > > > proxy_passwd, host = splituser(host)
> > > > > > print 'HERE4', host
> > > > > > # now we proceed with the url we want to obtain
> > > > > > urltype, rest = splittype(selector)
> > > > > > url = rest
> > > > > > user_passwd = None
> > > > > > if urltype.lower() != 'http':
> > > > > > realhost = None
> > > > > > else:
> > > > > > realhost, rest = splithost(rest)
> > > > > > if realhost:
> > > > > > user_passwd, realhost = splituser(realhost)
> > > > > > if user_passwd:
> > > > > > selector = "%s://%s%s" % (urltype, realhost,
> > rest)
> > > > > > if proxy_bypass(realhost):
> > > > > > host = realhost
> > > > > > print 'HERE5', host
> > > > > >
> > > > > > #print "proxy via http:", host, selector
> > > > > > if not host: raise IOError, ('http error', 'no host
> > given')
> > > > > >
> > > > > > Wayne
> > > > > >
> > > > > > On Tue, 25 Mar 2008, Jeremy wrote:
> > > > > >
> > > > > > > Thanks for the quick replies. I do not think it is a firewall
> > issue
> > > > > > (although I am behind one), as my
> > > > > > > coworkers (running Linux or Tiger) are able to update just fine.
> > > > > > >
> > > > > > > Any further ideas?
> > > > > > >
> > > > > > > Thanks,
> > > > > > > Jeremy
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
|