Announcing the new Datavyu v1.3.6 with enhanced features and transcription support!

Hi, I'm getting this error when running a print script:

** SCRIPT ERRROR ** @Line -1:'org.jruby.exceptions.RaiseException: <script>:1762: , unexpected end-of-file '


here's my script:

-----------------------------------------------------------------

begin filedir = "/Volumes/LABDOCS/StudiesCurrent/FirstSteps/Studies/FS_MomResponse/OpenSHAPA/Export/" filenames = Dir.new(filedir).entries

dir = File.expand_path("~/Desktop") out_file = File.new(dir + "/MomResponse_IdBidstatMomcodeMomtrans.txt", "a")

for file in filenames if file.include?(".opf") and file[0].chr != '.'

  puts "LOADING DATABASE: " + filedir+file
  $db,proj = load_db(filedir+file)
  puts "SUCCESSFULLY LOADED"

id = getVariable("id") bidstat = getVariable("bidstat") momcode = getVariable("momcode") momtrans = getVariable("momtrans")

for idcell in id.cells for bidstatcell in bidstat.cells if bidstatcell.onset >= idcell.onset and bidstatcell.offset <= idcell.offset if not(bidstatcell.bidstattoemo == "n") for momcodecell in momcode.cells if momcodecell.onset <= bidstatcell.onset and bidstatcell.offset <= momcodecell.offset for momtranscell in momtrans.cells if momcodecell.onset == momtranscell.onset and momcodecell.offset == momtranscell.offset out_file.syswrite (idcell.study + "t" + idcell.id + "t" + idcell.sess + "t" + idcell.educ + "t" + idcell.tdate + "t" + idcell.loctype + "t" + idcell.sex + "t" + idcell.raceb + "t" + idcell.racem + "t" + idcell.ses + "t" + idcell.mbdate + "t" + idcell.bbdate + "t" + idcell.beldate + "t" + idcell.hkdate + "t" + idcell.wdate + "t" + idcell.lang + "t" + idcell.crudate + "t" + idcell.wdate2 + "t" + idcell.mvocab + "t" + idcell.maction + "t" + idcell.mgesture + "t" + idcell.mactwobj + "t" + idcell.mpretend + "t" + idcell.mimitate + "t" + bidstatcell.ordinal.to_s + "t" + "statbid" + "t" + momcodecell.ordinal.to_s + "t" + momcodecell.objcode + "t" + momcodecell.verbcode + "t" + momcodecell.actcode + "t" + momcodecell.loc + "t" + momtranscell.ordinal.to_s + "t" + momtranscell.verbal + "t" + momtranscell.action + "n") end end end end end end end end

end

what am i doing wrong? something about the directory? please help! many thanks! Lana

asked 09 May '12, 07:38

LanaKarasik's gravatar image

LanaKarasik
81111115
accept rate: 0%


It's hard to tell if there are any other issues without an example file but it looks like you might have missed a few 'end' statements.


begin

  filedir = "/Volumes/LABDOCS/StudiesCurrent/FirstSteps/Studies/FS_MomResponse/OpenSHAPA/Export/"
  filenames = Dir.new(filedir).entries
  dir = File.expand_path("~/Desktop")
  out_file = File.new(dir + "/MomResponse_IdBidstatMomcodeMomtrans.txt", "a")

  for file in filenames
    if file.include?(".opf") and file[0].chr != '.'
      puts "LOADING DATABASE: " + filedir+file
      $db, proj = load_db(filedir+file)
      puts "SUCCESSFULLY LOADED"

      id = getVariable("id")
      bidstat = getVariable("bidstat")
      momcode = getVariable("momcode")
      momtrans = getVariable("momtrans")

      for idcell in id.cells
        for bidstatcell in bidstat.cells
          if bidstatcell.onset >= idcell.onset and bidstatcell.offset <= idcell.offset
            if bidstatcell.bidstattoemo != "n"
              for momcodecell in momcode.cells
                if momcodecell.onset <= bidstatcell.onset and bidstatcell.offset <= momcodecell.offset
                  for momtranscell in momtrans.cells
                    if momcodecell.onset == momtranscell.onset and momcodecell.offset == momtranscell.offset
                      out_file.syswrite(idcell.study + "\t" + idcell.id + "\t" + idcell.sess + "\t" + idcell.educ +
                          "\t" + idcell.tdate + "\t" + idcell.loctype + "\t" + idcell.sex + "\t" + idcell.raceb +
                          "\t" + idcell.racem + "\t" + idcell.ses + "\t" + idcell.mbdate + "\t" + idcell.bbdate +
                          "\t" + idcell.beldate + "\t" + idcell.hkdate + "\t" + idcell.wdate + "\t" + idcell.lang +
                          "\t" + idcell.crudate + "\t" + idcell.wdate2 + "\t" + idcell.mvocab + "\t" + idcell.maction +
                          "\t" + idcell.mgesture + "\t" + idcell.mactwobj + "\t" + idcell.mpretend +
                          "\t" + idcell.mimitate + "\t" + bidstatcell.ordinal.to_s + "\t" + "statbid" +
                          "\t" + momcodecell.ordinal.to_s + "\t" + momcodecell.objcode + "\t" + momcodecell.verbcode +
                          "\t" + momcodecell.actcode + "\t" + momcodecell.loc + "\t" + momtranscell.ordinal.to_s +
                          "\t" + momtranscell.verbal + "\t" + momtranscell.action + "\n")
                    end
                  end
                end
              end
            end
          end
        end
      end

    end
  end

end
permanent link

answered 09 May '12, 23:32

jmburling's gravatar image

jmburling
1266613
accept rate: 0%

Yes! That's exactly it. I was missing 2 ends. Many thanks!!

permanent link

answered 10 May '12, 00:02

LanaKarasik's gravatar image

LanaKarasik
81111115
accept rate: 0%

Rather than post another answer, an easier way to mark something as correct is to use the "thumbs up" and tick icons next to an answer.

(10 May '12, 09:48) Clinton Clinton's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×46

question asked: 09 May '12, 07:38

question was seen: 3,681 times

last updated: 10 May '12, 09:48

powered by OSQA