简体   繁体   English

如何在Arduino Yun上调试Python

[英]How to debug Python on Arduino Yun

How can you: 你怎么:

  1. Print debugging messages from a Python script? 从Python脚本打印调试消息?
  2. Access those messages in real-time on a remote device (Arduino Yun) you're SSH'ed into? 在您通过SSH进入的远程设备(Arduino Yun)上实时访问这些消息?

So far, I've been making changes, copying them to the Yun, restarting it, and doing all this without the benefit of debugging. 到目前为止,我一直在进行更改,将它们复制到Yun中,然后重新启动它,并且所有这些操作都没有调试的好处。 (I have to test on the Yun itself.) (我必须对Yun本身进行测试。)

In a Python script, you can give yourself messages like this: print("var x = {0}; y = {1}".format(x, y)) 在Python脚本中,您可以给自己这样的消息: print("var x = {0}; y = {1}".format(x, y))

Run python path/to/file.py (while SSH'ed) to access the server w/real-time logs. 运行python path/to/file.py (通过SSH进行访问)以使用实时日志访问服务器。

If the server is already running, you can do ps | grep python 如果服务器已经在运行,则可以执行ps | grep python ps | grep python then kill XXXX for the running process, then run the above instruction again. ps | grep python然后kill XXXX正在运行的进程的kill XXXX ,然后再次运行以上指令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM