string encoding regex problem
Roy Smith
roy at panix.com
Fri Aug 15 20:48:46 EDT 2014
In article <lsm8ic$j90$1 at online.de>,
Philipp Kraus <philipp.kraus at 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. 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.
More information about the Python-list
mailing list