Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76391
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.szaf.org!news.gnuher.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail |
|---|---|
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: string encoding regex problem |
| Date | Sat, 16 Aug 2014 04:08:20 +0200 |
| Organization | 1&1 Internet AG |
| Lines | 50 |
| Message-ID | <lsmeej$49n$1@online.de> (permalink) |
| References | <lsm8ic$j90$1@online.de> <roy-7B58DA.20484615082014@news.panix.com> |
| NNTP-Posting-Host | p3e9e6350.dip0.t-ipconnect.de |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | online.de 1408154899 4407 62.158.99.80 (16 Aug 2014 02:08:19 GMT) |
| X-Complaints-To | abuse@einsundeins.com |
| NNTP-Posting-Date | Sat, 16 Aug 2014 02:08:19 +0000 (UTC) |
| User-Agent | Unison/2.1.10 |
| Xref | csiph.com comp.lang.python:76391 |
Show key headers only | View raw
On 2014-08-16 00:48:46 +0000, Roy Smith said:
> In article <lsm8ic$j90$1@online.de>,
> Philipp Kraus <philipp.kraus@flashpixx.de> wrote:
>
>> found = re.search( "<a
>> href=\"/projects/boost/files/latest/download\?source=files\"
>> title=\"/boost/(.*)",
>> Utilities.URLReader("http://sourceforge.net/projects/boost/files/boost/")
>> )
>> if found == None :
>> raise MyError.StopError("Boost Download URL not found")
>>
>> But found is always None, so I cannot get the correct match. I didn't
>> find the error in my code.
>
> I would start by breaking this down into pieces. Something like:
>
>> data =
>> Utilities.URLReader("http://sourceforge.net/projects/boost/files/boost/")
>>
>> )
>> print data
>> found = re.search( "<a
>> href=\"/projects/boost/files/latest/download\?source=files\"
>> title=\"/boost/(.*)",
>> data)
>> if found == None :
>> raise MyError.StopError("Boost Download URL not found")
>
> Now at least you get to look at what URLReader() returned. Did it
> return what you expected? If not, then there might be something wrong
> in your URLReader() function.
I have check the result of the (sorry, I forgot this information on my
first post). The URLReader
returns the HTML code of the URL, so this seems to work correctly
> If it is what you expected, then I would
> start looking at the pattern to see if it's correct. Either way, you've
> managed to halve the size of the problem.
The code works till last week correctly, I don't change the pattern. My
question is, can it be
a problem with string encoding? Did I mask the question mark and quotes
correctly?
Phil
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
string encoding regex problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-08-16 02:27 +0200
Re: string encoding regex problem Roy Smith <roy@panix.com> - 2014-08-15 20:48 -0400
Re: string encoding regex problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-08-16 04:08 +0200
Re: string encoding regex problem Roy Smith <roy@panix.com> - 2014-08-15 22:14 -0400
Re: string encoding regex problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-16 14:35 +1000
Re: string encoding regex problem Peter Otten <__peter__@web.de> - 2014-08-16 11:01 +0200
Re: string encoding regex problem Philipp Kraus <philipp.kraus@flashpixx.de> - 2014-08-23 22:46 +0200
Re: string encoding regex problem Peter Otten <__peter__@web.de> - 2014-08-23 23:13 +0200
csiph-web