sgmllib.py
elsa
kerensaelise at hotmail.com
Sun Aug 23 23:51:00 EDT 2009
Hi all,
I'm new to both this forum and Python, and I've got a bit stuck trying
to learn how to parse HTML.... here is my problem
I'm using a textbook that uses sgmllib.py for all its examples. I'm
aware that sgmllib is not in the current release, however I want to
get it to work, as I have python 2.5, and the text book uses it.
So, the first example says to type something like (to test the
sgmllib):
python sgmllib.py "path/to/my/file.html" .... example (1)
this doesn't work for me. I think I have figured out the problem -
the error says
"/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/
Python.app/Contents/MacOS/Python: can't open file 'sgmllib.py': [Errno
2] No such file or directory"
the problem is that this path is wrong. My sgmllib.py is in:
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/sgmllib.py"
if I substitute this path for sgmllib.py in example (1), everything
works fine. However, I don't want to do all that typing everytime I
want to use sgmllib.py. So, I thought maybe the problem was with
PYTHONPATH. I executed the following command:
export PYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/
2.5/li/python2.5:$PYTHONPATH
this seemed to work - no errors raised. However, when I retyped
example (1), I got the same original error.
Any assistance would be much appreciated. I'm working on max os x
leopard.
Thanks,
elsa
More information about the Python-list
mailing list