473,543 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ssh keepalive

I have a problem with a ssh connection in python

I get the error

'NoneType' object has no attribute 'exec_command'

I am thinking that maybe the ssh connection is timeing out.

Since I have no control over the configuration of the ssh server(which
is AIX 5.23), is there anything I can do in python to ensure that the
ssh session does not timeout?

Oct 1 '08 #1
5 2407
On Wed, 01 Oct 2008 00:30:59 -0700, loial wrote:
I have a problem with a ssh connection in python

I get the error

'NoneType' object has no attribute 'exec_command'

I am thinking that maybe the ssh connection is timeing out.

Since I have no control over the configuration of the ssh server(which
is AIX 5.23), is there anything I can do in python to ensure that the
ssh session does not timeout?
No, it's a NoneType object (i.e. your variable contains None)
Show us a bit of your code, so we can see why is None there.

My guess is that you're trying to perform something on a function that
does things in-place and doesn't return anything (e.g. list.append,
list.sort)
>>a = [1, 3, 4, 2]
a = a.sort()
print a
[None, None, None, None]
>># should be
a = [1, 3, 4, 2]
a.sort()
print a
[1, 2, 3, 4]

Oct 1 '08 #2
On Wed, 01 Oct 2008 08:07:43 +0000, Lie Ryan wrote:
>>>a = [1, 3, 4, 2]
a = a.sort()
print a
[None, None, None, None]
*That* would be really odd. The last line should be just a singel `None`
and not a list. :-)

Ciao,
Marc 'BlackJack' Rintsch
Oct 1 '08 #3
On Wed, 01 Oct 2008 10:47:28 +0000, Marc 'BlackJack' Rintsch wrote:
On Wed, 01 Oct 2008 08:07:43 +0000, Lie Ryan wrote:
>>>>a = [1, 3, 4, 2]
a = a.sort()
print a
[None, None, None, None]

*That* would be really odd. The last line should be just a singel
`None` and not a list. :-)

Ciao,
Marc 'BlackJack' Rintsch
Ah yeah, I originally intended to give a list of list example, but
changed mind and forgot to change that last line.

Oct 1 '08 #4
<<Show us a bit of your code, so we can see why is None there.>>

def command ( self , command ) :
""" process requested command through ssh """
print command
if not self._connected :
return False , "No SSH connection available"
try :
stdin , stdout , stderr =
self._ssh.exec_ command( command )
remoteStdOutCon tent = stdout.readline s()
remoteStdErrCon tent = stderr.readline s()
if remoteStdErrCon tent != [] :
return False , '\n'.join(remot eStdErrContent)
return True , '\n'.join(remot eStdOutContent)
except paramiko.SSHExc eption , e :
# provide socket error reason back
return False , str(e)
Oct 2 '08 #5
En Thu, 02 Oct 2008 05:26:25 -0300, loial <jl********@goo glemail.com>
escribió:
<<Show us a bit of your code, so we can see why is None there.>>
Still not enough.
From your first post, the error was:
'NoneType' object has no attribute 'exec_command'
def command ( self , command ) :
""" process requested command through ssh """
print command
if not self._connected :
return False , "No SSH connection available"
try :
stdin , stdout , stderr =
self._ssh.exec_ command( command )
So you'll have to analyze how (and when) self._ssh might become None. This
function just *uses* self._ssh - look for some other places where
self._ssh is assigned to (or perhaps, deleted, if there is a class
attributes set to None).
--
Gabriel Genellina

Oct 2 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1557
by: unni | last post by:
Whats The Other Option For Keeping Connection Alive ? Since Http.keepalive = True Is Not Working In The Code. Is There Any Thing More Required Along With The Http.keepalive = True
1
9299
by: Cliff Harris | last post by:
I am trying to automate a series of form posts on a website. This site requires that my session be kept alive through successive posts (it basically tracks me by a sessionid, and if I get a new connection each time, I get a new sessionid). An HttpWebRequest object has a KeepAlive property that is, by default, set to true. I have been...
0
2747
by: Kevin | last post by:
Hi, How can you set up the timeout values of the KeepAlive Socket option like you do using WSAIoctl and SIO_KEEPALIVE_VALS using C++ ? Searching about this I found several post of people using the int argument of SetSocketOption thinking it represents some timeout value, but I think it's wrong since 2 values are needed to set up the...
4
4204
by: Kalpesh Modha | last post by:
Hello. I sometimes get this error message "An existing connection was forcibly closed by the remote host" for no reason what so ever in my program. I was wondering keepalives would help in this matter. My program runs fine and then all of a sudden the client dies and this message is what is left in the server logs. If I was to enable...
0
1534
by: Ziphyre | last post by:
Hi, I can't send 'Connection: Keep-Alive' property in the second connection of my HttpWebRequest. Suppose: HttpWebRequest hreq = ..... hreq.KeepAlive = true; HttpWebResponse hresp = GetResp()....
0
979
by: Greg | last post by:
I have a problem with KeepAlives. I need to use them for crawling a secure server, but if I crawl too long the application memory keeps increasing and doesn't decrease. After lots of testing, I've found that KeepAlive is the cause. I've tried setting KeepAlive to false after making the request, but it has not helped. With KeepAlive on,...
1
1578
by: okaminer | last post by:
Hi This is for the experts I have override the GetWebRequest method and set the keepalive property to false in order to overcome a certain in .NET web service problem. My problem now is that when I set keepalive property to false I always get 401 exception access denied. It seems that the credentials doesn't pass with the request no...
2
1731
by: Volker Hetzer | last post by:
Hi! I've got a problem with the GC.keepalive function, as used in the examples at http://msdn2.microsoft.com/en-US/library/system.gc.keepalive.aspx .. There they have a class "Example", construct it and call a method, during which it may get collected. Why would it get collected, before the last method call ends? Is this a bug on the GC or...
3
15511
by: Ryan Liu | last post by:
Hi, I use Server: Use an endless thread to lisiten to clients requests: while(true) { TcpClient client = myListener.AcceptTcpClient();
2
2551
by: Atmapuri | last post by:
Hi! I was looking at the details of how KeepAlive works to handle my unmanaged code interop. Several question came up. Assuming I have: public Test2(Object a) { }
0
7412
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7748
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5892
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3395
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3395
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
979
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.