SharebeeClub / TCP-IP-CR-Python-CMD

Demo of CR, Python package based on TCP/IP protocol, command line operation mode
MIT License
0 stars 0 forks source link

BrokenPipeError: [Errno 32] Broken pipe #6

Open Samuel-wei opened 1 year ago

Samuel-wei commented 1 year ago

From:https://github.com/Dobot-Arm/TCP-IP-Nova-Python or: https://github.com/Dobot-Arm/TCP-IP-CR-Python-CMD Output error:

Image

Samuel-wei commented 1 year ago

Another thread inhttps://github.com/SharebeeClub/TCP-IP-CR-Python-CMD/issues/7

Samuel-wei commented 1 year ago

@JiangkuoWang 问题的原因大概在这个方向上https://github.com/SharebeeClub/TCP-IP-CR-Python-CMD/issues/7 Solving method: http://icejoywoo.github.io/2019/03/15/python-broken-pipe-error.html

# 方法1:捕获异常

import sys, errno
try:
    ### IO operation ###
except IOError as e:
    if e.errno == errno.EPIPE:
        ### Handle error ###

# 方法2:忽略信号
from signal import signal, SIGPIPE, SIG_DFL, SIG_IGN
signal(SIGPIPE, SIG_IGN)

# 恢复默认信号行为的方法
# signal(SIGPIPE, SIG_DFL)