Skip to content

os.path.realpath fails with WinError 161 #88980

Closed
@Spacetown

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

    Spacetown

    Spacetown commented on Aug 3, 2021

    @Spacetown
    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.

    added
    3.9only security fixes
    3.10only security fixes
    3.11only security fixes
    type-bugAn unexpected behavior, bug, or error
    and removed on Aug 3, 2021

    20 remaining items

    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.10only security fixes3.11only security fixes3.12only security fixesOS-windowsstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        os.path.realpath fails with WinError 161 · Issue #88980 · python/cpython

        Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

        Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant