本帖最后由 小白龙 于 2025-7-7 08:58 编辑
正在使用chilkat2-python库, https://www.chilkatsoft.com/chilkat2-python.asp
把下面的代码, 存为a.py, 然后使用命令行 python a.py 执行会报下面的错误
C:\Users\admin\Desktop>python a.py
Traceback (most recent call last):
File "C:\Users\admin\Desktop\a.py", line 8, in <module>
print(csv.LastErrorText)
^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 451: invalid continuation byte
- import sys
- import chilkat2
- csv = chilkat2.Csv()
- success = csv.LoadFile(r"C:\Users\Administrator\Desktop\sample.csv")
- if success != True:
- print(csv.LastErrorText)
- sys.exit()
复制代码 把下面的代码, 存为b.py, 然后使用命令行 python b.py 执行后会正常显示错误日志- import chilkat2
- ssh = chilkat2.Ssh()
- port = 22
- success = ssh.Connect("abc.xxxxxxxx.com", port)
- if (success != True):
- print(ssh.LastErrorText)
- exit()
复制代码 正常的错误日志格式如下
ChilkatLog:
Connect_Ssh:
DllDate: Apr 29 2025
ChilkatVersion: 11.0.0
UnlockBundle has not yet been called.
UnlockStatus: 0
Architecture: Little Endian; 32-bit
Language: Python 3.13.5 (tags/v3.13.5:6cb20a2, Jun 11 2025, 15:56:57) [MSC v.1943 32 bit (Intel)], win32
VerboseLogging: 0
Auto unlock for 30-day trial
UnlockStatusMsg: Unlocked for 30-day trial
UnlockStatus: 1
connectInner:
hostname: abc.78zab.com
port: 22
sshConnect:
connectSocket_v2:
connect_domain:
ckDnsResolveDomainIPv4_n:
domainName: abc.78zab.com
retry:
revert_to_old_dns:
domain: abc.78zab.com
ck_getaddrinfo:
getAddressInfo:
hostOrIpAddr: abc.78zab.com
failPoint: 103
rc: 11001
SocketError: WSAHOST_NOT_FOUND No such host is known.
hostOrIpAddr: abc.78zab.com
Versions of Windows earlier than Windows XP are limited to handling IPv4 only
On Windows Server 2003 and Windows XP, IPv6 addresses are returned only if IPv6 is installed on the local computer.
--getAddressInfo
getAddressInfo failed.
--ck_getaddrinfo
ck_getaddrinfo failed, retrying with gethostbyname.
dns_gethostbyname:
hostname: abc.78zab.com
--dns_gethostbyname
failed.
--revert_to_old_dns
domain: abc.78zab.com
DNS resolution failed.
--retry
nameservers:
ip: 192.168.1.1
--nameservers
No valid DNS answer..
domain: abc.78zab.com
Check to see if the domain is valid by trying a DNS lookup at https://mxtoolbox.com/DNSLookup.aspx
--ckDnsResolveDomainIPv4_n
--connect_domain
--connectSocket_v2
Failed to establish initial TCP/IP connection
hostname: abc.78zab.com
port: 22
--sshConnect
--connectInner
Failed.
--Connect_Ssh
--ChilkatLog |