# Wandb does not log all .py files

**URL:** <https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602>\
**Category:** W&B Help\
**Tags:** artifacts, wandb\
**Created:** [December 26, 2022, 11:09am UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602 "2022-12-26T11:09:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![miladink](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/miladink/32/700_2.png) [@miladink](https://community.wandb.ai/u/miladink)\
**Post date:** [December 26, 2022, 11:09am UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602/1 "2022-12-26T11:09:24Z")

</div>

Hi all,

I’m having an issue with logging code using wandb.run.log\_code(“.”). While there are other .py files present in my directory, wandb only seems to log the script that called wandb.init(). This is frustrating, as I want to see all of the code that was used in my run. I’ve even tried stepping through with a debugger, and it looks like wandb is looping over those .py files, but for some reason they aren’t being logged on the run page in the code section.

Has anyone else experienced this issue, or have any suggestions for how to resolve it?

Thanks in advance for any help!

---

<div class="post-metadata">

**Author:** ![mohammadbakir](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mohammadbakir](https://community.wandb.ai/u/mohammadbakir)\
**Post date:** [December 28, 2022, 1:53am UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602/2 "2022-12-28T01:53:34Z")

</div>

Hi @miladink , happy to help. When calling `wandb.run.log_code(".")`, wandb will capture all python source code files in the current and all sub directories as an **artifact**. Are you indicating that the generated artifact is not saving all python files when called for the run? Could you please provide a link to your workspace where you are encountering this behavior. Thank you.

---

<div class="post-metadata">

**Author:** ![sydholl](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sydholl](https://community.wandb.ai/u/sydholl)\
**Post date:** [December 28, 2022, 1:53am UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602/3 "2022-12-28T01:53:43Z")

</div>

Hi @miladink , happy to help. When calling `wandb.run.log_code(".")`, wandb will capture all python source code files in the current and all sub directories as an **artifact**. Are you indicating that the generated artifact is not saving all python files for the run?

[Discourse post]

---

<div class="post-metadata">

**Author:** ![miladink](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/miladink/32/700_2.png) [@miladink](https://community.wandb.ai/u/miladink)\
**Post date:** [December 30, 2022, 11:33am UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602/4 "2022-12-30T11:33:34Z")

</div>

Hi @sydholl and @mohammadbakir . I don’t know where to look for an artifact. I look at the “files” tab of a run and I guess all the logged files are there. However, in the code/ section on the files tab, I just see one of my python files which is just the python file that called wandb. However, the other python files that are present in that same directory are not logged. I should note I call `wandb.run.log_code(".")` from that script. Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![mohammadbakir](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mohammadbakir](https://community.wandb.ai/u/mohammadbakir)\
**Post date:** [January 5, 2023, 10:07pm UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602/5 "2023-01-05T22:07:22Z")

</div>

Hi @miladink , apologies for the delay. To access the artifacts page, select the DB icon as in this example [here](https://docs.wandb.ai/ref/app/pages/project-page#artifacts-tab). Could you try the following:

`wandb.run.log_code(".", include_fn=lambda path: path.endswith(".py"))`.

If it doesn’t work, please provide:

- Screen shot of your working directory
- Link to your workspace
- Example code of how you are using [log\_code()](https://docs.wandb.ai/ref/python/run#log_code)

Thanks

---

<div class="post-metadata">

**Author:** ![mohammadbakir](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@mohammadbakir](https://community.wandb.ai/u/mohammadbakir)\
**Post date:** [January 11, 2023, 1:13am UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602/6 "2023-01-11T01:13:09Z")

</div>

Hi @miladink since we have not heard back from you we are going to close this request. If you would like to re-open the conversation, please let us know!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)\
**Post date:** [March 12, 2023, 1:13am UTC](https://community.wandb.ai/t/wandb-does-not-log-all-py-files/3602/7 "2023-03-12T01:13:48Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
