import unknown module name

deckerben bdeck at lycos.co.uk
Thu Jan 9 19:42:08 EST 2003


Hello,


I did some looking but I haven't been able to find an example how to import
an unknown encoding from 'encodings'.

I tried something like this:

def to_uni(instring, oldpage):
    # print instring, oldpage, "\n"
    try:
        pagename = "encodings." + oldpage
        charset = __import__(pagename)
        codepage = charset
    except:
        print "ERROR s2code.to_uni:", oldpage, "codepage not in
encodings.\n"
        return


But it just returns "encodings".

Any advice?

Ben






More information about the Python-list mailing list