Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnknownFileExtensionError not properly raised upon loading a file with unsupported format #85

Closed
Northurland opened this issue Mar 12, 2024 · 1 comment
Assignees
Labels

Comments

@Northurland
Copy link
Contributor

As title.
Python version: 3.9
pysubs2 version: 1.6.1
Operating system: Windows 10

Description:
图片

Code above was ran in an attempt to open a file with extension .atpj (which is json-based subtitle project file for the subtitle tool ArcTime Pro; which has not an extension that is supported by pysubs2). Exception was raised at line 38 as expected, but it was a KeyError instead of UnknownFileExtensionError.

It seems that loading was done in an assumption that this json subtitle format would be similar to the type(s?) of json what the module is supposed to handle, henceforth directly loaded without looking at the extension name.

图片

tkarabela added a commit that referenced this issue May 4, 2024
@tkarabela tkarabela self-assigned this May 4, 2024
@tkarabela tkarabela added the bug label May 4, 2024
@tkarabela
Copy link
Owner

Fixed in version 1.7.0.

The exception raised in this case (unrecognized content when reading the file) is FormatAutodetectionError, not UnknownFileExtensionError (that happens when saving the file, eg. subs.save("foo.xyz") would raise UnknownFileExtensionError).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants