Very Strange Behavior

14 views
Skip to first unread message

Anirudh Jagdish

unread,
Aug 22, 2017, 11:01:11 PM8/22/17
to nokogiri-talk
Im using nokogiri to add a script to the bottom of a svg file like so:

img_mod = File.open(path/to/image)
puts "\n" + script + "\n"
img_mod.root.add_chil script

Now..Here's the odd part: the code works only when the 'puts script' line is there. As soon as I comment that line out, I get the follwoing error:

Requires a Node, NodeSet or String argument, and cannot accept a NilClass. (You probably want to select a node from the Document with at() or search(), or create a new Node via Node.new().)

  I'm fairly new to ruby in general and nokogiri as well, but I'm at a complete loss here. How does having a puts statement affect anything the library is doing??

Reply all
Reply to author
Forward
0 new messages