Skip to content

Paths under %appdata% are written to the local cache instead #122057

Closed as not planned
@Bip901

Description

@Bip901

Bug report

Bug description:

All paths under C:\Users\username\AppData\REST-OF-THE-PATH are actually treated as C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\REST-OF-THE-PATH.

This happens regardless of working in a venv or not, and regardless of the library call you're using (i.e. pathlib and open behave the same)

with open(R"C:\Users\your-username\AppData\Test.txt", "w") as f:
  f.write("Test")

Expected Result

A file with the text "Test" is created under C:\Users\your-username\AppData\Test.txt

Actual Result

The file is created under C:\Users\your-username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\Test.txt

Additional Information

  • I'm using Python 3.12 installed from the Microsoft Store
  • Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32
  • This issue was first reported at least a year ago in this Stack Overflow post

CPython versions tested on:

3.12

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesOS-windowstype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions