You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into some problems using Paramiko to SSH to my server A:
My server is Centos7. I edit my .bashrc file on server A exec /data/install/bin/zsh to start ZSH, because I do not have root permission.
When I tried to connect to server A locally using Paramiko and execute commands, it seemed to work, but executing commands using exec_command didn't get the correct results.
When I comment the ZSH related statements in my .bashrc with "#", Paramiko exec_command returns normal result.
When I have exec /data/install/bin/ ZSH in my.bashrc file, this Python code freezes and keeps running with no return unless I use CTRL +C to force it to end. Error info as follow:
File "", line 1, in
File "/data/nich/software/miniconda/lib/python3.9/site-packages/paramiko/file.py", line 200, in read
new_data = self._read(self._DEFAULT_BUFSIZE)
File "/data/nich/software/miniconda/lib/python3.9/site-packages/paramiko/channel.py", line 1361, in _read
return self.channel.recv(size)
File "/data/nich/software/miniconda/lib/python3.9/site-packages/paramiko/channel.py", line 699, in recv
out = self.in_buffer.read(nbytes, self.timeout)
File "/data/nich/software/miniconda/lib/python3.9/site-packages/paramiko/buffered_pipe.py", line 160, in read
self._cv.wait(timeout)
File "/data/nich/software/miniconda/lib/python3.9/threading.py", line 312, in wait
waiter.acquire()
KeyboardInterrupt
When I comment the ZSH related info with "#", the program returns a normal result:
b'2021.9.3.file\ntestfile.txt\n'
My question is :
My server A still wants to keep the ZSH-related configuration because I'm used to working with ZSH (can not work without zsh).
When I connect to server A using Paramiko, how do I execute commands and return results?
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered:
i had same issue,but could use invoke_shell to get command output
I had solved it by moving exec zsh from .bashrc to .bash_profile.
The reason seems to related to which file was load when ssh to a server. I can't explain it well.
You can search the difference between bashrc and bash_profile.
i had same issue,but could use invoke_shell to get command output
I had solved it by moving exec zsh from .bashrc to .bash_profile.
The reason seems to related to which file was load when ssh to a server. I can't explain it well. You can search the difference between bashrc and bash_profile.
In fact, the problem is that the paramiko is used to log in to the IBMC of some servers. After the exec_cmd command is executed, the result cannot be obtained. In this case, i need to manually run the send and recv method.
Hello guys,
I ran into some problems using Paramiko to SSH to my server A:
My server is Centos7. I edit my .bashrc file on server A
exec /data/install/bin/zsh
to start ZSH, because I do not have root permission.When I tried to connect to server A locally using Paramiko and execute commands, it seemed to work, but executing commands using exec_command didn't get the correct results.
When I comment the ZSH related statements in my .bashrc with "#", Paramiko exec_command returns normal result.
A code example is as follows:
When I have
exec /data/install/bin/ ZSH
in my.bashrc file, this Python code freezes and keeps running with no return unless I use CTRL +C to force it to end. Error info as follow:When I comment the ZSH related info with "#", the program returns a normal result:
My question is :
My server A still wants to keep the ZSH-related configuration because I'm used to working with ZSH (can not work without zsh).
When I connect to server A using Paramiko, how do I execute commands and return results?
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered: