autotelik / datashift

Full Excel/CSV Import/Export facilities for Rails
http://www.autotelik.co.uk
Other
136 stars 75 forks source link

NoMethodError: undefined method `compact' for #<Java::OrgApachePoiHssfUsermodel::HSSFRow:0x762c1d96> #37

Open ping0xFF opened 8 years ago

ping0xFF commented 8 years ago
bundle execute thor datashift_spree:load:products -i ~/datashift_autotelik/spec/fixtures/SpreeProductsMandatoryOnly.xls 

DataShift::Product starting upload from file: /root/datashift_autotelik/spec/fixtures/SpreeProductsMandatoryOnly.xls

Loading from Excel file: /root/datashift_autotelik/spec/fixtures/SpreeProductsMandatoryOnly.xls
["sku", "name", "price"]
["sku", "name", "description", "shipping_category", "price", "option_types"]
ERROR: Excel loading failed : #<NoMethodError: undefined method `pry' for #<Binding:0x3c99ea87>>

Processing Summary Report
>>>>>>>>>>>>>>>>>>>>>>>>>
Processed total of 0 inbound entry
0   database objects were successfully processed.
0   inbound rows were successfully processed.
There were NO failures.
NoMethodError: undefined method `pry' for #<Binding:0x3c99ea87>
      perform_excel_load at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift-91b44de22c91/lib/loaders/excel_loader.rb:92
         each_with_index at file:/usr/local/rvm/rubies/jruby-1.7.19/lib/jruby.jar!/jruby/java/java_ext/java.lang.rb:19
      perform_excel_load at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift-91b44de22c91/lib/loaders/excel_loader.rb:80
             transaction at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/activerecord-4.1.11/lib/active_record/connection_adapters/abstract/database_statements.rb:201
  within_new_transaction at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/activerecord-4.1.11/lib/active_record/connection_adapters/abstract/database_statements.rb:209
             transaction at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/activerecord-4.1.11/lib/active_record/connection_adapters/abstract/database_statements.rb:201
             transaction at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/activerecord-4.1.11/lib/active_record/transactions.rb:208
      perform_excel_load at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift-91b44de22c91/lib/loaders/excel_loader.rb:78
            perform_load at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift-91b44de22c91/lib/loaders/loader_base.rb:118
            perform_load at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift_spree-37f79a7bf671/lib/loaders/spree/spree_base_loader.rb:55
            perform_load at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift_spree-37f79a7bf671/lib/loaders/spree/product_loader.rb:58
                products at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift_spree-37f79a7bf671/lib/thor/spree/products_images.thor:69
                     run at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/command.rb:27
          invoke_command at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/invocation.rb:126
                dispatch at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor.rb:359
                   start at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/base.rb:440
          method_missing at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/runner.rb:36
                     run at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/command.rb:29
                     run at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/command.rb:126
          invoke_command at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/invocation.rb:126
                dispatch at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor.rb:359
                   start at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/lib/thor/base.rb:440
                  (root) at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/gems/thor-0.19.1/bin/thor:6
                    load at org/jruby/RubyKernel.java:1087
                  (root) at /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bin/thor:23

I used a pry statement in lib/loaders/excel_loader.rb

# be thor datashift_spree:load:products -i ~/datashift_autotelik/spec/fixtures/SpreeProductsMandatoryOnly.xls 
[WARNING] You are not setting Devise.secret_key within your application!
You must set this in config/initializers/devise.rb. Here's an example:

Devise.secret_key = "0d17b9c9239f700e20e4b526459e55257301cd84c46f0654e70821ddbff6b1da631f1d011f59bc2f270d2c5ae6d0169c6903"
Instance method "open" is already defined in Object, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.
DataShift::Product starting upload from file: /root/datashift_autotelik/spec/fixtures/SpreeProductsMandatoryOnly.xls

Loading from Excel file: /root/datashift_autotelik/spec/fixtures/SpreeProductsMandatoryOnly.xls
["sku", "name", "price"]
["sku", "name", "description", "shipping_category", "price", "option_types"]

From: /usr/local/rvm/gems/jruby-1.7.19@mystore20151008/bundler/gems/datashift-91b44de22c91/lib/loaders/excel_loader.rb @ line 92 DataShift::ExcelLoading#perform_excel_load:

    87:             # Excel num_rows seems to return all 'visible' rows, which appears to be greater than the actual data rows
    88:             # (TODO - write spec to process .xls with a huge number of rows)
    89:             #
    90:             # This is rubbish but currently manually detect when actual data ends, this isn't very smart but
    91:             # got no better idea than ending once we hit the first completely empty row
 => 92:             binding.pry
    93:             break if(@current_row.nil? || @current_row.compact.empty?)
    94: 
    95:             logger.info "Processing Row #{current_row_idx} : #{@current_row}"
    96: 
    97:             @contains_data = false

[1] pry(#<DataShift::SpreeEcom::ProductLoader>)> @current_row
=> #<Java::OrgApachePoiHssfUsermodel::HSSFRow:0x762c1d96>
[2] pry(#<DataShift::SpreeEcom::ProductLoader>)> @current_row.nil?
=> false
[3] pry(#<DataShift::SpreeEcom::ProductLoader>)> @current_row.compact
NoMethodError: undefined method `compact' for #<Java::OrgApachePoiHssfUsermodel::HSSFRow:0x762c1d96>
from (pry):3:in `evaluate_ruby'

environment: jruby 1.7.19, java version "1.7.0_95", rails (4.1.11)