No Tom it just a part of code from django views

i just want to know .. is any another systemcall i should use to log a file 
???

or if u have batter option to log a file please share ... i will thankfull 
to u ..

till thenn i m posting it to python post also..

On Friday, March 1, 2013 6:33:05 PM UTC+5:30, Tom Evans wrote:
>
> On Fri, Mar 1, 2013 at 11:29 AM, JAI PRAKASH SINGH 
> <jaiprakas...@gmail.com <javascript:>> wrote: 
> > import sys,os 
> > sys.stderr = open('/dev/null') 
> > import paramiko 
> > sys.stderr = sys.__stderr__ 
> > 
> > os.system("echo \'s3\' >> myfile.txt ")  #debug first in ssh2 
> > def ssh2_connect(host, user, pswd, port=22): 
> >     try: 
> >         ssh = paramiko.SSHClient() 
> >         ssh.load_system_host_keys() 
> >         ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) 
> >         ssh.connect(host, port, user, pswd) 
> >         return ssh 
> > 
> >     except Exception, e: 
> >         return str(e) + "Error. Failed to connect. Wrong 
> > IP/Username/Password" 
> > 
> > 
> > def ssh2_exec(ssh, cmd, sudo=False): 
> >         result = [] 
> >         try: 
> >             channel = ssh.get_transport().open_session() 
> >             if sudo: 
> >                 channel.get_pty() 
> >         except: 
> >           return result 
> > 
> >         stdin = channel.makefile('wb') 
> >         stdout = channel.makefile('rb') 
> > 
> >         channel.exec_command(cmd) 
> > 
> >         exit_status = channel.recv_exit_status() 
> > 
> >         if exit_status == 0: 
> >             for line in stdout: 
> >                 result.append(line) 
> >         channel.close() 
> >         return result 
> > 
> > 
> > def ssh2_close(ssh): 
> >     ssh.close() 
> >     return 
> > 
> > 
> > def ssh2_copyToFile(ssh, local_file, remote_file): 
> >     sftp = paramiko.SFTPClient.from_transport(ssh.get_transport()) 
> >     sftp.put(local_file, remote_file) 
> >     return 
> > 
>
> This doesn't seem related to Django… try a python mailing list. 
>
> Cheers 
>
> Tom 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to