Skip to content

os.path.realpath fails with WinError 161 #88980

Closed

Description

@Spacetown
mannequin
BPO 44817
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba, @Spacetown
PRs
  • bpo-44817: Ignore WinError 161 (ERROR_BAD_PATHNAME) #27574
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-08-03.05:24:11.950>
    labels = ['type-bug', '3.9', '3.10', '3.11', 'library', 'OS-windows']
    title = 'os.path.realpath fails with WinError 161'
    updated_at = <Date 2021-08-05.07:29:35.809>
    user = 'https://github.com/Spacetown'

    bugs.python.org fields:

    activity = <Date 2021-08-05.07:29:35.809>
    actor = 'Spacetown'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'Windows']
    creation = <Date 2021-08-03.05:24:11.950>
    creator = 'Spacetown'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44817
    keywords = ['patch']
    message_count = 5.0
    messages = ['398814', '398835', '398931', '398956', '398972']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'eryksun', 'steve.dower', 'Spacetown']
    pr_nums = ['27574']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44817'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. Spacetown commented on Aug 3, 2021

      Spacetownmannequin
      MannequinAuthor

      Using os.path.realpath(...) in the MVFS of Clearcase SCM (virtual file system) in Windows 10 a exception occures:

      X:\my_view\tools\python\3_8>python.exe
      Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import os
      >>> os.path.realpath('.')
      Traceback (most recent call last):
        File "X:\my_view\tools\python\3_8\lib\ntpath.py", line 647, in realpath
          path = _getfinalpathname(path)
      OSError: [WinError 87] Falscher Parameter: 'X:\\my_view\\tools\\python\\3_8\\.'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "X:\my_view\tools\python\3_8\lib\ntpath.py", line 651, in realpath
          path = _getfinalpathname_nonstrict(path)
        File "X:\my_view\tools\python\3_8\lib\ntpath.py", line 601, in _getfinalpathname_nonstrict
          path = _getfinalpathname(path)
      FileNotFoundError: [WinError 161] Der angegebene Pfadname ist ungültig: 'X:\\'
      >>> 

      The error 161 (ERROR_BAD_PATHNAME) should also be ignored in _getfinalpathname_nonstrict.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Aug 3, 2021
    3. added
      3.11only security fixes
      type-bugAn unexpected behavior, bug, or error
      and removed on Aug 3, 2021
    4. 5 remaining items

    5. Spacetown commented on Aug 5, 2021

      Spacetownmannequin
      MannequinAuthor

      Done.

    6. transferred this issue fromon Apr 10, 2022
    7. added
      3.13only security fixes
      3.14bugs and security fixes
      3.15bugs and security fixes
      and removed
      3.11only security fixes
      on May 19, 2025
    8. added
      3.11only security fixes
      3.12only security fixes
      and removed
      3.13only security fixes
      3.14bugs and security fixes
      3.15bugs and security fixes
      on May 19, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of life3.11only security fixes3.12only security fixesOS-windowsstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions