2017-09-06 127 views
0

我用兩個fab.exe執行fabric並直接運行python腳本。python結構執行錯誤

但它顯示錯誤。

我的電腦是Windows 7中,巨蟒2.7.13

Traceback (most recent call last): 
     File "C:\fabric_test.py", line 3, in <module> 
     from fabric.api import run,env,execute,task 
     File "C:\Python27\lib\site-packages\fabric\api.py", line 10, in <module> 
     from fabric.context_managers import (cd, hide, settings, show, path, prefix, 
     File "C:\Python27\lib\site-packages\fabric\context_managers.py", line 41, in <module> 
     from fabric.state import output, win32, connections, env 
     File "C:\Python27\lib\site-packages\fabric\state.py", line 9, in <module> 
     from fabric.network import HostConnectionCache, ssh 
     File "C:\Python27\lib\site-packages\fabric\network.py", line 24, in <module> 
     import paramiko as ssh 
     File "C:\Python27\lib\site-packages\paramiko\__init__.py", line 31, in <module> 
     from paramiko.transport import SecurityOptions, Transport 
     File "C:\Python27\lib\site-packages\paramiko\transport.py", line 56, in <module> 
     from paramiko.dsskey import DSSKey 
     File "C:\Python27\lib\site-packages\paramiko\dsskey.py", line 27, in <module> 
     from cryptography.hazmat.primitives.asymmetric.utils import (
     File "C:\Python27\lib\site-packages\cryptography\hazmat\primitives\asymmetric\utils.py", line 9, in <module> 
     from asn1crypto.algos import DSASignature 
     File "C:\Python27\lib\site-packages\asn1crypto\algos.py", line 23, in <module> 
     from ._int import fill_width 
     File "C:\Python27\lib\site-packages\asn1crypto\_int.py", line 56, in <module> 
     from ._perf._big_num_ctypes import libcrypto 
     File "C:\Python27\lib\site-packages\asn1crypto\_perf\_big_num_ctypes.py", line 31, in <module> 
     libcrypto_path = find_library('crypto') 
     File "C:\Python27\lib\ctypes\util.py", line 53, in find_library 
     fname = os.path.join(directory, name) 
     File "C:\Python27\lib\ntpath.py", line 85, in join 
     result_path = result_path + p_path 
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xbc in position 21: ordinal not in range(128) 

什麼問題?

+1

你能夠將文本編解碼器從'ascii'改爲'utf8'嗎? –

+0

@JeffHuijsmans我不知道如何更改文本編解碼器。但我認爲原因不在我的源文件上。剛運行'fab.exe'時出現同樣的錯誤。 – jo8937

+0

請發佈您的'C:\ fabric_test.py' –

回答

0

我破解了C:\ Python27 \ lib \ ntpath.py文件。 將此源代碼添加到該文件的標題。 (17行)

reload(sys) 
sys.setdefaultencoding('euc-kr') 

然後,錯誤消失。面料工作正常。

但我不知道原因。 我的電腦有什麼問題?

我想解決這個問題沒有黑客。