如何调试远程python脚本? [英] How to debug remote python script?

查看:41
本文介绍了如何调试远程python脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种调试远程 python 脚本的方法,无需像

似乎 pyCharm 负责所有调试设置 --multiproc --qt-support --client '0.0.0.0' --port 46994 但我有错误的配置.

有没有办法调试python脚本而不用pydevd.settrace('host', port=21000, stdoutToServer=True, stderrToServer=True) 和其他动作?

解决方案

我能够通过重新安装 PyCharm 来解决这个问题.(#1 和 5 是可选的)

  1. 导出您要恢复的最低设置,例如键盘映射(文件 > 导出设置)
  2. 卸载当前的 PyCharm
  3. 安装新的 PyCharm
  4. 启动新的 PyCharm 并且不要在第一次启动时导入您预先存在的设置
  5. 从旧的 PyCharm 导入您的设置(文件 > 导入设置)

我猜当某些环境相关设置搞砸时会发生这种情况.请注意,您需要记住远程解释器的设置,因为它会在重新安装时消失.

I am looking for a way to debug remote python script without any set up like in the answer here

I set remote interpreter, set up a debug configuration, click a debug button and got error Event not found:

ssh://myuser@my_ip:my_port/usr/local/bin/python -u /myuser/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support --client '0.0.0.0' --port 46994 --file /opt/my_work_dir/my_script.py
/: Event not found.

Seems like pyCharm takes care about all debug setting --multiproc --qt-support --client '0.0.0.0' --port 46994 but I have the wrong configuration.

Is there a way how to debug python script without putting pydevd.settrace('host', port=21000, stdoutToServer=True, stderrToServer=True) and other actions?

解决方案

I was able to fix this problem by reinstalling PyCharm. (# 1 and 5 are optional)

  1. Export minimum settings you want to restore such as Keymap (File > Export Settings)
  2. Uninstall your current PyCharm
  3. Install new PyCharm
  4. Launch new PyCharm and don't import your pre-existing setting at the first start up
  5. Import your settings from the old PyCharm (File > Import Settings)

I guess this happens when some environment related settings are messed up. Notice that you need to remember your settings for the remote interpreter as it will be gone when reinstalling.

这篇关于如何调试远程python脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆