Gavin Kistner wrote: > Why is Zlib::GzipWriter#close throwing an error here? The resulting > file comes out as desired. > > For now I've just thrown a rescue on the IOError and I'm happy, but > (based on the example in the Zlib documentation) I don't see what's > wrong here. What happens if you uncomment the line gz.write...? As #result has access to the current binding there's a chance that somewhere down the line there's a gz.close() which would close the GzipWriter. Other than that I don't have an idea either (apart from a bug). robert > > [Slim:Sites/SVG/GFTraits] gavinkis% ls *.svgz > tcsh: ls: No match. > > [Slim:Sites/SVG/GFTraits] gavinkis% tail -n 11 SocialNetworkSolver.rb > require 'erb' > require 'zlib' > File.open( $output_file, "w+" ){ |out_file| > gz = Zlib::GzipWriter.new( out_file ) > File.open( $template_file, 'r' ){ |template| > gz.write( ERB.new( template.read ).result( binding ) > ) } > gz.close > } > Stopwatch.mark( "Write SVGZ" ) > > [Slim:Sites/SVG/GFTraits] gavinkis% ruby SocialNetworkSolver.rb > Load file: 0.004s > Create springs: 0.003s > Create repulsors: 0.003s > Randomize placement: 0.001s > Run Simulation: 5.187s > Create SVG: 0.237s > SocialNetworkSolver.rb:251:in `close': closed stream (IOError) > from SocialNetworkSolver.rb:251:in `open' > from SocialNetworkSolver.rb:251 > > [Slim:Sites/SVG/GFTraits] gavinkis% ruby --version > ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0.0] > > [Slim:Sites/SVG/GFTraits] gavinkis% uname -a > Darwin Slim.local 8.2.0 Darwin Kernel Version 8.2.0: Fri Jun 24 > 17:46:54 PDT 2005; root:xnu-792.2.4.obj~3/RELEASE_PPC Power Macintosh > powerpc > > [Slim:Sites/SVG/GFTraits] gavinkis% ls *.svgz > GFTraits.svgz