Wednesday, 22 January 2020

ERROR : new-object : Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).



Close admin command prompt console and open with user mode 

Python ERROR : ValueError: I/O operation on closed file.



For a quick fix, save the standard stdout in a different variable, then redirect to it after that close.

# Simple image to string

saved_stdout = sys.stdout
sys.stdout = open('file.txt', 'w')
print (pytesseract.image_to_string(Image.open('Ke.png')))
sys.stdout.close()

sys.stdout = saved_stdout

Monday, 6 January 2020

python script to copy a executable file from source machine to target and execute the same file on target machine



import paramiko
import os, time, subprocess
port = "22"
username = ""
password = ""
f = open("hosts.txt", "r")
for ip in f:
       print(ip)
       #print(ip.strip())
       cmd = "sshpass -p '' scp -r /home/raghuvel.sekar/deployAgentbkp.py root@{}:/home/raghuvel.sekar".format(ip.strip())
       #print (cmd)
       jobout= subprocess.check_output(cmd, shell=True)
       time.sleep(10)
       #print (jobout)
       ssh=paramiko.SSHClient()
       ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
       ssh.connect(ip,port,username,password)
       stdin,stdout,stderr=ssh.exec_command('(cd /home/raghuvel.sekar; python test.py)')
       time.sleep(10)
       outlines=stdout.readlines()
       resp =''.join(outlines)
       print("done")

Thursday, 2 January 2020

Passing windows path as EXTRA VARS in ansible





ansible-playbook test2.yml -e user=administrator -e 'item_path=C:\\Users\\Administrator\\Desktop\\test\\sample.txt' -e type=allow -e rights=FullControl -vvvv

Git

1 git add ↳ It lets you add changes from the working directory into the staging area 2 git commit ↳ It lets you save a snapshot of currently...