16 Jul 2011, 13:48
Generic-user-small

shiloh speights (3 posts)

If any one has the problem with the code puts 1 + 2 on the second chapter of learn to program…Well I found a solution. go into your text editor and then type puts 1 + 2 of course. Then go to your command propt then type cd desktop and then get you program out of the folder and then run the program the way that chris pine told you to do it. ruby ( than your program name )

24 Sep 2011, 14:59
Generic-user-small

Bogdan Vinnarlund (2 posts)

Hi, I too have this problem, but nothing seems to work. I downloaded Ruby and saved it in C>Programs, but TextEditor wasnt inside like the book described. So I had to download it manually and I did, Scintilla text editor (SciTe). I clicked on it and I made 1+2 program and saved it in my “user” psace in a file I named “Ruby Programs”. I named it calc.rb just like the book says. I runned “Command prompt with Ruby” just like the book says. But I got this message “Ruby is not an itern commando, extern commando, programm or a commando file”. I checked on the internet and found that the program and ruby should be in the same file so I moved ruby from programs and in to “Ruby Programs”-file, and it still displays the same error.

This is how it looks when I open commando prompt: Can not find the searchway C:\Users\Bogdan>

Then I write in “ruby calc.rb” so it looks like this: Can not find the searchway C:\Users\Bogdan>ruby calc.rb

and I press “Enter”: Can not find the searchway C:\Users\Bogdan>ruby calc.rb ruby is not an intern commando, extern commando, programm or a commando file

I do not know what I am doing wrong. Should I try and delete it all and reinstall all the components? I do not know how to fix this, I have been following the book on the spot.

I have been wanting to learn how to programm for years and now when I finally have some time to do it I got stuck on the first assignment. Please, please help.

Regards Bogdan Vinnarlund

26 Sep 2011, 10:47
Med__2008.08.19.09.44.43_pragsmall

Chris Pine (58 posts)

Sounds like Ruby was not installed properly. The path to the Ruby executable needs to be in your PATH variable (but this should happen on installation).

Reboot your computer, and try again. If that doesn’t work, uninstall and reinstall Ruby. If that doesn’t work, then you’ll need to add the path to ruby.exe manually to your PATH variable (which you can Google about).

Hope that helps,

Chris

18 Oct 2011, 17:10
Generic-user-small

Bogdan Vinnarlund (2 posts)

Thanks, I understood what the problem was and am now geting through your book Chris. I have another question, I wanted to make a separate topic, but I dont really see how it is done on this website. Anyways, chapter 5: More about methods; when it comes to “self.puts” code, I just cant make it work. When I type, lets say:

three = 3 puts three self.puts three

I get (11.rb is the name of my file):

3 11.rb:3:in <main>´: private method puts´ called for main:Object

I would be very thankful if anyone could explain why I am geting that error. It is perhaps not so important as I can go on without it, but I would still like to know.

Regards Bogdan Vinnarlund

18 Oct 2011, 19:32
Med__2008.08.19.09.44.43_pragsmall

Chris Pine (58 posts)

I think you must just be using a different version of Ruby, and they must have changed this behavior. It’s not a big deal (as you’d never write code like this anyway), so I’d just ignore it and move on.

13 Feb 2012, 18:24
Generic-user-small

Eddie Robbins (2 posts)

can you give an example of what c:\users\eddie.robbins\ would look like please I am stuck and really want to learn programming Thank you

17 Dec 2013, 15:12
Generic-user-small

Kevin Mullen (3 posts)

HELP! Ok so I have done everything Chris says in chapter 2, and I’m getting nothing I have read the previous comments. I’m in…

C:\Users\K M>ruby -v ruby 1.8.6 <2007-03-13 patchlevel 0> [i386-mswin32]

C:\Users\K M>ruby calc.rb

ruby: No such file or directory – calc.rb

then I did what Shiloh suggest command prompt cd desktop

C:\Users\K M\Desktop>ruby calc.rb

ruby: No such file or directory – calc.rb

So I reinstalled it and I’m have the same problem. I opened a new command prompt window

C:\Users\K M>ruby.exe it changed the header of the prompt to

Command Prompt-ruby.exe the typed ruby calc.rb and I get nothing now, it won’t respond to anything I type????HELP!!! someone.

17 Dec 2013, 20:52
Med__2008.08.19.09.44.43_pragsmall

Chris Pine (58 posts)

It sounds like Ruby installed just fine. The problem is that it cannot find your program. Where did you place calc.rb? You need to be in that directory before you run your program.

18 Dec 2013, 16:41
Generic-user-small

Kevin Mullen (3 posts)

on my desktop in a folder that I called something really creative like “programs” lol, inside my programs folder is my calc.rb

I have tried

C:\Users\K M>programs

C:\Users\K M>desktop

C:\Users\K M>desktop\programs

it seems no matter how I type it, it does not want to work??

18 Dec 2013, 20:51
Med__2008.08.19.09.44.43_pragsmall

Chris Pine (58 posts)

Read the first chapter. :) It’s just a few pages, since you only need to read the Windows section.

What you need to do is this:

C:\Users\K M>cd desktop

C:\Users\K M\Desktop>cd programs

C:\Users\K M\Desktop\programs>ruby calc.rb

Hopefully that works. But again, the first chapter explains this, and what these commands mean.

18 Dec 2013, 20:04
Generic-user-small

Kevin Mullen (3 posts)

Chris Pine is the man! I did not realize I had to hit cd each time. It worked thank you sooo much my brother. Your awesome! I’m crusin now. I hope this will be helpful to beginners like me that kind of over looked that in the first chapter.

18 Dec 2013, 20:51
Med__2008.08.19.09.44.43_pragsmall

Chris Pine (58 posts)

Awesome!

03 Feb 2014, 15:22
Generic-user-small

Niels Sønderborg (2 posts)

I’ve got the error ruby: No such file or directory – calc.rb (LoadError) (Mac) I’ve ceated a folder “Programs” Inside this I’ve got a file “calc.rb” In the command line I type “ruby -v” and gets “ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]” I then type “ls” which gives “Niels-Snderborgs-iMac:Programs nielsrask$ ls calc.rb “ saying the file is there but when I type “ruby calc.rb” all I get is “Niels-Snderborgs-iMac:Programs nielsrask$ ruby calc.rb /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:212: warning: Insecure world writable dir /usr/local in PATH, mode 040777 ruby: No such file or directory – calc.rb (LoadError)” I’ve check sharing and permission of folder “Programs” and the file “calc.rb”, both of which says “read and write”- what am I doing wrong ?

03 Feb 2014, 18:15
Med__2008.08.19.09.44.43_pragsmall

Chris Pine (58 posts)

I have never seen that problem before. First thing I would do is fix that warning, though. Googling turned up this:

http://stackoverflow.com/questions/3952243/warning-insecure-world-writable-dir

Fix that first, and then see if it works?

04 Feb 2014, 08:30
Generic-user-small

Niels Sønderborg (2 posts)

Thanks for the advise. But the error had is its root in the source-file which I created with Textmate.( with extension .rb). I downloaded the program Ruby Runner and then created af source file with extension .rb. The new file had a very different icon than the one I created with Textmate. I was then able to run the source file both with Ruby Runner and Terminal. Any way I up and running - and looking forward for Ruby

24 May 2014, 01:31
Picture 029_pragsmall

Monica Monedero (1 post)

Hi Chris,

I was having the same problem as Kevin Mullen did above. I re-read chapter one and also did the steps you advised to him above. I am getting the following message:

C:\Documents and Settings\owner\cd desktop

C:\Documents and Settings\owner\Desktop>cd program The system cannot find the path specified.

Any ideas? Thanks! Monica

27 May 2014, 05:26
Med__2008.08.19.09.44.43_pragsmall

Chris Pine (58 posts)

That will work only if you first created a folder on your desktop called “program”. Try that and let me know if you still have problems.

  You must be logged in to comment