maphub / scripts

A collection of scripts to prepare seed data (metadata, maps) for the maphub portal
1 stars 2 forks source link

generate-loc-seeddata execution fails #3

Open behas opened 12 years ago

behas commented 12 years ago

maphub@samos:~/maphub-seeddata/scripts$ ruby generate-loc-seeddata.rb -i ../../data/maps/ -m ../../data/metadata/ -n 5 Finding all the map files... Finding all the metadata files ... Creating output YAML File generate-loc-seeddata.rb:177:in <main>': undefined methodparent' for nil:NilClass (NoMethodError)

shionguha commented 12 years ago

I tested my code on both ruby versions and put up the question on stackoverflow because I don't know what else can be going wrong. Somebody suggested a possible fix. Here is the link: http://stackoverflow.com/questions/10093440/ruby-script-running-on-local-machine-but-not-running-on-server-version-issues#comment12944991_10093440

What do you think?

behas commented 12 years ago

My guess is that on of your XPATH expressions evaluate into NIL (= don't match) and you execute some method (e.g, ".text") on NIL.

Bernhard


Bernhard Haslhofer Postdoc Associate Cornell Information Science 301 College Ave. Ithaca, NY 14850 WWW: http://www.cs.cornell.edu/~bh392/ Skype: bernhard.haslhofer

On Wednesday, April 11, 2012 at 1:14 PM, Shion wrote:

I tested my code on both ruby versions and put up the question on stackoverflow because I don't know what else can be going wrong. Somebody suggested a possible fix. Here is the link: http://stackoverflow.com/questions/10093440/ruby-script-running-on-local-machine-but-not-running-on-server-version-issues#comment12944991_10093440

What do you think?


Reply to this email directly or view it on GitHub: https://github.com/maphub/maphub-seeddata/issues/3#issuecomment-5073824

shionguha commented 12 years ago

I just did the following to debug:

Copied my test maps directory, test metadata directory and script to the server to test the failure of the script on the server. Got the same error i.e.

generate-loc-seeddata.rb:177:in <main>': undefined methodparent' for nil:NilClass (NoMethodError)

Since the script with the exact same files and metadata work on my machine, they should also work on the server. However, they don't.

Line 177:

record_node = identifier_nodes.first.parent.parent #This is where I am trying to get the entire metadata record for a given identifier match

Since the 'parent' method cannot be found, I am a little perplexed because it comes from REXML which I understand is part of the standard Ruby library. This needs more investigation.

behas commented 12 years ago

I am pretty sure that you a have a typical NULL Pointer exception, which occur when you try to execute a method (e.g., parent) on a NIL object. Maybe one of your XPATH expressions result in no match (= NIL), but you still call .parent….

b


Bernhard Haslhofer Postdoc Associate Cornell Information Science 301 College Ave.
Ithaca, NY 14850 WWW: http://www.cs.cornell.edu/~bh392/ Skype: bernhard.haslhofer

On Friday, April 13, 2012 at 11:56 AM, Shion wrote:

I just did the following to debug:

Copied my test maps directory, test metadata directory and script to the server to test the failure of the script on the server. Got the same error i.e.

generate-loc-seeddata.rb:177:in <main>': undefined methodparent' for nil:NilClass (NoMethodError)

Since the script with the exact same files and metadata work on my machine, they should also work on the server. However, they don't.

Line 177: record_node = identifier_nodes.first.parent.parent #This is where I am trying to get the entire metadata record for a given identifier match

Since the 'parent' method cannot be found, I am a little perplexed because it comes from REXML which I understand is part of the standard Ruby library. This needs more investigation.


Reply to this email directly or view it on GitHub: https://github.com/maphub/maphub-seeddata/issues/3#issuecomment-5117614