sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

`sublime.load_binary_resource` raises `FileNotFoundError` for a large file

Open jfcherng opened this issue 1 year ago • 2 comments

Description of the bug

As the title.

Steps to reproduce

  1. Let's create a 100MB file: Packages/out
$ dd if=/dev/zero of=out bs=104857600 count=1
  1. Reproduce the bug.
>>> sublime.find_resources('out')
['Packages/out']

>>> sublime.load_binary_resource(sublime.find_resources('out')[0])
Traceback (most recent call last):
  File "__main__", line 1, in <module>
  File "C:\Program Files\Sublime Text\Lib\python38\sublime.py", line 1211, in load_binary_resource
    raise FileNotFoundError(f'resource "{name}" not found')
FileNotFoundError: resource "Packages/out" not found

Expected behavior

Either raises something like FileTooLargeError or just load it anyway (It's plugin author's design decision. You know sometimes you just need to load a large file anyway.).

Actual behavior

It raises FileNotFoundError, which is confusing.

Sublime Text build number

4175

Operating system & version

Win10 22H2 10945.4529

jfcherng avatar Jul 04 '24 03:07 jfcherng

gentle bump, this is blocking for GitHub-Copilot LSP integration

kraktus avatar Oct 22 '25 22:10 kraktus

@kraktus As a small note, this has been resolved in ST 4201 (private beta).

jfcherng avatar Oct 28 '25 19:10 jfcherng