vs2013下的python远程调试支持(2) :工程调试

当我们按F5启动python工程调试时,PTVS以下面的参数调用PythonWrapper

visualstudio_py_laucher.py中明确指明了此文件可以接受的参数含义:

# Arguments are:

# 1. Working directory.

# 2. VS debugger port to connect to.

# 3. GUID for the debug session.

# 4. Debug options (as integer - see enum PythonDebugOptions).

# 5. '-m' or '-c' to override the default run-as mode. [optional]

# 6. Startup script name.

# 7. Script arguments.

与交互窗口的修改一样,我们做同样的处理,所不同的是这里需要将要调试的Python文件复制到Linux主机上,而后相应修改文件路径。

经过此处理后,vspython调试功能就可以正常使用了。

但当我们打开一个交互调试的窗口并输入语句时就悲剧了:

Unhandled exception in thread started by <bound methodDebuggerLoop.connect_to_repl_backend of<visualstudio_py_debugger.DebuggerLoop object at 0xb751d30c>>

Traceback (most recent call last):

  File"/usr/local/lib/python2.7/socket.py", line 228, in meth

    returngetattr(self._sock,name)(*args)

error: [Errno 111] Connection refused

Press Enter to continue . . .

想来除了调试用的端口外,PTVS还打开了一个交互调试用的端口。

查看visualstudio_py_debugger.py文件可以很容易发现此端口的痕迹:

    defcommand_connect_repl(self):

        port_num =read_int(self.conn)

       _start_new_thread(self.connect_to_repl_backend, (port_num,))

同样在PythonWrapper中将此端口做个转发,搞定!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值