Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #7212

Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>'

Newsgroups comp.lang.ruby
Date 2016-04-12 22:34 -0700
References <affb94ab-54dc-4ab1-9220-b87bb4f9aa2f@googlegroups.com> <dn3hpoFrof4U1@mid.individual.net>
Message-ID <d75aaf70-8ae3-451a-a2a4-ae600509936c@googlegroups.com> (permalink)
Subject Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>'
From Cai Gengyang <gengyangcai@gmail.com>

Show all headers | View raw


What does "invoking the script without arguments" mean ? 

On Tuesday, April 12, 2016 at 2:10:08 PM UTC+8, Robert Klemme wrote:
> On 12.04.2016 05:31, Cai Gengyang wrote:
> > This is my file which I saved as ex30.rb :
> >
> > filename = ARGV.first
> >
> > txt = open(filename)
> >
> > puts "Here's your file #{filename}:"
> > print txt.read
> >
> > print "Type the filename again: "
> > file_again = $stdin.gets.chomp
> >
> > txt_again = open(file_again)
> >
> > print txt_again.read
> >
> > This is the error I got when I tried to run it in my Terminal :
> >
> > CaiGengYangs-MacBook-Pro:GoatBoy CaiGengYang$ ruby ex30.rb
> > ex30.rb:3:in `open': no implicit conversion of nil into String (TypeError)
> > 	from ex30.rb:3:in `<main>'
> >
> > What's the error here ?
> 
> Invoking the script without arguments.
> 
> 	robert
> 
> -- 
> remember.guy do |as, often| as.you_can - without end
> http://blog.rubybestpractices.com/

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

in `open': no implicit conversion of nil into String (TypeError)  from ex30.rb:3:in `<main>' Cai Gengyang <gengyangcai@gmail.com> - 2016-04-11 20:31 -0700
  Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>' Robert Klemme <shortcutter@googlemail.com> - 2016-04-12 08:09 +0200
    Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>' Cai Gengyang <gengyangcai@gmail.com> - 2016-04-12 22:34 -0700
      Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>' Sebastian Christ <rudolfo.christ@gmail.com> - 2016-04-13 10:23 +0200
        Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>' Cai Gengyang <gengyangcai@gmail.com> - 2016-04-13 09:08 -0700
          Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>' Robert Klemme <shortcutter@googlemail.com> - 2016-04-13 20:27 +0200
            Re: in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>' Cai Gengyang <gengyangcai@gmail.com> - 2016-04-14 21:59 -0700

csiph-web