Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #7210
| X-Received | by 10.129.158.86 with SMTP id v83mr574134ywg.7.1460431875131; Mon, 11 Apr 2016 20:31:15 -0700 (PDT) |
|---|---|
| X-Received | by 10.182.133.3 with SMTP id oy3mr4233obb.4.1460431875051; Mon, 11 Apr 2016 20:31:15 -0700 (PDT) |
| Path | csiph.com!weretis.net!feeder6.news.weretis.net!news.glorb.com!7no1843155qgj.0!news-out.google.com!j7ni133igm.0!nntp.google.com!nt3no11394810igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.ruby |
| Date | Mon, 11 Apr 2016 20:31:14 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=116.89.57.142; posting-account=V6fVrwoAAAB_KNNhh7gdmvqhYlmrIkSO |
| NNTP-Posting-Host | 116.89.57.142 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <affb94ab-54dc-4ab1-9220-b87bb4f9aa2f@googlegroups.com> (permalink) |
| Subject | in `open': no implicit conversion of nil into String (TypeError) from ex30.rb:3:in `<main>' |
| From | Cai Gengyang <gengyangcai@gmail.com> |
| Injection-Date | Tue, 12 Apr 2016 03:31:15 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.ruby:7210 |
Show key headers only | View raw
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 ?
Gengyang
Back to comp.lang.ruby | Previous | Next — Next in thread | Find similar
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