Skip to content

translator.clean_cache() errors because services weren't instantiated #104

@PrajwalVandana

Description

@PrajwalVandana

Not sure if this package is being actively maintained, but I found an error where

translator = Translator()
translator.clean_cache()

errors with

TypeError: BaseTranslator.clean_cache() missing 1 required positional argument: 'self'

because translator's underlying services have not been instantiated. My workaround was

for i, service in enumerate(translator.services):
    translator._instantiate_translator(service, translator.services, i)
for service in translator.services:
    service.clean_cache()

but this still fails on Microsoft and Bing translators (although this part may be my fault, maybe it needs some sort of request argument that I didn't pass; not sure), so I just removed them from my services list.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions