No module named urllib

HMS Surprise john at datavoiceint.com
Mon May 7 19:41:49 EDT 2007


On May 7, 6:31 pm, Jorge Godoy <jgo... at gmail.com> wrote:
> HMS Surprise <j... at datavoiceint.com> writes:
> > Since sys.path = ['.', 'C:\\maxq\\lib\\Lib', 'C:\\maxq\\jython'] I
> > copied urllib to c:\maxq\lib\Lib.
>
> > Now I get the error -
>
> > Traceback (innermost last):
> >   File "<string>", line 5, in ?
> >   File "C:\maxq\lib\Lib\urllib.py", line 1148
> >    _hextochr = dict(('%02x' % i, chr(i)) for i in range(256))
> >                                          ^
> > SyntaxError: invalid syntax
> >>> dict(1, 1)
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: dict expected at most 1 arguments, got 2
>
> >>> dict(a=1)
> {'a': 1}
>
> --
> Jorge Godoy      <jgo... at gmail.com>

Using the 18.5.2 Examples and a few lines added in

from CompactTest import CompactTest
import sys
print sys.path
import urllib

class login(CompactTest):
    # Recorded test actions.
    def runTest(self):
        self.msg('Test started')

        opener = urllib.FancyURLopener({})
        f = opener.open("http://www.python.org/")
        f.read()


# Code to load and run the test
if __name__ == 'main':
    login('login').Run()




More information about the Python-list mailing list