drcoms / drcom-generic

Dr.COM/DrCOM 现已覆盖 d p x三版。
GNU Affero General Public License v3.0
1.15k stars 268 forks source link

[bug]python中finally问题 #375

Open FredyVia opened 2 years ago

FredyVia commented 2 years ago

finally里面的return覆盖原有的return ref:python finally 问题

dadavinson commented 2 years ago

已收到,谢谢|

FredyVia commented 2 years ago

还有个小问题,不知道是不是python版本问题(使用3.9.10 和 3.9.7均有该问题): bind_nic() 函数中struct.pack('256s', ifname[:15])报错

Traceback (most recent call last):
  File "/root/wan1.py", line 66, in <module>
    bind_ip = bind_nic()
  File "/root/wan1.py", line 57, in bind_nic
    return get_ip_address(nic_name)
  File "/root/wan1.py", line 55, in get_ip_address
    struct.pack('256s', ifname[:15])
struct.error: argument for 's' must be a bytes object

改为struct.pack('256s', ifname[:15].encode('utf-8'))后正常