Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6725253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:47:08+00:00 2026-05-26T09:47:08+00:00

This is an error that I’m getting when I run a script. repo nikhil$

  • 0

This is an error that I’m getting when I run a script.

repo nikhil$ ruby repobuilder.rb
Resuming from package:20
Now Processing 21
repobuilder.rb:16:in `gets': closed stream (IOError)
    from repobuilder.rb:16
    from repobuilder.rb:15:in `open'
    from repobuilder.rb:15

My platform is

repo nikhil$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
repo nikhil$ uname -a
Darwin Radha Krishna 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 

and the script that causes this is

require 'rubygems'
require 'nokogiri'
require 'open-uri'


# additional code to make sure that we can resume after a break seamlessly
last_package = 0
File.open('lastbreak','r') { |fptr| last_package = fptr.gets.to_i }
puts "Resuming from package:#{last_package}" if last_package != 0

# to read each package from packageslist.txt and fetch the required info
# also to store this into a file that can easily be read by the c++ program
BASE_URL = "http://packages.debian.org/stable/"

File.open('packages_list.txt','r') do | fptr |
  while line = fptr.gets
    package_id = line.split[0].to_i
    package = line.split[1]
    dependencies = ""
    url = BASE_URL + package
    if package_id >= last_package
      doc = doc = Nokogiri::HTML(open(url))
      doc.css(".uldep a").each do |dependency|
        dependencies << dependency.text + ","
      end
      dependencies = dependencies.split(',').uniq.join(',')
      description = doc.css('#pdesc').text.strip
      if doc.css('#content h1').text 
         version = doc.css('#content h1').text.strip.scan( /\(([^>]*)\)/).last.first
      end

      File.open("packages/#{package}","w") do |wfptr|
      wfptr.puts "PackageId:#{package_id}"
      wfptr.puts "Name:#{package}"
     # wfptr.puts "Version:#{version}"
      wfptr.puts "Deps:#{dependencies}"
      end
      File.open("packages/#{package}.description",'w') {|wf| wf.write(description.capitalize)}

      package_id += 1
      puts "Now Processing #{package_id}"
      File.open('lastbreak','w') { |fptr| fptr.puts "#{package_id}" }
    end
  end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:47:09+00:00Added an answer on May 26, 2026 at 9:47 am

    I am on a different system so I cannot check your code. Anyway I suggest using File.foreach:

    File.foreach("packages_list.txt") do |line|
      package_id = line.split[0].to_i
      package = line.split[1]
      dependencies = ""
      url = BASE_URL + package
      if package_id >= last_package
        doc = Nokogiri::HTML(open(url))
        doc.css(".uldep a").each do |dependency|
          dependencies << dependency.text + ","
        end
        dependencies = dependencies.split(',').uniq.join(',')
        description = doc.css('#pdesc').text.strip
        if doc.css('#content h1').text 
           version = doc.css('#content h1').text.strip.scan( /\(([^>]*)\)/).last.first
        end
    
        File.open("packages/#{package}","w") do |wfptr|
          wfptr.puts "PackageId:#{package_id}"
          wfptr.puts "Name:#{package}"
          wfptr.puts "Deps:#{dependencies}"
        end
        File.open("packages/#{package}.description",'w') {|wf| wf.write(description.capitalize)}
    
        package_id += 1
        puts "Now Processing #{package_id}"
        File.open('lastbreak','w') { |fptr| fptr.puts "#{package_id}" }
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error now that I hit version number 1.256.0: Error 4
We're getting this error once a day on a script that runs every two
I'm getting this error that says that my package is name doesn't reflect the
I have this error that is keeping me from moving forward. I basically have
Im getting this linker error that won't let me compile. It only happens on
I'm getting this error after trying to appendChild to an element that was just
I am getting this error when I include an opensource library that I had
I am getting this error that is related to ReportsViewer. I need to eliminate
So I keep getting this error that when I Google for it, the most
I'm not sure why I'm getting this error that's terminating my connection. I updated

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.