{"record":{"id":"aef74bd9a4fa296a","repo":"ytdl-org/youtube-dl","slug":"s-said-s","errorCode":null,"errorMessage":"%s said: %s","messagePattern":"%s said: %s","errorType":"exception","errorClass":"ExtractorError","httpStatus":null,"severity":"warning","filePath":"youtube_dl/extractor/abc.py","lineNumber":73,"sourceCode":"            'title': 'NAB lifts interest rates, following Westpac and CBA',\n            'description': 'md5:f13d8edc81e462fce4a0437c7dc04728',\n        },\n    }, {\n        'url': 'http://www.abc.net.au/news/2015-10-19/6866214',\n        'only_matching': True,\n    }]\n\n    def _real_extract(self, url):\n        video_id = self._match_id(url)\n        webpage = self._download_webpage(url, video_id)\n\n        mobj = re.search(\n            r'inline(?P<type>Video|Audio|YouTube)Data\\.push\\((?P<json_data>[^)]+)\\);',\n            webpage)\n        if mobj is None:\n            expired = self._html_search_regex(r'(?s)class=\"expired-(?:video|audio)\".+?<span>(.+?)</span>', webpage, 'expired', None)\n            if expired:\n                raise ExtractorError('%s said: %s' % (self.IE_NAME, expired), expected=True)\n            raise ExtractorError('Unable to extract video urls')\n\n        urls_info = self._parse_json(\n            mobj.group('json_data'), video_id, transform_source=js_to_json)\n\n        if not isinstance(urls_info, list):\n            urls_info = [urls_info]\n\n        if mobj.group('type') == 'YouTube':\n            return self.playlist_result([\n                self.url_result(url_info['url']) for url_info in urls_info])\n\n        formats = [{\n            'url': url_info['url'],\n            'vcodec': url_info.get('codec') if mobj.group('type') == 'Video' else 'none',\n            'width': int_or_none(url_info.get('width')),\n            'height': int_or_none(url_info.get('height')),\n            'tbr': int_or_none(url_info.get('bitrate')),","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/extractor/abc.py#L55-L91","documentation":"Raised by the fallback _lock_file stub selected when the platform has neither the Windows msvcrt path nor the fcntl module (the ImportError branch). On such platforms, acquiring a locked_file raises IOError with the constant UNSUPPORTED_MSG. It is an explicit capability declaration, not a runtime failure of a working feature — youtube-dl refuses to pretend to lock where the OS offers no locking primitive.","triggerScenarios":"Running youtube-dl (or embedding its locked_file/utils) on a Python runtime without fcntl: Jython, some embedded/thin Python builds, IronPython, or restricted sandbox environments where the module is missing. Opening any locked_file (used for output .part coordination and cache writes) triggers it.","commonSituations":"Embedding youtube_dl.utils in a non-CPython runtime; minimal Docker images with stripped Python; ancient/odd platforms. Rare on standard CPython Linux/macOS/Windows, which all take the fcntl or msvcrt branches.","solutions":["Run on a standard CPython build (Linux/macOS/Windows) where fcntl or msvcrt exists.","If your runtime genuinely lacks locking, avoid code paths that use locked_file (e.g. provide --no-cache-dir and a single-process setup), or monkeypatch youtube_dl.utils._lock_file/_unlock_file to no-ops accepting the concurrency risk.","For Jython specifically, prefer invoking the youtube-dl CLI under CPython rather than importing the module.","Check for the condition up front: import fcntl fails → expect locking to be unavailable."],"exampleFix":"# before\nwith locked_file(cache_path, 'w') as f:  # IOError on Jython/no-fcntl\n    f.write(data)\n\n# after\ntry:\n    import fcntl\n    have_locks = True\nexcept ImportError:\n    have_locks = False\n\nif have_locks:\n    with locked_file(cache_path, 'w') as f:\n        f.write(data)\nelse:\n    with open(cache_path, 'w') as f:  # single-process fallback\n        f.write(data)","handlingStrategy":"validation","validationCode":"def file_locking_supported():\n    if sys.platform == 'win32':\n        return True  # msvcrt path\n    try:\n        import fcntl  # noqa: F401\n        return True\n    except ImportError:\n        return False\n\nif not file_locking_supported():\n    # avoid locked_file, or run under CPython on a supported platform","typeGuard":null,"tryCatchPattern":"try:\n    with locked_file(path, 'w') as f:\n        f.write(data)\nexcept IOError as e:\n    if 'file locking is not supported' in str(e):\n        with open(path, 'w') as f:  # single-process fallback without locking\n            f.write(data)\n    else:\n        raise","preventionTips":["Detect locking support once at startup (import fcntl probe) and choose the code path.","On exotic runtimes (Jython, IronPython), run the youtube-dl CLI under CPython as a subprocess instead of importing it.","If you must patch, no-op both _lock_file and _unlock_file symmetrically."],"tags":["platform-support","file-locking","compatibility","jython"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}