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

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

Open
PrajwalVandana opened this issue Aug 3, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@PrajwalVandana
Copy link

PrajwalVandana commented Aug 3, 2024

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.

@Animenosekai
Copy link
Owner

Not sure if this package is being actively maintained

Yup it is, not super actively because I have a million things on my backlog now lmaooo

Screenshot 2024-08-04 at 12 48 53

(couldn't fit everything in here but translatepy is the highest in my priority)

because translator's underlying services have not been instantiated

What version are you on ?

The development version (v3, on the next branch) does not have this issue :

Screenshot 2024-08-04 at 12 55 44

@Animenosekai Animenosekai self-assigned this Aug 4, 2024
@Animenosekai Animenosekai added the bug Something isn't working label Aug 4, 2024
@PrajwalVandana
Copy link
Author

not super actively because I have a million things on my backlog now lmaooo

Ahhh, got it, totally fair

I'm on 2.3 (latest release I think); is v3 installable with pip?

@Animenosekai
Copy link
Owner

I'm on 2.3 (latest release I think); is v3 installable with pip?

Yup, you can install it like so :

pip install --upgrade git+https://github.com/Animenosekai/translate.git@next

@PrajwalVandana
Copy link
Author

ah cool, would it be safe to make that a dependency for my app?

@Animenosekai
Copy link
Owner

If you want to publish your app, nope it's not since it's in an alpha state and the API might change a bit.

Also, it hasn't been well tested yet so consider it as a developer beta.

@PrajwalVandana
Copy link
Author

got it, i'll stick with 2.3 for now then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants