python / python/cpython

os.path.join does not work correctly

Open
#100,172 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
Avg merge
1d 9h
Merged PRs (30d)
558

Description

Bug report

This simple script gives as a result g:\\2020 and not as expected g:\\fotos\\2020. It seems that the '\\' in front of 2020 is interpreted as '..\\', because without it the output is as expected.

import os
os.path.join('g:\\fotos', '\\2020')

Your environment

Windows 10 64 bit
python 3.10.9 (and 3.7)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied os.path.join example on Windows 10 with Python 3.10 and 3.7. Start by checking the os.path.join documentation and the Windows path-handling implementation or tests; determine whether the result matches documented semantics. Done means confirming a defect with a focused regression test, or documenting why the reported result is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.