Foutse
Foutse

Reputation: 125

sbt run fails whereas sbt package succeeds

Please I have a problem running my chisel code. When I do sbt package, I get a success. But when I do sbt run, it fails and I get the following error: Code error

I suspected that data is not loaded correctly then the array is not initialized or I simply forgot to initialize the array, but all the arrays are initialised.

So please my question is what is the correct way to load data in chisel?

This is what I did:

val data = io.Source.fromFile(args(0)).getLines().map(_.split(",").map(_.toDouble))
                .zipWithIndex
                .map{ case(data, id) => (id.toLong, data)}.toArray 

Where args is an array of strings defined as such

def main(args: Array[String]): Unit = {...

Looking forward to your responses
Thank you!

Upvotes: 1

Views: 106

Answers (1)

Vasiliy Ivashin
Vasiliy Ivashin

Reputation: 425

Looks like you get an exception when you're trying to access args(0) (if that's what on line 24 in main.scala).

When you do just sbt run you're not passing any command line arguments to main. Add your args after sbt run like this: sbt run foo bar

Upvotes: 3

Related Questions