Re: dynamic call of a function

2005-01-22 Thread kishore
Hi Luigi Ballabio,

Thankyou very much for your reply,
it worked well.

Kishore.

Luigi Ballabio wrote:
> At 10:37 AM 10/19/01 +0200, anthony harel wrote:
> >Is it possible to make dynamic call of a function whith python ?
> >
> >I have got a string that contains the name of the function I
> >want to call but I don't want to do something like this :
> >
> >if ch == "foo" :
> > self.foo( )
> >elif ch == "bar"
> > self.bar( )
> >
>
> Anthony,
>  here are two ways to do it---I don't know which is the best,
nor
> whether the best is yet another. Also, you might want to put in some
error
> checking.
>
> class Test:
>  def foo(self):
>  print 'Norm!'
>  def bar(self):
>  print 'Dum-de-dum'
>  def dynCall1(self,methodName):
>  eval('self.%s()' % methodName)
>  def dynCall2(self,methodName):
>  method = vars(self.__class__)[methodName]
>  method(self)
>
>  >>> t = Test()
>  >>> t.dynCall1('foo')
> Norm!
>  >>> t.dynCall2('bar')
> Dum-de-dum
> 
> Bye,
>  Luigi

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


Urgent Requirement for Bangalore Location

2007-09-26 Thread kishore
 

Hi 

 

  This is krishna kishore from MindRiver. We have an Urgent requirement for
Python Developers with 5-7Yrs of Exp

 

Mandatory Skills  :Python and c and c++

 

Exp :5-7 yrs

 

Qualification :   B.E ONLY

 

Work Location: Bangalroe.

 

   If you are Looking for a change Please forward your
Updated Profile.

 

Thanks & Regards,

Kishore Seethanraju |Senior Associate-People Consulting| MindRiver
Information Technologies Pvt. Ltd.
Suite# 512, 4th Floor and Suite # 104, Ground Floor ,Oxford Towers, 139,
Airport Road, Bangalore 560 008| Tel: +91.80.3052.1600 |Direct:
+91.80.3057.5799| Mobile: + 91.9901 96 1696 | Fax: +91.80.3057.5797| Email:
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  | Web
www.mindriver-it.com <http://www.mindriver-it.com/>  

Information transmitted by this-mail is proprietary to MindRiver and / or
its Customers and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If you are not
the intended recipient or it appears that this mail has been forwarded to
you without proper authority, you are notified that any use or dissemination
of this information in any manner is strictly prohibited. In such cases,
please notify us immediately at the above mentioned telephone number or
email to [EMAIL PROTECTED] and delete this mail from your records.
We believe this email to be virus free but do not warrant that this is the
case and we will not accept liability for any losses arising from any virus
being transmitted unintentionally by us'

 

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of [EMAIL PROTECTED]
Sent: Wednesday, September 26, 2007 12:25 PM
To: [email protected]
Subject: Python-list Digest, Vol 48, Issue 389

 

Send Python-list mailing list submissions to

[email protected]

 

To subscribe or unsubscribe via the World Wide Web, visit

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

or, via email, send a message with subject or body 'help' to

[EMAIL PROTECTED]

 

You can reach the person managing the list at

[EMAIL PROTECTED]

 

When replying, please edit your Subject line so it is more specific

than "Re: Contents of Python-list digest..."

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

RE: Python-list Digest, Vol 48, Issue 391

2007-09-26 Thread kishore
Hi 

 

 

 

  This is krishna kishore from MindRiver. We have an Urgent requirement for
Python Developers with 5-7Yrs of Exp

 

 

 

Mandatory Skills  :Python and c and c++

 

 

 

Exp :5-7 yrs

 

 

 

Qualification:   B.E ONLY

 

 

 

Work Location   : Bangalroe.

 

 

 

   If you are Looking for a change Please forward your
Updated Profile.

 

 

 

Thanks & Regards,

 

Kishore Seethanraju |Senior Associate-People Consulting| MindRiver
Information Technologies Pvt. Ltd.

Suite# 512, 4th Floor and Suite # 104, Ground Floor ,Oxford Towers, 139,
Airport Road, Bangalore 560 008| Tel: +91.80.3052.1600 |Direct:
+91.80.3057.5799| Mobile: + 91.9901 96 1696 | Fax: +91.80.3057.5797| Email:
[EMAIL PROTECTED] | Web www.mindriver-it.com 

 

Information transmitted by this-mail is proprietary to MindRiver and / or
its Customers and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If you are not
the intended recipient or it appears that this mail has been forwarded to
you without proper authority, you are notified that any use or dissemination
of this information in any manner is strictly prohibited. In such cases,
please notify us immediately at the above mentioned telephone number or
email to [EMAIL PROTECTED] and delete this mail from your records.
We believe this email to be virus free but do not warrant that this is the
case and we will not accept liability for any losses arising from any virus
being transmitted unintentionally by us'

 

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of [EMAIL PROTECTED]
Sent: Wednesday, September 26, 2007 1:35 PM
To: [email protected]
Subject: Python-list Digest, Vol 48, Issue 391

 

Send Python-list mailing list submissions to

[email protected]

 

To subscribe or unsubscribe via the World Wide Web, visit

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

or, via email, send a message with subject or body 'help' to

[EMAIL PROTECTED]

 

You can reach the person managing the list at

[EMAIL PROTECTED]

 

When replying, please edit your Subject line so it is more specific

than "Re: Contents of Python-list digest..."

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

URGENT REQUIREMENT FOR PYTHON DEVELOPERS

2007-09-27 Thread kishore
HI 

 

THIS IS KRISHNA KISHORE FROM MindRiver. We have an Urgent requirement for
Python Developers who have 5-7 YRS of EXP.

 

 SKILLS  :PYTHON AND C/C++

 

   WORK LOCATION:  BANGALROE

 

 PLEASE REVERT US WITH YOUR UPDATED PROFILES.

 

Thanks & Regards,

Kishore Seethanraju |Senior Associate-People Consulting| MindRiver
Information Technologies Pvt. Ltd.
Suite# 512, 4th Floor and Suite # 104, Ground Floor ,Oxford Towers, 139,
Airport Road, Bangalore 560 008| Tel: +91.80.3052.1600 |Direct:
+91.80.3057.5799| Mobile: + 91.9901 96 1696 | Fax: +91.80.3057.5797| Email:
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  | Web
www.mindriver-it.com <http://www.mindriver-it.com/>  

Information transmitted by this-mail is proprietary to MindRiver and / or
its Customers and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If you are not
the intended recipient or it appears that this mail has been forwarded to
you without proper authority, you are notified that any use or dissemination
of this information in any manner is strictly prohibited. In such cases,
please notify us immediately at the above mentioned telephone number or
email to [EMAIL PROTECTED] and delete this mail from your records.
We believe this email to be virus free but do not warrant that this is the
case and we will not accept liability for any losses arising from any virus
being transmitted unintentionally by us'

 

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

pyserial script doesnt execute properly

2010-03-09 Thread kishore
hello there

Iam using python 2.5.4
pyserial  2.4
pywin32-214

on windows 7


i hav a small test script written to query a serial device (arduino)
and get back reply appropriately



file: test.py

import serial
print 'hi'
ser=serial.Serial(port='\\.\COM2', baudrate=9600)
ser.close()
ser.open()
ser.write('1')
ser.readline()
ser.readline()
ser.close()



the device waits for '1' through its serial interface and print two
lines if it gets '1'

"Some Data found" and "Header received"


the script works on IDLE well when given one line at a time

but when given in command line as python test.py it prints hi and wait
forever

can anyone help?
thanks in advance

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


Re: pyserial script doesnt execute properly

2010-03-09 Thread kishore
On Mar 9, 2:19 pm, News123  wrote:
> Hi,
>
>
>
> kishore wrote:
> > hello there
>
> > Iam using python 2.5.4
> > pyserial  2.4
> > pywin32-214
>
> > on windows 7
>
> > i hav a small test script written to query a serial device (arduino)
> > and get back reply appropriately
>
> > file: test.py
>
> > import serial
> > print 'hi'
> > ser=serial.Serial(port='\\.\COM2', baudrate=9600)
> > ser.close()
> > ser.open()
> > ser.write('1')
> > ser.readline()
> > ser.readline()
> > ser.close()
>
> > the device waits for '1' through its serial interface and print two
> > lines if it gets '1'
>
> > "Some Data found" and "Header received"
>
> > the script works on IDLE well when given one line at a time
>
> > but when given in command line as python test.py it prints hi and wait
> > forever
>
> Unfortunately I don't remember exacty, but try following:
>
> close IDLE and try then to start the script from the command line.
> I remember having had a problem with idle, that it did not always close
> the UART port
> (especially, when an error (e.g. syntax) occured before the close statement)
>
> bye
>
> N


Thanks for your response
i tried closing idle and the following code prints
port opened
Write failed

code:

import serial
import time
ser=serial.Serial(port='\\.\COM2', baudrate=9600)
if ser:
print 'port opened'
ser.open()
if ser.write('1'):
print 'Write success'
else:
print 'write failed'

time.sleep(1)

a=ser.readline()
time.sleep(1)
b=ser.readline()
print b
ser.close()



I believe this might be a serial port access error.
how to solve this?
Any suggestions?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyserial script doesnt execute properly

2010-03-09 Thread kishore
On Mar 9, 8:01 pm, kishore  wrote:
> On Mar 9, 2:19 pm, News123  wrote:
>
>
>
> > Hi,
>
> > kishore wrote:
> > > hello there
>
> > > Iam using python 2.5.4
> > > pyserial  2.4
> > > pywin32-214
>
> > > on windows 7
>
> > > i hav a small test script written to query a serial device (arduino)
> > > and get back reply appropriately
>
> > > file: test.py
>
> > > import serial
> > > print 'hi'
> > > ser=serial.Serial(port='\\.\COM2', baudrate=9600)
> > > ser.close()
> > > ser.open()
> > > ser.write('1')
> > > ser.readline()
> > > ser.readline()
> > > ser.close()
>
> > > the device waits for '1' through its serial interface and print two
> > > lines if it gets '1'
>
> > > "Some Data found" and "Header received"
>
> > > the script works on IDLE well when given one line at a time
>
> > > but when given in command line as python test.py it prints hi and wait
> > > forever
>
> > Unfortunately I don't remember exacty, but try following:
>
> > close IDLE and try then to start the script from the command line.
> > I remember having had a problem with idle, that it did not always close
> > the UART port
> > (especially, when an error (e.g. syntax) occured before the close statement)
>
> > bye
>
> > N
>
> Thanks for your response
> i tried closing idle and the following code prints
> port opened
> Write failed
>
> code:
>
> import serial
> import time
> ser=serial.Serial(port='\\.\COM2', baudrate=9600)
> if ser:
>         print 'port opened'
> ser.open()
> if ser.write('1'):
>         print 'Write success'
> else:
>         print 'write failed'
>
> time.sleep(1)
>
> a=ser.readline()
> time.sleep(1)
> b=ser.readline()
> print b
> ser.close()
>
> I believe this might be a serial port access error.
> how to solve this?
> Any suggestions?

have found one more person with same problem but no solution

http://mail.python.org/pipermail/python-win32/2009-January/008613.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyserial script doesnt execute properly

2010-03-09 Thread kishore
On Mar 9, 8:01 pm, kishore  wrote:
> On Mar 9, 2:19 pm, News123  wrote:
>
>
>
> > Hi,
>
> > kishore wrote:
> > > hello there
>
> > > Iam using python 2.5.4
> > > pyserial  2.4
> > > pywin32-214
>
> > > on windows 7
>
> > > i hav a small test script written to query a serial device (arduino)
> > > and get back reply appropriately
>
> > > file: test.py
>
> > > import serial
> > > print 'hi'
> > > ser=serial.Serial(port='\\.\COM2', baudrate=9600)
> > > ser.close()
> > > ser.open()
> > > ser.write('1')
> > > ser.readline()
> > > ser.readline()
> > > ser.close()
>
> > > the device waits for '1' through its serial interface and print two
> > > lines if it gets '1'
>
> > > "Some Data found" and "Header received"
>
> > > the script works on IDLE well when given one line at a time
>
> > > but when given in command line as python test.py it prints hi and wait
> > > forever
>
> > Unfortunately I don't remember exacty, but try following:
>
> > close IDLE and try then to start the script from the command line.
> > I remember having had a problem with idle, that it did not always close
> > the UART port
> > (especially, when an error (e.g. syntax) occured before the close statement)
>
> > bye
>
> > N
>
> Thanks for your response
> i tried closing idle and the following code prints
> port opened
> Write failed
>
> code:
>
> import serial
> import time
> ser=serial.Serial(port='\\.\COM2', baudrate=9600)
> if ser:
>         print 'port opened'
> ser.open()
> if ser.write('1'):
>         print 'Write success'
> else:
>         print 'write failed'
>
> time.sleep(1)
>
> a=ser.readline()
> time.sleep(1)
> b=ser.readline()
> print b
> ser.close()
>
> I believe this might be a serial port access error.
> how to solve this?
> Any suggestions?

have found one more person with same problem but no solution

http://mail.python.org/pipermail/python-win32/2009-January/008613.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyserial script doesnt execute properly

2010-03-10 Thread kishore
On Mar 10, 1:07 pm, "Gabriel Genellina" 
wrote:
> En Tue, 09 Mar 2010 12:01:22 -0300, kishore 
> escribió:
>
>
>
>
>
> >> > Iam using python 2.5.4
> >> > pyserial  2.4
> >> > pywin32-214
> >> > on windows 7
>
> >> > i hav a small test script written to query a serial device (arduino)
> >> > and get back reply appropriately
>
> > Thanks for your response
> > i tried closing idle and the following code prints
> > port opened
> > Write failed
>
> > code:
>
> > import serial
> > import time
> > ser=serial.Serial(port='\\.\COM2', baudrate=9600)
>
> If you want a string containing these 8 characters \\.\COM2 you have to
> write it either as r'\\.\COM2' or '.\\COM2'
>
> > if ser:
> >    print 'port opened'
>
> Either the Serial object is constructed and returned, or an exception is
> raised. 'if ser:' has no sense; Python is not C...
>
> > ser.open()
> > if ser.write('1'):
> >    print 'Write success'
> > else:
> >    print 'write failed'
>
> The write method, when successful, implicitly returns None. None has a
> false boolean value, so your code will always print 'write failed'.
>
> Usually, in Python, error conditions are marked by raising an exception.
> Using return values to indicate success/failure is uncommon.
>
> Also, are you sure the device doesn't expect a newline character? '1\n'?
>
> You may need to call ser.flushOutput() to ensure the output buffer is
> actually emptied.
>
> > time.sleep(1)
> > a=ser.readline()
>
> print repr(a)
>
> > time.sleep(1)
> > b=ser.readline()
>
> print repr(b)
>
> > ser.close()
> > I believe this might be a serial port access error.
> > how to solve this?
> > Any suggestions?
>
> I don't think so. If you could not access the serial port, you'd have seen
> an IOError exception or similar.
>
> --
> Gabriel Genellina

thanks Gabriel & Andy..ll get back soon here after trying ur
suggestions
-- 
http://mail.python.org/mailman/listinfo/python-list


How can I copy one excel file data to another excel file by excluding hidden rows content using Python

2016-10-19 Thread Kishore JK
I need to copy one excel file data into another excel file by excluding rows 
which were hidden in source excel file.

https://i.stack.imgur.com/NPUK6.png

As shown in the image, from the source excel file, I need to copy the data of 
row numbers 116,135 and 139 and exclude all the remaining rows which were 
hidden because of not matching the criteria.

I have tried below code, but this is copying entire data into new excel sheet.
wb = openpyxl.load_workbook('sourcefile.xlsx')
sheet = wb.active
sheet.title = 'Sheet1'
wb.save('destinationfile.xlsx')
-- 
https://mail.python.org/mailman/listinfo/python-list


'python' is not recognized as an internal or external command

2019-09-01 Thread G Kishore
Hi Team,

I was installing python in my new windows 10 machine and cpuld able to access 
python from command window when the location is where I have installed python.

The same I have tried to enter the command from Desktop location but "'python' 
is not recognized as an internal or external command,"  error is thrown. Done 
the path variable in the environmental variables as the location where python 
is installed.

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


Internal Server Error when trying to access WebTours (an Application built in Strawberry perl)

2019-10-28 Thread Kishore m
Hi Team,

I have installed Python 64 bit 2 days back and had to uninstall Python as I
got below error with webtours application built in Strawberry Perl which im
using from an year without any issue.

*Problem Statement:*
Internal Server Error when trying to access WebTours

*Error message in webtours server logs:*

[Sun Oct 27 06:20:11 2019] [error] [client 127.0.0.1] (OS 2)The system
cannot find the file specified.  : couldn't create child process: 720002:
welcome.pl, referer: http://127.0.0.1:1080/WebTours/index.htm
[Sun Oct 27 06:20:11 2019] [error] [client 127.0.0.1] (OS 2)The system
cannot find the file specified.  : couldn't spawn child process:
C:/Users/Pavan Kishore/Downloads/Web Tours 1.0/WebTours/cgi-bin/welcome.pl,
referer: http://127.0.0.1:1080/WebTours/index.htm

*Possible steps which caused Issues:* (This Issue came up after below
changes on system)
1. Installed Python 2 days back after which it prompted for changes
regarding path limit in last step of installation. Also, this is the only
software which I installed recently after which I started getting above
error.
Could you please verify to determine the root cause and help us resolve the
issue asap.

Thanks & Regards,
Pavan Mandala,
Performance Test Engineer,
+91 96520 29399,
linkedin.com/in/pavanmandala
SkypeID: pavanmandala
-- 
https://mail.python.org/mailman/listinfo/python-list


Issue with PYSFTP - Working in WINSCP

2020-03-10 Thread NAND KISHORE
Hi
   We have requirement where we need to get file from client path and then
upload the same to vendor directory path. I am not able to upload the file
to vendor directory path , however when I tried to use the WINSCP it worked
fine. So I thought of checking with Gurus what is wrong I am doing in my
script. Appreciate your input.
I will attach my script. Here is what I am doing.

Step1. Clear the client directory path
Step2. Make a call to HVAC Vault to get the username and password for
client and vendor server
Step3. Use the username and password to establish connection using pysftp
for client.
Step4. Store the file in local path.
Step5. Segregate the file into different path based on file type
Step6  Establish a connection to vendor and copy the file to vendor.
Step7  Close the client and Vendor connection

Please see the file attached.

Also below is the error which I am getting

-
ERROR:root:Error in getting the file from EBS Outbound Server
Traceback (most recent call last):
  File "FILE_TRANSFER_PROCESS.py", line 191, in file_transfer
vendor.put(src_file, dst_file)
  File "/d01/python3/lib64/python3.6/site-packages/pysftp/__init__.py",
line 364, in put
confirm=confirm)
  File
"/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
759, in put
return self.putfo(fl, remotepath, file_size, callback, confirm)
  File
"/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
720, in putfo
s = self.stat(remotepath)
  File
"/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
493, in stat
t, msg = self._request(CMD_STAT, path)
  File
"/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
813, in _request
return self._read_response(num)
  File
"/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
865, in _read_response
self._convert_status(msg)
  File
"/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
894, in _convert_status
raise IOError(errno.ENOENT, text)
FileNotFoundError: [Errno 2] /custom/OWO/ECE_OWO_20200303_143895.dat
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
# from pysftp import Connection, CnOpts
import os
import sys
import pysftp
import logging
import hvac
import datetime
from datetime import datetime
import ssl
import smtplib
import shutil
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders

def file_delete (dirs):
write_to_file('F', 'The directory is '+dirs)
for files in os.listdir(dirs):
filed = dirs + "/" +files
write_to_file('F','File is to be deleted '+filed)
os.remove(filed)
def write_to_file(mode,filetext):
log_path = "/home/kishnx/scripts/log/sftp.log"
if mode == 'I':
f = open(log_path,"w")
else:
f = open(log_path,"a")
f.write(filetext)
f.write("\n")
f.close()

def sendEmail(v_status):
port = 587  # For starttls
smtp_server = "smtp.gmail.com"
receiver_email = "[email protected]"
sender_email = "[email protected]"
password = "Test1234"
if v_status == 'S':
message = """\
  GXS_OUTBOUND
  Ran the Python SFTP program."""
elif v_status == 'E':
message = """\
  GXS_OUTBOUND
  Issue with the Python SFTP program.Check Log Files."""
context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
server.ehlo()  # Can be omitted
server.starttls(context=context)
server.ehlo()  # Can be omitted
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message)

timing=datetime.now()
fcontent1 = 'Logging for today has started'
write_to_file('I',"-")
write_to_file('F',fcontent1)
write_to_file('F',str(timing))
sl_cinfo = None
ot_cinfo = None
otsource = 'VENDOR'
ebspath1 = 'UNKNOWN'
otpath1 =  'UNKNOWN'
ebssource = 'CLIENT'
localfuspath = '/home/test/scripts/outbound/scm'
localfuspath3 = '/home/test/scripts/outbound/outbound'
shutil.rmtree(localfuspath)
os.makedirs(localfuspath)
vaultfile = open('/home/test/.vaulttoken', 'r')
vault_token = vaultfile.read().strip()
client = hvac.Client()
client = hvac.Client(url='https://vault.comfort.com:8200',
 token=vault_token,
 verify='/home/test/vault-cert.crt')
if client.is_authenticated():
print ('vault is authenticated')
write_to_file('F','vault is authenticated')


def file_transfer(sleep, vendor, paths):
global localfusaropath1
global localfusowopath1
global localfusitempath1
global localfuspath1
# print("paths are ",paths[0],paths[1])
ebsBasePath = paths[0]
localBasePath = path

Re: Pysftp Issue File Upload is not working - put command

2020-03-10 Thread NAND KISHORE
>
>
> Hi
>We have requirement where we need to get file from client path and then
> upload the same to vendor directory path. I am not able to upload the file
> to vendor directory path , however when I tried to use the WINSCP it worked
> fine. So I thought of checking with Gurus what is wrong I am doing in my
> script. Appreciate your input.
> I will attach my script. Here is what I am doing.
>
> Step1. Clear the client directory path
> Step2. Make a call to HVAC Vault to get the username and password for
> client and vendor server
> Step3. Use the username and password to establish connection using pysftp
> for client.
> Step4. Store the file in local path.
> Step5. Segregate the file into different path based on file type
> Step6  Establish a connection to vendor and upload the file to vendor
> directory path.
> Step7  Close the client and Vendor connection
>
> Note : In step 6 I am getting an error and I am getting below error


> Please see the file attached for code.
>
> Also below is the error which I am getting
>
> -
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> * ERROR:root:Error in getting the file from EBS Outbound Server Traceback
> (most recent call last):   File "FILE_TRANSFER_PROCESS.py", line 191, in
> file_transfer vendor.put(src_file, dst_file)   File
> "/d01/python3/lib64/python3.6/site-packages/pysftp/__init__.py", line 364,
> in put confirm=confirm)   File
> "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
> 759, in put return self.putfo(fl, remotepath, file_size, callback,
> confirm)   File
> "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
> 720, in putfo s = self.stat(remotepath)   File
> "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
> 493, in stat t, msg = self._request(CMD_STAT, path)   File
> "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
> 813, in _request return self._read_response(num)   File
> "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
> 865, in _read_response self._convert_status(msg)   File
> "/d01/python3/lib64/python3.6/site-packages/paramiko/sftp_client.py", line
> 894, in _convert_status raise IOError(errno.ENOENT, text)
> FileNotFoundError: [Errno 2] /custom/OWO/ECE_OWO_20200303_143895.dat*
> __
>
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
# from pysftp import Connection, CnOpts
import os
import sys
import pysftp
import logging
import hvac
import datetime
from datetime import datetime
import ssl
import smtplib
import shutil
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders

def file_delete (dirs):
write_to_file('F', 'The directory is '+dirs)
for files in os.listdir(dirs):
filed = dirs + "/" +files
write_to_file('F','File is to be deleted '+filed)
os.remove(filed)
def write_to_file(mode,filetext):
log_path = "/home/kishnx/scripts/log/sftp.log"
if mode == 'I':
f = open(log_path,"w")
else:
f = open(log_path,"a")
f.write(filetext)
f.write("\n")
f.close()

def sendEmail(v_status):
port = 587  # For starttls
smtp_server = "smtp.gmail.com"
receiver_email = "[email protected]"
sender_email = "[email protected]"
password = "Test1234"
if v_status == 'S':
message = """\
  GXS_OUTBOUND
  Ran the Python SFTP program."""
elif v_status == 'E':
message = """\
  GXS_OUTBOUND
  Issue with the Python SFTP program.Check Log Files."""
context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
server.ehlo()  # Can be omitted
server.starttls(context=context)
server.ehlo()  # Can be omitted
server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message)

timing=datetime.now()
fcontent1 = 'Logging for today has started'
write_to_file('I',"-")
write_to_file('F',fcontent1)
write_to_file('F',str(timing))
sl_cinfo = None
ot_cinfo = None
otsource = 'VENDOR'
ebspath1 = 'UNKNOWN'
otpath1 =  'UNKNOWN'
ebssource = 'CLIENT'
localfuspath = '/home/test/scripts/outbound/scm'
localfuspath3 = '/home/test/scripts/outbound/outbound'
shutil.rmtree(localfuspath)
os.makedirs(localfuspath)
vaultfile = open('/home/test/.vaulttoken', 'r')
vault_token = vaultfile.read().strip()
client = hvac.Client()
client = hvac.Client(url='https://vault.comfort.com:8200',
 token=vault_token,
 verify='/home/test/vault-cert.crt')
if client.is_authenticated():
print ('vault is authenticated')
write_to_file('F','vault is authenticated')


def file_t

Unable to start IDLE

2007-06-07 Thread Kishore D

Hi,
I am facing a problem in starting IDLE. The hourglass appears for a
while and then goes off. When i tried opening it after switching of the
firewall, it still din help. If some other program is accessing the port can
anyone tell me how to assign the port to python. Thanks .
-- 
http://mail.python.org/mailman/listinfo/python-list

Listing link urls

2017-10-29 Thread Kishore Kumar Alajangi
Hi,

I am facing an issue with listing specific urls inside web page,

https://economictimes.indiatimes.com/archive.cms

Page contains link urls by year and month vise,
Ex: /archive/year-2001,month-1.cms

I am able to list all required urls using the below code,

from bs4 import BeautifulSoup
import re, csv
import urllib.request
import scrapy
req = urllib.request.Request('http://economictimes.indiatimes.com/archive.cms',
headers={'User-Agent': 'Mozilla/5.0'})


links = []
totalPosts = []
url = "http://economictimes.indiatimes.com";
data = urllib.request.urlopen(req).read()
page = BeautifulSoup(data,'html.parser')

for link in page.findAll('a', href = re.compile('^/archive/')):
//retrieving urls starts with "archive"
l = link.get('href')
links.append(url+l)


with open("output.txt", "a") as f:
 for post in links:
 post = post + '\n'
 f.write(post)

*sample result in text file:*

http://economictimes.indiatimes.com/archive/year-2001,month-1.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-2.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-3.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-4.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-5.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-6.cms


List of urls I am storing in a text file, From the month urls I want
to retrieve day urls starts with "/archivelist", I am using

the below code, but I am not getting any result, If I check with
inspect element the urls are available starting with /archivelist,



Kindly help me where I am doing wrong.

from bs4 import BeautifulSoup
import re, csv
import urllib.request
import scrapy

file = open("output.txt", "r")


for i in file:

urls = urllib.request.Request(i, headers={'User-Agent': 'Mozilla/5.0'})

data1 = urllib.request.urlopen(urls).read()

page1 = BeautifulSoup(data1, 'html.parser')

for link1 in page1.findAll(href = re.compile('^/archivelist/')):

l1 = link1.get('href')

print(l1)


Thanks,

Kishore.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Listing link urls

2017-10-29 Thread Kishore Kumar Alajangi
+ tutor

On Sun, Oct 29, 2017 at 6:57 AM, Kishore Kumar Alajangi <
[email protected]> wrote:

> Hi,
>
> I am facing an issue with listing specific urls inside web page,
>
> https://economictimes.indiatimes.com/archive.cms
>
> Page contains link urls by year and month vise,
> Ex: /archive/year-2001,month-1.cms
>
> I am able to list all required urls using the below code,
>
> from bs4 import BeautifulSoup
> import re, csv
> import urllib.request
> import scrapy
> req = 
> urllib.request.Request('http://economictimes.indiatimes.com/archive.cms', 
> headers={'User-Agent': 'Mozilla/5.0'})
>
>
> links = []
> totalPosts = []
> url = "http://economictimes.indiatimes.com";
> data = urllib.request.urlopen(req).read()
> page = BeautifulSoup(data,'html.parser')
>
> for link in page.findAll('a', href = re.compile('^/archive/')): //retrieving 
> urls starts with "archive"
> l = link.get('href')
> links.append(url+l)
>
>
> with open("output.txt", "a") as f:
>  for post in links:
>  post = post + '\n'
>  f.write(post)
>
> *sample result in text file:*
>
> http://economictimes.indiatimes.com/archive/year-2001,month-1.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-2.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-3.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-4.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-5.cmshttp://economictimes.indiatimes.com/archive/year-2001,month-6.cms
>
>
> List of urls I am storing in a text file, From the month urls I want to 
> retrieve day urls starts with "/archivelist", I am using
>
> the below code, but I am not getting any result, If I check with inspect 
> element the urls are available starting with /archivelist,
>
> 
>
> Kindly help me where I am doing wrong.
>
> from bs4 import BeautifulSoup
> import re, csv
> import urllib.request
> import scrapy
>
> file = open("output.txt", "r")
>
>
> for i in file:
>
> urls = urllib.request.Request(i, headers={'User-Agent': 'Mozilla/5.0'})
>
> data1 = urllib.request.urlopen(urls).read()
>
> page1 = BeautifulSoup(data1, 'html.parser')
>
> for link1 in page1.findAll(href = re.compile('^/archivelist/')):
>
> l1 = link1.get('href')
>
> print(l1)
>
>
> Thanks,
>
> Kishore.
>
>
>
>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


intact

2007-07-16 Thread Kishore kumar Manikonda


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