Skip to content

AttributeError: 'tqdm' object has no attribute 'fp' #383

@fvisin

Description

@fvisin

I am using my own stream handler as suggested in [1] to use tqdm with a logger.

class TqdmHandler(logging.StreamHandler):
    def __init__(self):
        logging.StreamHandler.__init__(self)

    def emit(self, record):
        msg = self.format(record)
        tqdm.write(msg)

The code crashes in some cases with "AttributeError: 'tqdm' object has no attribute ' when the tqdm.write(msg) command is issued. The culprit of the error is here: one of the elements in _instances has no attribute fp.

From what I can tell an instance object with no fp attribute is created by the __new__ method. Could it be the problem?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions