basic question on loop & type casting / list/str/array

2022-03-16 Thread Kiran Kumar
Hi.

Pls check on below poython 3.9.x code & suggest how can i keep the string 
intactst in 2nd loop... ? these are aws ec2 ids

>>> INSTANCE_ID = ['i-0dccf1ede229ce1','i-0285506fee62051']

>>> for i in INSTANCE_ID:
...   print (i)
...
i-0dccf1ede229ce1
i-0285506fee62051
>>>
>>>
>>>
>>> for i in INSTANCE_ID:
...   for j in i:
... print (j)
...
i
-
0
d
c
c
f
1
e
d
e
2
2
9
c
e
1
i
-
0
2
8
5
5
0
6
f
e
e
6
2
0
5
1
>>>


Thanks 
Kiran
-- 
https://mail.python.org/mailman/listinfo/python-list


Is there a memory leakage in this embedded python code?

2006-12-09 Thread kiran kumar
Hi All,
I am working on embedded python on C these days. I feel there is a
memory leakage in this code. I have used our own memory pool and all
the python code will use the heap from this memory pool.
RunScript(pScriptName,pFuncName,...)
{
PyEval_AcquireLock()
threadState = Py_NewInterpreter();
PyThreadState_Swap(threadState);

/* Import the script module and run the fnc in that script module */
Pyobject *pModule = PyImport_Import(pScriptName);
PyObject *pFunc = PyObject_GetAttrString(pModule, pFuncName);

/* End running the script and calling the script fnc */
Py_EndInterpreter(threadState);
PyEval_ReleaseLock();
}

Befor running this code i checked my memory heap pool available
memory. Then i called the above function to run my script script1.py.
Script ran succesfully, but after completion of the above fnc, when i
checked the memory there is a huge KB of memory is used by this code.
I have no doubt on my memory pool implementation, bcoz it isworking
from many years.
Now, My doubt is, when i call Py_EndInterpreter at the end does it not
clear the whole memory which was used in executing the script?  Or
still the imported stuff from the script1.py is in memory only?

Would greatly appreciate the help

vishnu
-- 
http://mail.python.org/mailman/listinfo/python-list


Problem with pexpect when executing a command on a remote machine

2014-08-27 Thread Kiran kumar Venkumahanti
Hi,

I am trying to execute a command on a remote machine for which I am using
Python pexpect module. Iam able to connect and copy files to the remote
machine but getting the following error when trying to execute commands on
the remote machine. Please find the below error.


''Error sending command: cluster config -r -a Timeout exceeded in
read_nonblocking().\n\nversion: 2.4
($Revision: 516 $)\ncommand: /usr/bin/ssh\nargs: [\'/usr/bin/ssh\', \'-o\',
\'ServerAliveInterval=60\', \'-o\', \'UserKnownHostsFile=/dev/null\',
\'-o\', \'StrictHostKeyChecking=no\', \'root@192.168.7.1\', \'-p\',
\'22\']\nsearcher: searcher_re:\n0: re.compile("(:[^\\r\\n]*
#|[^\\r\\n]*] ->| [^\\r\\n]*][$#]|:[^\\r\\n]*[$#])")\nbuffer (last 100
chars):  \x1b[0;10mcluster config -r -a\r\nConfiguration is
OK!\r\nReloading configuration on all nodes\r\n\nbefore (last 100 chars):
 \x1b[0;10mcluster config -r -a\r\nConfiguration is OK!\r\nReloading
configuration on all nodes\r\n\nafter: \nmatch: None\nmatch_index: None\nexitstatus:
None\nflag_eof: False\npid: 28817\nchild_fd: 7\nclosed: False\ntimeout:
10\ndelimiter: \nlogfile:
None\nlogfile_read: None\nlogfile_send: None\nmaxread: 2000\nignorecase:
False\nsearchwindowsize: None\ndelaybeforesend: 0.05\ndelayafterclose:
0.1\ndelayafterterminate: 0.1'

If we notice the error, the command is getting properly executed and the
output is also fetched but it returning a TIMEOUT error in
read_nonblocking() function of pxssh.py file of the pexpect module.

Please let me know how can I avoid this. Even the error is not consistent,
sometimes I am able to execute properly but it is failing most of the times.

Kindly reply me as soon as possible.

Thanks in advance.

Regards,
Kiran
-- 
https://mail.python.org/mailman/listinfo/python-list


implementing SFTP using Python

2007-03-02 Thread kadarla kiran kumar
Hi Everybody,
   
  I have to implement SFTP conection from client to the server using Python 
script.
  Iam very new new to python , and i dont't have much time to complete this. So 
I need some pointers from you.
   
  If anybody has already done this kind of stuff, please let me know. Please 
don't think Iam over ambitious, but i need some kind of Pseudo code ,if 
possible source code.
   
  Thanks in Advance,
  K.Kiran Kumar

 
-
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!-- 
http://mail.python.org/mailman/listinfo/python-list

Re: implementing SFTP using Python

2007-03-05 Thread kadarla kiran kumar
  @Ben Finney
   
  I have downloaded paramiko-1.6 package, pcrypto 2.0.1 package
  platform: windows XP
   
  Now Iam trying to run the demo scripts available with paramiko package.
  I have tried using the same system for both cleint(demo_simple.py) and the 
server(demo_server.py) but it is failing at socket.connect()
   
  Can you please tell me ..what all i need to setup , to establish a conection 
between Client and server. 
   
  The log of error , when I run demo_simple:
  ==
  Hostname: 10.220.10.15:22
hostnmae: 10.220.10.15 port: 22
Username [KiranKumar_Kadarla]: aditya
Warning: Problem with getpass. Passwords may be echoed.
Password for [EMAIL PROTECTED]: [EMAIL PROTECTED]
*** Unable to open host keys file
hostname:10.220.10.15 port:22
*** Caught exception: : 
Authentication failed.
Traceback (most recent call last):
  File "C:\paramiko-1.6\paramiko-1.6\demos\demo_simple.py", line 85, in 
t.connect(username=username, password=password, hostkey=hostkey)
  File "C:\Python25\Lib\site-packages\paramiko\transport.py", line 851, in 
connect
self.auth_password(username, password)
  File "C:\Python25\Lib\site-packages\paramiko\transport.py", line 1012, in 
auth_password
return self.auth_handler.wait_for_response(my_event)
  File "C:\Python25\Lib\site-packages\paramiko\auth_handler.py", line 174, in 
wait_for_response
raise e
AuthenticationException: Authentication failed.
Traceback (most recent call last):
  File "C:\paramiko-1.6\paramiko-1.6\demos\demo_simple.py", line 102, in 

sys.exit(1)
SystemExit: 1
   
   
  THANKS IN ADVANCE
  K. KIRAN KUMAR
   
   
   
   
   
   
   
   

kadarla kiran kumar writes:

> I have to implement SFTP conection from client to the server using
> Python script. Iam very new new to python , and i dont't have much
> time to complete this. So I need some pointers from you.

You will probably want to investigate the "paramiko" package, a
pure-Python implementation of the SSH2 protocol.







 
-
The fish are biting.
 Get more visitors on your site using Yahoo! Search Marketing.-- 
http://mail.python.org/mailman/listinfo/python-list

copying only recent files from one machine to another

2007-03-21 Thread kadarla kiran kumar
Hi Everybody,
   
  Iam trying to copy files from one machine to another over SFTP connection. 
For that Iam using sftp.get & sftp.put methods.
   
  Now, I have to copy only recently created/modified files,i.e, based on 
timestamps from remote machine to my machine. Is there any standard 
implementation for that in python/paramiko ? If not , can anyone suggest me the 
efficient method to implement the same.
   
  Thanks in Advance,
  Kiran Kumar 

 
-
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.-- 
http://mail.python.org/mailman/listinfo/python-list