Code Monkey home page Code Monkey logo

Comments (14)

fringd avatar fringd commented on May 21, 2024

So it seems that there is a problem not with rails, but with irb

to reproduce

irb
> require 'spreadsheet'
> Spreadsheet.open 'my_file.xls'

does anybody else have this problem with their files?

same problem with pry. eats up gigabytes of memory and grows and grows

from spreadsheet.

fringd avatar fringd commented on May 21, 2024

OKAY, so my real problem is that Workbook cannot be nicely printed...

> book = Spreadsheet.open 'my_file.xls';nil
=> nil

works fine, but then

> book

again waits forever...
there's some sort of infinite loop in the inspection code...

from spreadsheet.

fringd avatar fringd commented on May 21, 2024

the culprit seems to be that workbook#inspect loops over all its instance variables, and so does worksheet.... does worksheet keep a reference back to workbook somewhere?

from spreadsheet.

zdavatz avatar zdavatz commented on May 21, 2024

How was the file "my_file.xls" created? Did you create that file with MS Office, LibreOffice or with spreadsheet?

from spreadsheet.

victor-ono avatar victor-ono commented on May 21, 2024

I have the same problem with memory in irb under Ruby 1.9.3. No problem under 1.8.7

from spreadsheet.

zdavatz avatar zdavatz commented on May 21, 2024

interesting.

from spreadsheet.

BiggerNoise avatar BiggerNoise commented on May 21, 2024

Ditto. Same problem under irb, ruby 1.9.3 (installed from RVM if that matters).

from spreadsheet.

zdavatz avatar zdavatz commented on May 21, 2024

BiggerNoise: What is your sample code? What are you trying to do?

from spreadsheet.

BiggerNoise avatar BiggerNoise commented on May 21, 2024

Sample is:

require 'spreadsheet'
wb = Spreadsheet.open('./tmp/analysis.summary.xls')

If I try and run this under irb, it will exhaust the memory on my machine (starting from ~8GiB).

However, if I just put this in a script, it will run fine. I am able to see the worksheets and get row and column counts.

As far as what I am trying to accomplish, my ultimate goal is to take the spreadsheet that this analysis program produces and import it into my rails application. I may need to jump through some hoops to make that happen in a reasonably performant way, but the first step will be reading the spreadsheet.

Let me know if that answers your questions.

from spreadsheet.

zdavatz avatar zdavatz commented on May 21, 2024

Yes, it does answer my question. I do not know why irb is exhausting your memory. Are you on Linux or Windows or Mac?

from spreadsheet.

BiggerNoise avatar BiggerNoise commented on May 21, 2024

I am running Mac (10.7). And, if it helps:

andy@Andy-MBP:Crucible $ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]

I did follow the advice that I found elsewhere and shutdown irb's inspection of the workbook:

wb = Spreadsheet.open('./tmp/analysis.summary.xls'); nil

That allows me to work in irb.

from spreadsheet.

zdavatz avatar zdavatz commented on May 21, 2024

Awesome! Can you post analysis.summary.xls somewhere please and link it here.

from spreadsheet.

BiggerNoise avatar BiggerNoise commented on May 21, 2024

I am trying to make a spreadsheet where I can reproduce the problem. Unfortunately, I can't post the one that is actually giving me grief. I will see what I can do and get back to you.

from spreadsheet.

zdavatz avatar zdavatz commented on May 21, 2024

Also see:
https://groups.google.com/d/msg/rubyspreadsheet/vkHOulBnjMc/r792XlGEWLsJ
and
https://gist.github.com/4636781

from spreadsheet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.