From: sto.mar@... Date: 2013-06-17T23:08:14+09:00 Subject: Re: Issue in reading data from yaml file Am 16.06.2013 20:43, schrieb Rochit Sen: > I have a very small yaml file as below: > --- > "logfile": C:\examples\code\launchy\devtrack\Dev_Weekly\log.txt > > In my ruby program i want to read the location of a file as specified in > the yaml file above. I am writing the following code: > > require 'yaml' > data = YAML.load('config.yml') > @path = data["logfile"] > puts @path > > But this is not showing anything in console, just blank. Two tips for analyzing what goes wrong: 1. Try it in irb: 2.0.0-p195 :006 > data = YAML.load('config.yml') => "config.yml" and you will see that YAML.load parses the argument string, not the file content 2. alternatively: insert puts (or better p) statements in your code, to see what is going on: data = YAML.load('config.yml') p data ... One solution would be to use YAML.load_file, like already suggested. --