命令在SSH上工作,但不使用Parami

2024-10-01 09:19:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我和帕拉米科有点小问题。似乎所有的命令都不像手动ssh会话那样执行。在

让我们把重点放在“history”shell命令上,即使我主要关心的是这个命令:

$ python /home/metrosim/src/urbansim/tools/make_indicators.py \
-x /home/metrosim/project_configs/paris_zone_ovh_km130110.xml \
-c /home/metrosim/data/paris_zone/base_year_data_a \
-i trip_generation -y [1999]

两者都可以使用手动ssh会话,但不能使用paramiko,但是像ls -lA这样的简单命令可以工作。在

这是我的代码:

^{pr2}$

Tags: 命令srczone重点homedata手动shell
1条回答
网友
1楼 · 发布于 2024-10-01 09:19:21

如果要模拟shell会话,请尝试使用^{}而不是^{}。在

来自invoke_shell文档:

Request an interactive shell session on this channel. If the server allows it, the channel will then be directly connected to the stdin, stdout, and stderr of the shell.

Normally you would call get_pty before this, in which case the shell will operate through the pty, and the channel will be connected to the stdin and stdout of the pty.

When the shell exits, the channel will be closed and can't be reused. You must open a new channel if you wish to open another shell.

相关问题 更多 >