Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Using precompiled packages #475

Unanswered
Nesavi asked this question in Q&A
Jun 11, 2024 · 1 comments · 4 replies
Discussion options

Am I correct in assuming that precompiled packages can't be used when generating pyd-files? I've tried, and the script importing from my pyd-file fails.

You must be logged in to vote

Replies: 1 comment · 4 replies

Comment options

Not sure what you are trying to do. Could you give a detailed minimal example?

You must be logged in to vote
4 replies
@Nesavi
Comment options

Yes, I'd be happy to. Do you have a shared drive that I can upload a sample to?

@pyscripter
Comment options

You can upload files here. A zipped project would do.

@Nesavi
Comment options

Thanks for taking time to answer my question. It's much appreciated :)

The attached zip-file contains to project. The only difference between them, apart from their names, is that the project 'DelphiFromPython_DCP.dproj' has 'Link with runtime packages' set to true:
image

dcp_test.zip

Python 3.12.3 was used:

image

@pyscripter
Comment options

Firstly, you should not be using LoadDLL in your extension modules but LoadDllInExtensionModule. See https://github.com/pyscripter/python4delphi/blob/master/Modules/DemoModule/uMain.pas as a guide.

Regarding runtime packages, is the directory containing them in the path?
Even if it is there was a change in python when searching for dlls. The Windows path is no longer searched.
See
https://docs.python.org/3/library/os.html#os.add_dll_directory
and https://stackoverflow.com/questions/67805339/is-the-function-os-add-dll-directory-adding-directories-permanently.

You can try:

  • copying all runtime packages in the same directory as the pyd file.
  • or use the os.add_dll_directory function before importing the pyd extension module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.