Embarcadero / Lightweight-Python-Wrappers

Lightweight Wrappers based on Python4Delphi to make it easy to import Python modules into Delphi components.
MIT License
31 stars 11 forks source link

ModuleNotFoundError :( #21

Closed kazuser closed 1 year ago

kazuser commented 1 year ago

I think I need your help again: I created a "Lingua" component based on https://pypi.org/project/lingua-language-detector/ — and it works fine (languages are detected correctly) but the very first launch always fails:

ModuleNotFoundError: No module named 'lingua-language-detector'

Lingua

How can it be fixed? 🥲

p.s. Lingua.zip Project1.zip p4d.zip

kazuser commented 1 year ago

Fix: image

lmbelo commented 1 year ago

Hmmm... I really think you didn't fix it right. You have tried to load a module that doesn't exist and then you only created a fake module using the TPythonModule component. You certainly will be caught by other erros while loading symbols from that module... I'd suggest you to re-check your Lingua version or else if you have defined the right module name.

lmbelo commented 1 year ago

That package itself is called lingua-language-detector on PyPI, but available as lingua to be imported. I presume you're not importing it using the right name. Try to import it as lingua where you're using lingua-language-detector.

Here's how you can import your package: https://github.com/Embarcadero/Lightweight-Python-Wrappers/blob/37035df09e5775ac107b3dbba6f52552d2281614/src/PyCommon.pas#L137

kazuser commented 1 year ago

Thanks a lot, lmbelo!

You're right, it works!

image

😊