Using/finding ODBC and DBI
Hello all, I'm trying to use ODBC and DBI but I don't seem to have the right files on my system. I have looked around and I can't find what I'm looking for. From the information I have been able to find these are not part of the standard python library. True?? Where can I find the modules that I'm missing to be able to import the modules correctly and run my script? Thanks, Here is the code that I'm using. import odbc, dbi Query = select jobs.trakkerid, fixes.change as change, from jobs, fixes where trakkerid 'na' and trakkerid '' and jobs.job = fixes.job and fixes.change = 28339 order by change desc db = odbc.odbc( UDAP4 ) cursor = db.cursor() cursor.execute( Query ) Emile Boudreau x5754 This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Problem with filter()
Hey all, So I'm trying to filter a list with the built-in function filter(). My list looks something like this: ['logs', 'rqp-8.2.104.0.dep', 'rqp-8.2.93.0.dep', 'rqp-win32-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz'] Calling filter like this: compFiles = filter(is_Dev, compFiles) compFiles is my list and is_dev is the following def is_Dev(stringy): print stringy stringx = stringy.split('-') if stringx[1] == r'win32': if stringx[2] == r'app': if stringx[4] == r'dev.tar.gz': return 1 For some reason I only get 'logs' printed when is_Dev is called. (ie. It's only going through is_dev once) Does anyone see something wrong that I'm not seeing?? Thanks, Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Problem with filter()
Sorry folks my mistake def is_dev should be: def is_Dev(stringy): stringx = stringy.split('-') if stringx[0] == '': if stringx[1] == r'win32': if stringx[2] == r'app': if stringx[4] == r'dev.tar.gz': return 1 But now the results of the filter is an empty list and i know it shouldn't be. Emile Boudreau From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Boudreau, Emile Sent: Tuesday, April 03, 2007 10:52 AM To: python-list@python.org Subject: Problem with filter() Hey all, So I'm trying to filter a list with the built-in function filter(). My list looks something like this: ['logs', 'rqp-8.2.104.0.dep', 'rqp-8.2.93.0.dep', 'rqp-win32-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz'] Calling filter like this: compFiles = filter(is_Dev, compFiles) compFiles is my list and is_dev is the following def is_Dev(stringy): print stringy stringx = stringy.split('-') if stringx[1] == r'win32': if stringx[2] == r'app': if stringx[4] == r'dev.tar.gz': return 1 For some reason I only get 'logs' printed when is_Dev is called. (ie. It's only going through is_dev once) Does anyone see something wrong that I'm not seeing?? Thanks, Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Extracting a file from a tarball
I am trying to extract one file from a tarball, without success. This is the code I'm using to open the tarball and extract the file: tar = tarfile.open(component+'-win32-app-'+bestVersion+'-dev.tar.gz', 'r') extractedFile = tar.extractfile('symbols.xml') And this is my error: Traceback (most recent call last): File C:\CognosInstalls\AutoTest\PollDir.py, line 121, in module main() File C:\CognosInstalls\AutoTest\PollDir.py, line 119, in main extract('c:\\', 'I:\\daily\\'+components[i], components[i]) File C:\CognosInstalls\AutoTest\PollDir.py, line 27, in extract filelike = tar.extractfile('symbols.xml') File C:\Python25\lib\tarfile.py, line 1488, in extract tarinfo = self.getmember(member) File C:\Python25\lib\tarfile.py, line 1171, in getmember raise KeyError(filename %r not found % name) KeyError: filename 'symbols.xml' not found I know that the tarball contants this file symbols.xml but I don't understand why it's not extracting it. Any help will be greatly appreciated. Thanks, Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Extracting a file from a tarball
Your hint of checking tar.getnames() was exatly what I needed. It returns the path to where the file will be extracted (ie. Src/ver/qfw/symbols.xml). After knowing this fact it was quite simple to extract the file. Thanks, problem solved!!! Emile Boudreau x5754 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carsten Haese Sent: Tuesday, April 03, 2007 1:42 PM To: python-list@python.org Subject: Re: Extracting a file from a tarball On Tue, 2007-04-03 at 13:26 -0400, Boudreau, Emile wrote: I am trying to extract one file from a tarball, without success. This is the code I'm using to open the tarball and extract the file: tar = tarfile.open(component+'-win32-app-'+bestVersion+'-dev.tar.gz', 'r') extractedFile = tar.extractfile('symbols.xml') And this is my error: Traceback (most recent call last): File C:\CognosInstalls\AutoTest\PollDir.py, line 121, in module main() File C:\CognosInstalls\AutoTest\PollDir.py, line 119, in main extract('c:\\', 'I:\\daily\\'+components[i], components[i]) File C:\CognosInstalls\AutoTest\PollDir.py, line 27, in extract filelike = tar.extractfile('symbols.xml') File C:\Python25\lib\tarfile.py, line 1488, in extract tarinfo = self.getmember(member) File C:\Python25\lib\tarfile.py, line 1171, in getmember raise KeyError(filename %r not found % name) KeyError: filename 'symbols.xml' not found I know that the tarball contants this file symbols.xml What does tar.getnames() return? -Carsten -- http://mail.python.org/mailman/listinfo/python-list This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Sending emails to 3 addresses....
Hello all, I'm trying to send a results email to 3 people. For some reason only the first person in the list will receive the email but in the received email it shows the 3 addresses. Here is my code, can someone show me where I'm going wrong?? Thanks sendMail('this is the subject line', 'the results: 71 fails, 229 pass, 300 total.', '[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]') def sendMail(subject, body, TO, FROM=[EMAIL PROTECTED]): print TO HOST = exchange.mycompany.com BODY = string.join(( From: %s % FROM, To: %s % TO, Subject: %s % subject, , body ), \r\n) server = smtplib.SMTP(HOST) server.sendmail(FROM, [TO], BODY) server.quit() Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Sending emails to 3 addresses....
Thanks so much I would of never found that out. Problem SOLVED Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Williams Sent: Friday, March 30, 2007 9:12 AM To: Boudreau, Emile Cc: python-list@python.org Subject: Re: Sending emails to 3 addresses On 30/03/07, Tim Williams [EMAIL PROTECTED] wrote: Emile, (slight change to my original reply) You are passing the TO addresses as 3 addresses in a single string. [TO] results in a list containing a single string - not a list containing 3 individual addresses. You need to either pass the addresses to the function as a list containing the 3 addresses as individual strings, and remove the conversion to a list at sending time. Or change [TO] to TO.split(',') HTH :) This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Two Command prompts in parallels
Hello, I have two batch files and I'm trying to run them in parallel. I haven't been able to find any information on how to make python open 2 command prompt and then make each prompt run one of the batch files. Can anyone point me in the right direction? Thanks, Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
2 Command prompt at the same time
Hello, I have two batch files and I'm trying to run them in parallel. I haven't been able to find any information on how to make python open 2 command prompt and then make each prompt run one of the batch files. Can anyone point me in the right direction? Thanks, Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Subject line with smtplib.sendmail()
Hey, I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? Thanks in advance for the help. Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Subject line with smtplib.sendmail()
Thanks for the reply. When I use the instruction from that list this is the email I receive. I'm using Outlook. [EMAIL PROTECTED] To: -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hello! This Still DOESN't Work It's just adding the From To Subject in the message itself. I want to have each field at the correct place and then just the msg in the body. Any Help?? Thanks Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: Tuesday, March 20, 2007 11:08 AM To: python-list@python.org Subject: Re: Subject line with smtplib.sendmail() Boudreau, Emile wrote: I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? you have to add the headers yourself. see the example in the library reference, or this FAQ entry: http://effbot.org/pyfaq/how-do-i-send-mail-from-a-python-script /F -- http://mail.python.org/mailman/listinfo/python-list This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
RE: Subject line with smtplib.sendmail()
Sorry folks. Scrape the last one that I sent. I noticed that it sends the email perfectly if the code is not in any of my methods but the second I insert it into a method I get the ugly email that I described in my last email. Does anyone know how I can get this code in my method so that I have access to all the variables I have? thanks Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Boudreau, Emile Sent: Tuesday, March 20, 2007 1:51 PM To: python-list@python.org Subject: RE: Subject line with smtplib.sendmail() Thanks for the reply. When I use the instruction from that list this is the email I receive. I'm using Outlook. [EMAIL PROTECTED] To: -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hello! This Still DOESN't Work It's just adding the From To Subject in the message itself. I want to have each field at the correct place and then just the msg in the body. Any Help?? Thanks Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: Tuesday, March 20, 2007 11:08 AM To: python-list@python.org Subject: Re: Subject line with smtplib.sendmail() Boudreau, Emile wrote: I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? you have to add the headers yourself. see the example in the library reference, or this FAQ entry: http://effbot.org/pyfaq/how-do-i-send-mail-from-a-python-script /F -- http://mail.python.org/mailman/listinfo/python-list This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
os.path.isfile with *.tar.gz
Hello All, I'm new to Python and it looks like people that post here do get a good answer back so I figured I'd try my luck. I'm trying to check a directory to see if there is a file that has the name startOfString + some version number + inst.tar.gz (component-8.3.16-inst.tar.gz) The version number will change quite frequently so I just want to check if there is a file with that format name. I have tried variations of: os.path.isfile( os.path.join(C:\\temp\\, rqp-win32-app, *.tar.gz)) but nothing seem to work. Does anyone have suggestions on how I could get this to work? Thanks in advance for the help, Emile This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list