# Enable code saving for certain projects

**URL:** <https://community.wandb.ai/t/enable-code-saving-for-certain-projects/4707>\
**Category:** W&B Help\
**Created:** [July 9, 2023, 3:05pm UTC](https://community.wandb.ai/t/enable-code-saving-for-certain-projects/4707 "2023-07-09T15:05:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![t-vi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/t-vi/32/130_2.png) [@t-vi](https://community.wandb.ai/u/t-vi)\
**Post date:** [July 9, 2023, 3:05pm UTC](https://community.wandb.ai/t/enable-code-saving-for-certain-projects/4707/1 "2023-07-09T15:05:31Z")

</div>

Hi,

I’m trying to figure out how code saving might work on a case-by-case basis for command-line runs (a plain .py file).  
When I enable the “Enable code saving in your personal account” in the settings, code shows up.  
When I disable it, I hoped that `wandb.init(save_code=True)` would do the same, but while the code shows up in the local wandb directory and it seems that the wanb interface knows about the file, it does not have it (see screenshot below).

The sync at the end is summarized as  
`Synced 5 W&B file(s), 0 media file(s), 0 artifact file(s) and 1 other file(s)`.

I’m sure I’m doing something wrong, but I could use a hint what it is.

Best regards

Thomas

![image](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/2X/e/ea24bf65e60224fec775463813aeaa02c0cf1b9d.png)

---

<div class="post-metadata">

**Author:** ![raphael-sanandres](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@raphael-sanandres](https://community.wandb.ai/u/raphael-sanandres)\
**Post date:** [July 10, 2023, 8:39pm UTC](https://community.wandb.ai/t/enable-code-saving-for-certain-projects/4707/2 "2023-07-10T20:39:07Z")

</div>

Hello @t-vi !

I was able to reproduce this issue on my end with `wandb` SDK version 0.15.5. Could you let me know your SDK version for me? I will be making a bug report on this behavior and knowing your SDK version is helpful to know when the issue started.

---

<div class="post-metadata">

**Author:** ![t-vi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/t-vi/32/130_2.png) [@t-vi](https://community.wandb.ai/u/t-vi)\
**Post date:** [July 10, 2023, 8:52pm UTC](https://community.wandb.ai/t/enable-code-saving-for-certain-projects/4707/3 "2023-07-10T20:52:22Z")

</div>

Hello @raphael-sanandres ,

thank you for your reply.  
When I hit this, I upgraded to 0.15.5, so this is one version I am seeing this with.

Best regards

Thomas

---

<div class="post-metadata">

**Author:** ![raphael-sanandres](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@raphael-sanandres](https://community.wandb.ai/u/raphael-sanandres)\
**Post date:** [July 12, 2023, 10:52pm UTC](https://community.wandb.ai/t/enable-code-saving-for-certain-projects/4707/4 "2023-07-12T22:52:25Z")

</div>

Just to let you know, you can avoid this bug by also defining the project in `wandb.init()`.  
For example:

```auto
wandb.init(project = <project> , save_code = True)

```

I still will be making a bug report but wanted to let you know of the workaround while it is being fixed.

---

<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:** [September 10, 2023, 10:53pm UTC](https://community.wandb.ai/t/enable-code-saving-for-certain-projects/4707/5 "2023-09-10T22:53:10Z")

</div>

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