python结构执行错误

时间:2017-09-06 09:59:12

标签: python python-2.7 fabric

我用fab.exe执行fabric并直接运行python脚本。

但它显示错误。

我的电脑是Windows 7,Python 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 个答案:

答案 0 :(得分:0)

我破解了C:\ Python27 \ lib \ ntpath.py文件。 将此源代码添加到该文件的标头中。 (17行)

<table border=1>
    <thead>
        <tr>
            <th rowspan="2">Seq N0</th>
            <th rowspan="2">Student Id</th>
            <th colspan="2">maths</th>
            <th colspan="2">art</th>
        </tr>
        <tr>
            <td>Exam 1</td>
            <td>Exam 2</td>
            <td>Exam 1</td>
            <td>Exam 2</td>  
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>1</td>
            <td>82</td>
            <td>90</td>
            <td>60</td>
            <td>82</td>
        </tr>
        <tr>
            <td>1</td>
            <td>1</td>
            <td>82</td>
            <td>90</td>
            <td>60</td>
            <td>82</td>
        </tr>
    </tbody>
</table>

然后,错误消失。面料做得很好。

但我不知道理由。 我的电脑有什么问题?

我想在没有黑客的情况下解决这个问题。