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

file is not closed #88

Open
fatihsirin opened this issue Jul 8, 2023 · 0 comments
Open

file is not closed #88

fatihsirin opened this issue Jul 8, 2023 · 0 comments

Comments

@fatihsirin
Copy link

fatihsirin commented Jul 8, 2023

hachoir/parser/guess.py

def createParser(filename, real_filename=None, tags=None):
    """
    Create a parser from a file or returns None on error.

    Options:
    - file (str|io.IOBase): Input file name or
        a byte io.IOBase stream  ;
    - real_filename (str): Real file name.
    """
    if not tags:
        tags = []
    stream = FileInputStream(filename, real_filename, tags=tags)
    guess = guessParser(stream)
    if guess is None:
        stream.close()
    return guess
You should return stream with guess. You should let us close stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant