[wtr-general] Re: WIN32OLE Error
that seems logical. Excel is pretty persnickety when it comes to holding files open and I'm pretty sure I've seen a few instances where I wasn't able to move stuff around on network shares due to the fies being 'open' even though the user claimed to have closed excel, and we had to reboot things to free up the file locks. On Apr 4, 10:12 pm, "vladimir...@hotmail.com" wrote: > I think it may be useful to someone to read it. > The problem went away after restarting the computer. > After analyzing the code, I believe it was caused by the following > actions. > Initialy when I experimented with Excel, I made a logical error not > closing the Excel file in some cases. > It created multiple instances of Excels. > I killed all of them using Task Manager. > Probably, it was not enough. After fixing the error and restarting the > computer, it works fine. > > Regards, > Vladimir Belorusets, > SQA Manager, Xerox > > On Apr 2, 10:30 pm, "vladimir...@hotmail.com" > > > > wrote: > > When I reverting back to my initial code, it does not work now . > > The error occurs while executing startup() function. > > My test cases start with the following code: > > > $: << File.expand_path("c:/watir testware/libraries") > > require 'setup' > > startup() > > > > > The setup library has the following code: > > # load all supporting libraries > > require 'watir' > > require 'DSlib' > > require 'general' > > require 'win32ole' > > > def startup > > # redirect stdout to results file > > @orig_stdout = $stdout > > > $base = "http://crisp.adoc.xerox.com:8080/docushare/dsweb/"; > > $ie = Watir::IE.new # I believe it fails here > > > # get results file name > > rfile = str_get_last_element( $0, '/' ) > > rfile = rfile.split( '.' ).first > > $stdout = File.new("c:/watir testware/results/" + rfile + ".txt", > > 'w') > > puts "Inside startup." > > end > > --- > > The problem happened after I wrote the following innocent code, which > > works fine: > > > def ex_get_value( excel_file, header ) > > require 'win32ole' > > app = WIN32OLE.new( 'Excel.Application' ) > > # app.Visible = 1 > > wb = app.Workbooks.Open( "C:/Watir Testware/Scripts/ > > cm_CreateCollectionAsCPXUser.xls" ) > > ws = wb.Worksheets( 1 ) > > > # number of used columns in the worksheet > > col_total = ws.UsedRange.Columns.Count > > for i in 1..col_total do > > v = ws.Cells( 1, i ).Value > > break if ( v == header ) > > if i == col_total > > puts "No column with #{header} header was found." > > app.ActiveWorkbook.Close( 0 ) > > app.Quit() > > return > > end > > end > > > puts ws.Cells( 2, i ).Value > > app.ActiveWorkbook.Close( 0 ) > > app.Quit() > > > end > > > ex_get_value( "C:/Watir Testware/Scripts/ > > cm_CreateCollectionAsCPXUser.xls", "password" ) > > > But now the startup() code stopped working. > > May be I need to kill some processes? > > > Thanks, > > Vladimir > > > On Apr 2, 10:09 pm, Chuck van der Linden wrote: > > > > what sort of experimenting were you doing? what things did you > > > change during the course of your experiments? > > > > have you tried reverting back to the code from before your > > > experiments, does it work or is it now also broken?. (you are using > > > source control, or at least keeping backups right?) > > > > On Apr 2, 8:19 pm, "vladimir...@hotmail.com" > > > wrote: > > > > > My Watir scripts worked fine. But after experimenting with Excel > > > > files, I'm getting this error. > > > > > failed to create WIN32OLE object from `InternetExplorer.Application' > > > > HRESULT error code:0x80004005 > > > > Unspecified error > > > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > > > > 167:in `initial > > > > ize' > > > > > It happened at $ie = Watir::IE.new. > > > > Again it worked before. > > > > > Please, help. Very upset. > > > > > Vladimir- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: WIN32OLE Error
I think it may be useful to someone to read it. The problem went away after restarting the computer. After analyzing the code, I believe it was caused by the following actions. Initialy when I experimented with Excel, I made a logical error not closing the Excel file in some cases. It created multiple instances of Excels. I killed all of them using Task Manager. Probably, it was not enough. After fixing the error and restarting the computer, it works fine. Regards, Vladimir Belorusets, SQA Manager, Xerox On Apr 2, 10:30 pm, "vladimir...@hotmail.com" wrote: > When I reverting back to my initial code, it does not work now . > The error occurs while executing startup() function. > My test cases start with the following code: > > $: << File.expand_path("c:/watir testware/libraries") > require 'setup' > startup() > > > The setup library has the following code: > # load all supporting libraries > require 'watir' > require 'DSlib' > require 'general' > require 'win32ole' > > def startup > # redirect stdout to results file > @orig_stdout = $stdout > > $base = "http://crisp.adoc.xerox.com:8080/docushare/dsweb/"; > $ie = Watir::IE.new # I believe it fails here > > # get results file name > rfile = str_get_last_element( $0, '/' ) > rfile = rfile.split( '.' ).first > $stdout = File.new("c:/watir testware/results/" + rfile + ".txt", > 'w') > puts "Inside startup." > end > --- > The problem happened after I wrote the following innocent code, which > works fine: > > def ex_get_value( excel_file, header ) > require 'win32ole' > app = WIN32OLE.new( 'Excel.Application' ) > # app.Visible = 1 > wb = app.Workbooks.Open( "C:/Watir Testware/Scripts/ > cm_CreateCollectionAsCPXUser.xls" ) > ws = wb.Worksheets( 1 ) > > # number of used columns in the worksheet > col_total = ws.UsedRange.Columns.Count > for i in 1..col_total do > v = ws.Cells( 1, i ).Value > break if ( v == header ) > if i == col_total > puts "No column with #{header} header was found." > app.ActiveWorkbook.Close( 0 ) > app.Quit() > return > end > end > > puts ws.Cells( 2, i ).Value > app.ActiveWorkbook.Close( 0 ) > app.Quit() > > end > > ex_get_value( "C:/Watir Testware/Scripts/ > cm_CreateCollectionAsCPXUser.xls", "password" ) > > But now the startup() code stopped working. > May be I need to kill some processes? > > Thanks, > Vladimir > > On Apr 2, 10:09 pm, Chuck van der Linden wrote: > > > > > what sort of experimenting were you doing? what things did you > > change during the course of your experiments? > > > have you tried reverting back to the code from before your > > experiments, does it work or is it now also broken?. (you are using > > source control, or at least keeping backups right?) > > > On Apr 2, 8:19 pm, "vladimir...@hotmail.com" > > wrote: > > > > My Watir scripts worked fine. But after experimenting with Excel > > > files, I'm getting this error. > > > > failed to create WIN32OLE object from `InternetExplorer.Application' > > > HRESULT error code:0x80004005 > > > Unspecified error > > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > > > 167:in `initial > > > ize' > > > > It happened at $ie = Watir::IE.new. > > > Again it worked before. > > > > Please, help. Very upset. > > > > Vladimir- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: WIN32OLE Error
When I reverting back to my initial code, it does not work now . The error occurs while executing startup() function. My test cases start with the following code: $: << File.expand_path("c:/watir testware/libraries") require 'setup' startup() The setup library has the following code: # load all supporting libraries require 'watir' require 'DSlib' require 'general' require 'win32ole' def startup # redirect stdout to results file @orig_stdout = $stdout $base = "http://crisp.adoc.xerox.com:8080/docushare/dsweb/"; $ie = Watir::IE.new # I believe it fails here # get results file name rfile = str_get_last_element( $0, '/' ) rfile = rfile.split( '.' ).first $stdout = File.new("c:/watir testware/results/" + rfile + ".txt", 'w') puts "Inside startup." end --- The problem happened after I wrote the following innocent code, which works fine: def ex_get_value( excel_file, header ) require 'win32ole' app = WIN32OLE.new( 'Excel.Application' ) # app.Visible = 1 wb = app.Workbooks.Open( "C:/Watir Testware/Scripts/ cm_CreateCollectionAsCPXUser.xls" ) ws = wb.Worksheets( 1 ) # number of used columns in the worksheet col_total = ws.UsedRange.Columns.Count for i in 1..col_total do v = ws.Cells( 1, i ).Value break if ( v == header ) if i == col_total puts "No column with #{header} header was found." app.ActiveWorkbook.Close( 0 ) app.Quit() return end end puts ws.Cells( 2, i ).Value app.ActiveWorkbook.Close( 0 ) app.Quit() end ex_get_value( "C:/Watir Testware/Scripts/ cm_CreateCollectionAsCPXUser.xls", "password" ) But now the startup() code stopped working. May be I need to kill some processes? Thanks, Vladimir On Apr 2, 10:09 pm, Chuck van der Linden wrote: > what sort of experimenting were you doing? what things did you > change during the course of your experiments? > > have you tried reverting back to the code from before your > experiments, does it work or is it now also broken?. (you are using > source control, or at least keeping backups right?) > > On Apr 2, 8:19 pm, "vladimir...@hotmail.com" > wrote: > > > > > My Watir scripts worked fine. But after experimenting with Excel > > files, I'm getting this error. > > > failed to create WIN32OLE object from `InternetExplorer.Application' > > HRESULT error code:0x80004005 > > Unspecified error > > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > > 167:in `initial > > ize' > > > It happened at $ie = Watir::IE.new. > > Again it worked before. > > > Please, help. Very upset. > > > Vladimir- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: WIN32OLE Error
what sort of experimenting were you doing? what things did you change during the course of your experiments? have you tried reverting back to the code from before your experiments, does it work or is it now also broken?. (you are using source control, or at least keeping backups right?) On Apr 2, 8:19 pm, "vladimir...@hotmail.com" wrote: > My Watir scripts worked fine. But after experimenting with Excel > files, I'm getting this error. > > failed to create WIN32OLE object from `InternetExplorer.Application' > HRESULT error code:0x80004005 > Unspecified error > C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-class.rb: > 167:in `initial > ize' > > It happened at $ie = Watir::IE.new. > Again it worked before. > > Please, help. Very upset. > > Vladimir --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---