On May 8, 11:37 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, HMS Surprise > wrote: > > > The snippet below causes an attribute error. > > > AttributeError: module 'urllib' has no attribute 'urlopen' > > > I am using python 2.2.3. According to the documentation at C: > > \Python22\Doc\lib urllib has a function called urlopen. > > Do you have a file called `urllib.py` in the current directory? Then this > gets imported instead of the module in the standard library. > > Add this directly after the ``import`` to see what's happening: > > print urllib.__file__ > print dir(urllib) > > Ciao, > Marc 'BlackJack' Rintsch
Thanks for posting Marc. I do have a file named `urllib.py` in the current directory. I copied it from 'C:\Python22\Lib' as I could not get rid of the 'no module named urllib' error message, even though I appended 'C:\Python22\Lib to sys.path'. This changed the error from module not found to a no attribute msg. The maxq program (IDE?, runtime enviroment? , shell?) apparently uses jython so maybe sys.path is not the problem. This is the reason for my thread 'sys.path'. Thanks again, jh -- http://mail.python.org/mailman/listinfo/python-list