Python论坛  - 讨论区

标题:[python-chinese] urgent!

2006年02月23日 星期四 15:47

cry zyqmail at tom.com
Thu Feb 23 15:47:15 HKT 2006

python,您好!

下面的程序:
        conn = httplib.HTTPConnection("XXX.XXX.XXX.XXX:8009")
        conn.request("POST", "/", xmlquery)
出现错误:
  File "mobilereg.py", line 48, in AofaReg
    conn.request("POST", "/", xmlquery)
  File "/usr/local/lib/python2.4/httplib.py", line 800, in request
    self._send_request(method, url, body, headers)
  File "/usr/local/lib/python2.4/httplib.py", line 817, in _send_request
    self.putrequest(method, url, **skips)
  File "/usr/local/lib/python2.4/httplib.py", line 750, in putrequest
    self.putheader('Host', "%s:%s" % (self.host.encode("idna"), self.port))
LookupError: unknown encoding: idna

如果用PYTHON XXX.PY运行,则没有错误,用FREEZE后就不行。
环境:LINUX

谢谢。

                    致
礼!

            cry
            zyqmail at tom.com



[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年02月23日 星期四 21:34

limodou limodou at gmail.com
Thu Feb 23 21:34:46 HKT 2006

On 2/23/06, cry <zyqmail at tom.com> wrote:
> python,您好!
>
> 下面的程序:
>         conn = httplib.HTTPConnection("XXX.XXX.XXX.XXX:8009")
>         conn.request("POST", "/", xmlquery)
> 出现错误:
>   File "mobilereg.py", line 48, in AofaReg
>     conn.request("POST", "/", xmlquery)
>   File "/usr/local/lib/python2.4/httplib.py", line 800, in request
>     self._send_request(method, url, body, headers)
>   File "/usr/local/lib/python2.4/httplib.py", line 817, in _send_request
>     self.putrequest(method, url, **skips)
>   File "/usr/local/lib/python2.4/httplib.py", line 750, in putrequest
>     self.putheader('Host', "%s:%s" % (self.host.encode("idna"), self.port))
> LookupError: unknown encoding: idna
>
> 如果用PYTHON XXX.PY运行,则没有错误,用FREEZE后就不行。
> 环境:LINUX
>

这说明编码不对。原因我想源码运行时可能从encodings下找个idna的编码。但freeze后可能没有把encodings目录打全,因此找不到了。

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号