# Stay in -i REPL after ERROR?

**URL:** <https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873>\
**Category:** General Usage\
**Tags:** first-steps, repl\
**Created:** [March 25, 2017, 9:15am UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873 "2017-03-25T09:15:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benoit9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benoit9/32/690_2.png) [@Benoit9](https://discourse.julialang.org/u/Benoit9)\
**Post date:** [March 25, 2017, 9:15am UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873/1 "2017-03-25T09:15:35Z")

</div>

I am debugging my first Julia script with the -i flag.  
After an Error, the interactive REPL exits.  
Is there a way to remain in the repl to examine the variables, definitions, etc. that caused the error?  
Thank you!

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [March 29, 2017, 2:36pm UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873/2 "2017-03-29T14:36:37Z")

</div>

from a julia REPL call `include("my_script.jl")`.

---

<div class="post-metadata">

**Author:** ![Benoit9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benoit9/32/690_2.png) [@Benoit9](https://discourse.julialang.org/u/Benoit9)\
**Post date:** [March 30, 2017, 5:44am UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873/3 "2017-03-30T05:44:07Z")

</div>

Thank you!  
My scripts usually have command line arguments. I suppose I could split the scripts in two parts (one to parse the arguments, one to include).

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [March 30, 2017, 7:43am UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873/4 "2017-03-30T07:43:57Z")

</div>

I am not sure how to handle command line arguments with `include`, but command line arguments get saved in a variable called `ARGS`, you could just set it yourself.

E.g. try running this from your shell:

```julia
julia -e "@show ARGS" input1 input2

```

you can set `ARGS` from inside julia simply by

```julia
ARGS = String["input1", "input2"]

```

---

<div class="post-metadata">

**Author:** ![Benoit9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benoit9/32/690_2.png) [@Benoit9](https://discourse.julialang.org/u/Benoit9)\
**Post date:** [March 30, 2017, 9:15am UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873/5 "2017-03-30T09:15:54Z")

</div>

Thank you.  
That does not solve my problem with running scripts with -i though.  
Should I open an issue on Github?

---

<div class="post-metadata">

**Author:** ![gdkrmr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdkrmr/32/2791_2.png) [@gdkrmr](https://discourse.julialang.org/u/gdkrmr)\
**Post date:** [March 30, 2017, 9:29am UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873/6 "2017-03-30T09:29:06Z")

</div>

no Idea what the intended behavior o the `-i` option is, someone else has to answer this.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [March 30, 2017, 6:48pm UTC](https://discourse.julialang.org/t/stay-in-i-repl-after-error/2873/7 "2017-03-30T18:48:15Z")

</div>

Exactly, you can just do

```julia
ARGS = split("hello world 3 4 5")
include("my_script_that_parses_ARGS.jl")

```

and it will behave as if you did

```julia
> julia my_script_that_parses_ARGS.jl hello world 3 4 5

```

from the command line.
