I am trying to put a file name from a string but cannot.
This works well:
#!/usr/bin/ruby require 'httpclient' http2 = HTTPClient.new response = http2.get_content("http://example.com/version.ini") response.each_line do | line | http = HTTPClient.new my_file = open('file.zip', 'wb') my_file.write(http.get_content("http://example.com/data.zip")) end puts "Done."
But this is not so:
#!/usr/bin/ruby require 'httpclient' http2 = HTTPClient.new response = http2.get_content("http://example.com/version.ini") response.each_line do | line | puts line
Console:
C: /Ruby22-x64/lib/ruby/2.2.0/open-uri.rb: 36: in initialize': Invalid argument @ rb_sysopen - file.zip (Errno::EINVAL) from C:/Ruby22-x64/lib/ruby/2.2.0/open-uri.rb:36:in open 'from C: /Ruby22-x64/lib/ruby/2.2.0/open-uri.rb: 36: in open' from launcher.rb:10:in block in 'from launcher.rb: 7: in each_line' from launcher.rb:7:in
source share