this works for me on ac os x:

import string
from urllib2 import Request, urlopen, URLError, HTTPError
url = 'http://www.web2py.com/examples/static/web2py_src.zip'
req = Request(url)
try:
    oFile = urlopen(req)
    latestVersion =
string.strip(string.split(string.split(string.split(oFile.read(),
 
'web2py/VERSION')[1],
                                                             ' (')[0],
                                                'Version ')[1])
except HTTPError as httpErr:
    print('HTTPError: {0}\t{1}'.format(httpErr.code,
                                       url))
except URLError as urlErr:
    print('URLError: {0}\t{1}'.format(urlErr.reason,
                                      url))


mart


On Dec 27, 3:32 pm, Jonathan Lundell <[email protected]> wrote:
> On Dec 27, 2010, at 12:13 PM, reyelts wrote:
>
>
>
> > I do "wget --no-clobber --directory-prefix=blah
> >http://www.web2py.com/examples/static/web2py_src.zip"; followed by
> > "unzip -o -q..." to unravel the file. For both web2py_src.zip and
> > web2py_win.zip, I got "version". In both cases, other file names with
> > uppercase characters were extracted normally (like "Makefile" in the
> > src package and "NEWINSTALL" in the win package). So, files were not
> > indiscriminately renamed to lower case. I have not tried to repeat
> > sine the original occurrence... will try that later when I have a
> > faster connection for the download.
>
> Unfortunately, I can't try this on Windows, so I'm doing it on OS X. Using 
> your wget options, I see this:
>
> blah $ unzip -l web2py_src.zip | grep -i version
>        37  12-22-10 09:31   web2py/VERSION
>
> blah $ unzip -l web2py_win.zip | grep -i version
>        37  12-22-10 09:33   web2py/VERSION
>
> If I create web2py/version first, it gets overwritten with web2py/VERSION 
> when I do the unzip (since OS X's default file system, like Windows', is not 
> case-senstive).
>
> Is it possible that you had a 'version' there to begin with? If so, perhaps 
> it's a Windows unzip peculiarity.
>
>
>
>
>
>
>
>
>
> > On Dec 27, 9:52 am, Jonathan Lundell <[email protected]> wrote:
> >> On Dec 27, 2010, at 7:39 AM, reyelts wrote:
>
> >>> So is this a packaging error when building the source package for
> >>> download from web2py.com?
>
> >> I got VERSION just now when I downloaded it. 
> >> <http://www.web2py.com/examples/static/web2py_src.zip>
>
> >> Is 'version' repeatable for you? What OS and file system, and how are you 
> >> unpacking it?
>
> >>> On Dec 25, 5:22 pm, Jonathan Lundell <[email protected]> wrote:
> >>>> On Dec 25, 2010, at 1:40 PM, reyelts wrote:
>
> >>>>> Either the code should be looking for the name 'version' (since that's
> >>>>> what is shipped) or the file should be renamed 'VERSION' (since that's
> >>>>> what's hardcoded in the source). Shipping 'version' and coding
> >>>>> 'VERSION' is just asking for the problem we currently see.
>
> >>>> FWIW, it's 'VERSION' in the Mercurial source repository.

Reply via email to