Using filepath method to identify an .html page

Chris Angelico rosuav at gmail.com
Tue Jan 22 07:26:36 EST 2013


On Tue, Jan 22, 2013 at 10:53 PM, Ferrous Cranus <nikos.gr33k at gmail.com> wrote:
> # ==================================================
> # produce a hash based on html page's filepath and convert it to an integet, that will be uses to identify the page itself.
> # ==================================================
>
> pin = int( hashlib.md5( htmlpage ) )
>
>
> I just tried that but it produced an error.
> What am i doing wrong?

First and foremost, here's what you're doing wrong: You're saying "it
produced an error". Python is one of those extremely helpful languages
that tells you, to the best of its ability, exactly WHAT went wrong,
WHERE it went wrong, and - often - WHY it failed. For comparison, I've
just tonight been trying to fix up a legacy accounting app that was
written in Visual BASIC back when that wouldn't get scorn heaped on
you from the whole world. When we fire up one particular module, it
bombs with a little message box saying "File not found". That's all.
Just one little message, and the application terminates (uncleanly, at
that). What file? How was it trying to open it? I do know that it
isn't one of its BTrieve data files, because when one of THEM isn't
found, the crash looks different (but it's still a crash). My current
guess is that it's probably a Windows DLL file or something, but it's
really not easy to tell...

ChrisA



More information about the Python-list mailing list