Atttribute error

HMS Surprise john at datavoiceint.com
Tue May 8 12:47:53 EDT 2007


On May 8, 11:37 am, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> In <1178641784.974581.14... at p77g2000hsh.googlegroups.com>, 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




More information about the Python-list mailing list