merak icon indicating copy to clipboard operation
merak copied to clipboard

Cannot load the compiled "lib\\__init__.pyd" using "import <parentpackage>.lib"

Open Emmett-Brown82 opened this issue 2 years ago • 7 comments

Hello Dave!

Im a spanish developer who is using your tool to build a python library and it really works really well, congratulations! I have just one issue with it and i think it is related to the way the injected finder works.

As stated already in the title, i want to perform a loading of the library from another root package but somehow, it doesnt work. Check this out:

import lib --> works Ok!

import myparentpackage.lib --> doesn work and fails to load the library.

My library is fairly complex so maybe it has to do with the way i set the environment for compilation... But it looks more like an issue regarding the Importer not being able to process imports that start with anything else than the "lib\init.pyd".

My question/request is that, is there a way with the current tool version to do what i want?

Thanks in advance.

Emmett-Brown82 avatar Nov 17 '23 08:11 Emmett-Brown82

Could you provide an example code structure to illustrate your use case?

dave-msk avatar Nov 19 '23 16:11 dave-msk

Hi David, yes, i can. I know the compiling folder structure should be quite similar to how the library/package should be used once compiled.

[cid:b721bfab-002e-4079-93ed-31908401d4dc]

This is the command im using:

cd D:\SCAUTO\code set PYTHONPATH=%PYTHONPATH%;D:\SCAUTO\code; set PATH=%PATH%;D:\SCAUTO\code;

D:\pipeline\cmn\simple_pipeline_packer\python\python39\Scripts\merak.exe -d cythonize projectjcimporterparent\projectjcimporter2 projectjcimporter2-build -v -f

And this is how i want to use it:

[cid:1f6778f4-9c77-49e6-84e5-0b9bfb45a162] Where "\pipeline\cmn" is inserted into the sys.path and all the imports statements should start like "import simple_pipeline_lib.projectimporter2..."

[cid:befc4524-6a93-4d13-9973-dd093f95dc07]


De: (David) Siu-Kei Muk @.> Enviado: domingo, 19 de noviembre de 2023 17:37 Para: dave-msk/merak @.> Cc: Emmett-Brown82 @.>; Author @.> Asunto: Re: [dave-msk/merak] Cannot load the compiled "lib\init.pyd" using "import .lib" (Issue #14)

Could you provide an example code structure to illustrate your use case?

— Reply to this email directly, view it on GitHubhttps://github.com/dave-msk/merak/issues/14#issuecomment-1817907833, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZTEEBDK3HJNW2545JVPTHDYFIYT7AVCNFSM6AAAAAA7PNSYRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXHEYDOOBTGM. You are receiving this because you authored the thread.Message ID: @.***>

Emmett-Brown82 avatar Nov 20 '23 08:11 Emmett-Brown82

I'll try to reproduce your use case and get back to you. Please allow a few weeks as I've got my schedule filled up at the moment

dave-msk avatar Nov 22 '23 13:11 dave-msk

Could you provide some example code which I can use reproduce the error?

dave-msk avatar Nov 22 '23 13:11 dave-msk

Hi David, nevermind. I did some simple changes to your code and it works now. Just to be able to support an import statement of the type:

import <PARENTPKG>.<LIB>

Thanks for your time. Best Regards from Spain.


De: (David) Siu-Kei Muk @.> Enviado: miércoles, 22 de noviembre de 2023 14:26 Para: dave-msk/merak @.> Cc: Emmett-Brown82 @.>; Author @.> Asunto: Re: [dave-msk/merak] Cannot load the compiled "lib\init.pyd" using "import .lib" (Issue #14)

Could you provide some example code which I can use reproduce the error?

— Reply to this email directly, view it on GitHubhttps://github.com/dave-msk/merak/issues/14#issuecomment-1822768952, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZTEEBFKM3FG4D3YH3NCVU3YFX4OTAVCNFSM6AAAAAA7PNSYRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRSG43DQOJVGI. You are receiving this because you authored the thread.Message ID: @.***>

Emmett-Brown82 avatar Nov 24 '23 13:11 Emmett-Brown82

Great to hear that. If you're interested in contributing, please file a PR so that others could benefit from your work

dave-msk avatar Nov 24 '23 13:11 dave-msk

Hi, it is just a simple tweak, but if you find it useful or worth sharing go ahead. I ll text u back with it!

Regards.


De: (David) Siu-Kei Muk @.> Enviado: viernes, 24 de noviembre de 2023 14:06 Para: dave-msk/merak @.> Cc: Emmett-Brown82 @.>; Author @.> Asunto: Re: [dave-msk/merak] Cannot load the compiled "lib\init.pyd" using "import .lib" (Issue #14)

Great to hear that. If you're interested in contributing, please file a PR so that others could benefit from your work

— Reply to this email directly, view it on GitHubhttps://github.com/dave-msk/merak/issues/14#issuecomment-1825652558, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZTEEBCJZR6YT4JB7PFTHBDYGCLWZAVCNFSM6AAAAAA7PNSYRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRVGY2TENJVHA. You are receiving this because you authored the thread.Message ID: @.***>

Emmett-Brown82 avatar Nov 24 '23 13:11 Emmett-Brown82