Yes, the .pyd depends on a .DLL. And normally adding the parent folder to 
sys.path is all I need to do, but once it's run through pyInstaller, this 
no longer works. Perhaps the issue is that the .pyd is being included in my 
.exe when I don't actually want it to be? 

I may just stuff everything in the .exe anyway in the end if I can't figure 
this out. Thanks for getting back to me.

On Friday, 1 December 2023 at 12:14:33 UTC-5 Brenainn Woodsend wrote:

> Does this PYD file have dependencies – be them other PYDs, DLLs or Python 
> libraries? This should be as simple as adding the parent directory to 
> sys.path and running import sd so if there’s no dependencies at play 
> here, I’d be surprised if you hadn’t got that working. The fact that you’re 
> getting a DLL load failed error instead of a ModuleNotFoundError would 
> also imply that your PYD is findable but not loadable.
>
> I have tried manually setting the PATH and PYTHONPATH in the console and 
> even copying the .pyd file to be alongside the .exe itself, but nothing 
> works. Now the weird part. If I re-run the pyInstaller build with my 
> PYTHONPATH set to the location where my .pyd file resides, it creates an 
> executable that *does* work. So it appears that pyInstaller has its own 
> notion of a PYTHONPATH that can be augmented at build time but not runtime??
>
> This also suggests the same. I think PyInstaller sees that import sd, 
> includes the PYD then runs it through its binary dependency analysis where 
> it discovers whatever DLLs this PYD is linked against and collects them.
>
> P.S. That __get_run_path() path function is redundant. You should use 
> os.path.abspath(os.path.dirname(__file__)) unconditionally – adjusting 
> any --add-data arguments so that the files are put where the code now 
> expects them to be.
>

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/0da6dd27-4812-499b-a715-666a5f9d94ffn%40googlegroups.com.

Reply via email to