我最近将 Tronxy 3D 打印机通过 USB 串行连接连接到运行 Ubuntu Server 20.04 的 Linux 机器。我希望使用 Pronsole(printrun 工具套件中的一个实用程序)来帮助诊断一些自定义宏的问题。我能够启动 Pronsole 环境并使用connect
命令连接到打印机,并且没有收到任何问题或错误。但是,当我通过 Pronsole(例如)将 gcode 命令直接推送到打印机时,G28
我从命令行得到以下输出。我对 Linux 错误或 Python 还不够熟悉,无法阅读这些错误或不知道通过 google 搜索什么来找到解决方案。我想我真的只是在寻求解释方面的帮助。
ttyUSB1 22°> G28
SENDING:G28
ttyUSB1 22°> Exception in thread read thread:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 333, in \_readline
line\_bytes = self.\_readline\_nb()
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 329, in \_readline\_nb
return self.printer.readline()
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 595, in read
raise SerialException(
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in \_bootstrap\_inner
[self.run](https://self.run)()
File "/usr/lib/python3.10/threading.py", line 953, in run
self.\_target(\*self.\_args, \*\*self.\_kwargs)
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 420, in \_listen
line = self.\_readline()
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 354, in \_readline
if 'Bad file descriptor' in e.args\[1\]:
IndexError: tuple index out of range
Can't write to printer (disconnected ?):
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 621, in write
n = os.write(self.fd, d)
OSError: \[Errno 5\] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 750, in \_send
self.printer.write((command + "\\n").encode('ascii'))
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 655, in write
raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: \[Errno 5\] Input/output error
Can't write to printer (disconnected ?):
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 621, in write
n = os.write(self.fd, d)
OSError: \[Errno 5\] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 750, in \_send
self.printer.write((command + "\\n").encode('ascii'))
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 655, in write
raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: \[Errno 5\] Input/output error
Can't write to printer (disconnected ?):
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 621, in write
n = os.write(self.fd, d)
OSError: \[Errno 5\] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 750, in \_send
self.printer.write((command + "\\n").encode('ascii'))
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 655, in write
raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: \[Errno 5\] Input/output error
Can't write to printer (disconnected ?):
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 621, in write
n = os.write(self.fd, d)
OSError: \[Errno 5\] Input/output error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/printrun/printcore.py", line 750, in \_send
self.printer.write((command + "\\n").encode('ascii'))
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 655, in write
raise SerialException('write failed: {}'.format(e))
serial.serialutil.SerialException: write failed: \[Errno 5\] Input/output error
Disconnecting after 4 failed writes.
答案1
好吧,事实证明我的问题是硬件问题,而不是软件问题。每当 3D 打印机尝试执行命令时,就会发生电源骤降,USB 串行控制器会短暂失去与主机的连接。