Re: [python-win32] windows firewall woes?

2012-03-08 Thread Mark Hammond
As a couple of guesses, I'd ensure you do this from an elevated process (ie, "run as administrator") and also be sure to use fully-qualified paths. (The error code shown appears to be ERROR_INVALID_POINTER, but that might be a red herring) Mark On 9/03/2012 11:16 AM, Andrew Hammond wrote: W

Re: [python-win32] windows firewall woes?

2012-03-08 Thread Andrew Hammond
With the following code, def add_firewall_exception(): app = win32com.client.gencache.EnsureDispatch('HNetCfg.FwAuthorizedApplication', 0) app.ProcessImageFileName = r'\Python26\python.exe' app.Scope = NET_FW_SCOPE_ALL app.IpVersion = NET_FW_IP_VERSION_ANY app.Enabled = True firew

Re: [python-win32] a trivial question

2012-03-08 Thread cool_go_blue
Thanks for all resonses. I just concentrated on the "for row in ..." statement. Now I have another question. I would like to read a document with various structures such as title, subtitle, paragraph, table (as I did previously) and bullet etc. How can I get these contents for further analysis?

Re: [python-win32] a trivial question

2012-03-08 Thread Vernon Cole
*self*.doc.Tables(1).Cell(row,2) is not a string, and therefore has no .split() method. str(*self*.doc.Tables(1).Cell(row,2)) returns a string, so it does have a split() method and therefore str(*self*.doc.Tables(1).Cell(row,2)).split() is correct, but str(*self*.doc.Tables(1).Cell(row,2).split())

Re: [python-win32] a trivial question

2012-03-08 Thread Pham, Hien
Try this: tableSize = self.doc.getTableSize(tbl) for row in range(tableSize[1]): for col in range(tableSize[0]): print procTbl.Cell(row+1, col+1).Range).Text From: python-win32-bounces+hien.pham=tekelec@python.org [mailto:python-win32-bounces+hien.pham=tekelec@python.org] O

Re: [python-win32] a trivial question

2012-03-08 Thread Randy Syring
On 03/08/2012 12:14 PM, cool_go_blue wrote: [[word forword instr(/self/.doc.Tables(1).Cell(row,2).split()) ifword notinstopwords] You have a parenthesis in the wrong place. You are doing .split() on the column object, not the result of str(). Change it to: str(self.doc.Tables(1).Cell(row

Re: [python-win32] a trivial question

2012-03-08 Thread Paul_Koning
You have a misplaced parenthesis. The working code has str (...Cell(...) ).split() and the failing code has str (...Cell(...).split() ) -in other words, the bad code has split() applied to the argument of str() rather than the result of str(). paul From: python-win32-bounces+pk

[python-win32] a trivial question

2012-03-08 Thread cool_go_blue
I try to use comprehensions when I am learning Python. After opening a word document, i try to read the 2nd column of a table for each row. I print out the words as follows:   for row in range(1,len(self.doc.Tables(1).Rows)+1):    for word in str(self.doc.Tables(1).Cell(row,2)).split():   if