# Prints won't show up when debugging a function

**URL:** <https://discourse.julialang.org/t/prints-wont-show-up-when-debugging-a-function/27105>\
**Category:** New to Julia\
**Tags:** debug\
**Created:** [August 2, 2019, 9:37am UTC](https://discourse.julialang.org/t/prints-wont-show-up-when-debugging-a-function/27105 "2019-08-02T09:37:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrapo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrapo/32/3911_2.png) [@mrapo](https://discourse.julialang.org/u/mrapo)\
**Post date:** [August 2, 2019, 9:37am UTC](https://discourse.julialang.org/t/prints-wont-show-up-when-debugging-a-function/27105/1 "2019-08-02T09:37:32Z")

</div>

I’m debugging some issues in a Julia repository and at the moment I’m trying to track where in the code the issue is located. The repository contains one main module that uses several sub-modules. I have forked the repository to my GitHub page and I’m doing changes to the code on my (Mac) computer.

Now my problem is that when I try to edit some info text inside a certain function or add prints to it to find out which line of the function causes the error, the changes in info text or prints won’t show up when I run my tests.

This happens only when I change info text or add prints into functions that are located in the main module. Changes made in sub-module functions do show up.

To be clear, I do see the changes in the code and I’m certain that I have saved the changes. But when I use the function, the info text remains the original and prints won’t show up. I have restarted Julia and my computer several times. Also I’m sure there are no other functions with the same name I could mistake the problematic function with.

So the question is, that can there be some limitations in doing changes to a main module? Or could there be some other reason for this strange issue?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 2, 2019, 10:16am UTC](https://discourse.julialang.org/t/prints-wont-show-up-when-debugging-a-function/27105/2 "2019-08-02T10:16:31Z")

</div>

Did you use `add` or `dev` in Pkg on your repository? Could you show the output of `Pkg.status()`? If you used `add` you need to commit and `up` in Pkg to see the changes. If you use `dev` you should see the changes straight away.

---

<div class="post-metadata">

**Author:** ![mrapo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrapo/32/3911_2.png) [@mrapo](https://discourse.julialang.org/u/mrapo)\
**Post date:** [August 2, 2019, 10:26am UTC](https://discourse.julialang.org/t/prints-wont-show-up-when-debugging-a-function/27105/3 "2019-08-02T10:26:19Z")

</div>

Thanks @kristoffer.carlsson for the reply. I get the following output:

```julia
julia> Pkg.status()
    Status `~/.julia/environments/v1.0/Project.toml`
  [c52e3926] Atom v0.8.8
  [be8e8821] FEMQuad v0.3.0
  [f80590ac] JuliaFEM v0.5.0+ [`~/.julia/dev/JuliaFEM`]
  [e5e0dc1b] Juno v0.7.0
  [37e2e46d] LinearAlgebra 

```

The package I’m interested in is JuliaFEM. And I used Pkg.clone() when I cloned the forked repository to my computer.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 2, 2019, 11:42am UTC](https://discourse.julialang.org/t/prints-wont-show-up-when-debugging-a-function/27105/4 "2019-08-02T11:42:08Z")

</div>

Yeah, that looks good.

Are you sure you are editing the correct files? Perhaps you can show a `git diff` of you changes and someone else can try the same changes and see if it updates for us.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [August 2, 2019, 11:46am UTC](https://discourse.julialang.org/t/prints-wont-show-up-when-debugging-a-function/27105/5 "2019-08-02T11:46:05Z")

</div>

As an aside, I recently asked a question about using prints for debugging, similar to Python **debug**

The answer was to look at  
[https://docs.julialang.org/en/v1.1/stdlib/Logging/#Environment-variables-1](https://docs.julialang.org/en/v1.1/stdlib/Logging/#Environment-variables-1)

and

> [@@assert alternatives?](https://discourse.julialang.org/t/assert-alternatives/24775/8):
>
> +1 for outside-the-box we want the assertion macro to be able to dissolve in a released version we do not want to force the package user to start with --check-bounds=no reversing the sense of your macro forces bounds checking off when assertions are active, and that is imperfect for development fwiw years ago I found a way that worked – would be worth more with sourcetext, and maybe it worked by using aspects of very early Julia that no longer hold.

> [@Equivalent of Python if \_\_debug\_\_](https://discourse.julialang.org/t/equivalent-of-python-if-debug/25715):
>
> In Python there is a feature for simple print style debugging to be switched on or off. If you run a Python script with the -O option then if \_\_debug\_\_: print variable, variable, variable Is there an equivalent in Julia? I know you could set a constant to be true or false, bt that involves editing the code to switch on/off the debug lines.
