Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rubyzip error causing havoc in my logs

Tags:

ruby

rubyzip

roo

Essentially my log files look something like this right now:

Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
...

Now under some investigation, I've found that this is due to Rubyzip and also due to when I seem to open a file in the following way...

require 'roo'

#Define files to read with location specify

today_file=(File.dirname(__FILE__) + '/output/today-report.xlsx')

yesterday_file=(File.dirname(__FILE__) + '/output/yesterday-report.xlsx')

lm_file=(File.dirname(__FILE__) + '/output/lm-report.xlsx')

#Define initial variables
txls = Roo::Excelx.new(today_file)
yxls = Roo::Excelx.new(yesterday_file)
lmxls = Roo::Excelx.new(lm_file)

Essentially this code is using a Ruby library called 'Roo' to open up some spreadsheets. All the code does is specify the current folder/specific file and then open using Roo.

I've rewritten these lines a few different ways to try and stop Rubyzip being as irritating but to no avail. Does anybody have any clue as to what is wrong here?

Thanks.

like image 414
Matt Visser Avatar asked Aug 11 '26 05:08

Matt Visser


1 Answers

Even better answer... add this to your ruby job

Zip.warn_invalid_date = false
like image 98
Matt Visser Avatar answered Aug 12 '26 18:08

Matt Visser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!