主要問題是封裝后,,調(diào)用paramiko時,,會有兩個錯誤發(fā)生: 錯誤一: Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/cx_Freeze/initscripts/Console.py", line 29, in <module> exec code in m.__dict__ File "RelightMultiRender.py", line 20, in <module> File "/JGHome/xiangquan/eric/RelightMultiRender/response.py", line 16, in <module> from Ui_MainWindow import Ui_MainWindow File "/JGHome/xiangquan/eric/RelightMultiRender/Ui_MainWindow.py", line 12, in <module> import paramiko File "/usr/lib/pymodules/python2.6/paramiko/__init__.py", line 69, in <module> from transport import randpool, SecurityOptions, Transport File "/usr/lib/pymodules/python2.6/paramiko/transport.py", line 34, in <module> from paramiko.channel import Channel File "/usr/lib/pymodules/python2.6/paramiko/channel.py", line 36, in <module> from paramiko import pipe ImportError: cannot import name pipe 發(fā)生問題的原因是cx_freeze不知為什么沒有把paramiko中的pipe.pyc文件封裝到library.zip中,解決方法是解壓library.zip,,將缺少的pipe.pyc文件添加到其中的paramiko文件夾中,再重新打包為library.zip,,然后替換掉舊的文件包,。 錯誤二: 運行程序到連接ssh時,會出現(xiàn)“ LookupError: unknown encoding: idna ” ,。 idna:Internationalized domain name,, 用來做遠(yuǎn)程連接的文字編碼。 光在源文件import部分添加from encodings import idna是不夠的,,因為idna.py文件里也用到了ascii編碼,,因此也需要引用ascii.py才行,所以最終需要在文件引用部分添加: from encodings import ascii from encodings import idna 兩句,,然后再重新封裝,。 |
|