Bug in urllib?

2006-10-14 Thread goyatlah
urllib.url2pathname("http://127.0.0.1:1030/js.cgi?pca&r=12181";) gives IOError : Bad Url, only coz of the :1030 which should be accurate portnumber. Is it something I did wrong, or a bug. And what to do to avoid this (except rewriting url2pathname)? TIA Dolf -- http://mail.python.org/mailman/lis

Re: problem with split

2006-10-06 Thread goyatlah
Think you need a regex like this: regex = r"\s*instr\s+([0-9]+)\s*(;.*)?" Then: import re test = re.compile(regex) testing is done as follows: res = test.match(mystring) if res: number = res.group(1) # always a string consisting of decimals comment = res.group(2) # string starting with ;

Re: dictionary containing a list

2006-10-06 Thread goyatlah
I think what you mean is that if you change your list, it is changed somewhere in your dicrionary to. Lists are always copied as pointers, except explicitly told other wise. So a = b = [] makes a and be the same list, and a.append(1) makes b -> [1]. So do something like mydict[mykey] = mylist[:] (

Re: Restoring override of urllib.URLopener.open_https

2006-10-05 Thread goyatlah
I think that you need a superclass above the M2Crypto one, and change the open_https method back to the urllibs one. Moi Dolf On Thu, 5 Oct 2006 15:09:22 GMT, Bakker A <[EMAIL PROTECTED]> wrote: >Hi, > >the M2Crypto library overrides the urllib.URLopener.open_https method, >causing a urllib.urlo

Urlnames in urllib2

2006-10-04 Thread goyatlah
I'm trying to figure out how to get the exact opened url after a urlopen in urllib2. Say you have a link : http://myhost/mypath : what do I get back, - the file mypath on myhost - the file index.html on myhost/mypath, - or maybe something else. Snd what about the following: http;//myhost/index.htm