0

I am getting a java.util.NoSuchElementException: None.get on the following code:

// Deserialize a directory bundle
val bundle = (for(bundleFile <- managed(BundleFile(bundle_path))) yield {
    bundleFile.loadMleapBundle().get
}).opt.get

The error is on the opt.get line

rmilbu
  • 1
  • 1
    That's because `bundleFile.loadMleapBundle()` returns a None. Please read our guide how to ask questions https://stackoverflow.com/help/mcve – aBnormaLz Jan 31 '19 at 16:30

1 Answers1

0

An example from one of MLeap's tests deserializes a bundle this way:

val bundle = (for(bundle <- managed(BundleFile(new File(lrUri.getPath)))) yield {
      bundle.loadMleapBundle().get
    }).tried.get

Perhaps you should use tried instead of opt.

ordonezalex
  • 2,645
  • 1
  • 20
  • 33