Skip to content

working with pyinstaller #78

@deli-c1ous

Description

@deli-c1ous

Steps to reproduce

test.py:

from py_mini_racer import MiniRacer
mr = MiniRacer()

run pyinstaller test.py then generated test.exe, it happens that:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
  File "py_mini_racer\_mini_racer.py", line 56, in __init__
  File "py_mini_racer\_dll.py", line 273, in init_mini_racer
  File "contextlib.py", line 137, in __enter__
  File "py_mini_racer\_dll.py", line 237, in _open_dll
  File "py_mini_racer\_dll.py", line 217, in _check_path
py_mini_racer._dll.LibNotFoundError: Native library or dependency not available at D:\test\dist\test\_internal\mini_racer.dll

Expected behavior

no error and no missing mini_racer.dll

Actual behavior

as above

System configuration

win11
PyMiniRacer version:
0.12.4
Python version:
python 3.12

Current solution

when i use --collect-binaries py_mini_racer with pyinstaller, there is a mini_racer.dll in .\dist\test\_internal\py_mini_racer, but py_mini_racer will find in .\dist\test\_internal and therefore miss it.
My current solution is using

--add-data D:\myfiles\softwares\miniconda\envs\tmp\Lib\site-packages\py_mini_racer\mini_racer.dll:.
--add-data D:\myfiles\softwares\miniconda\envs\tmp\Lib\site-packages\py_mini_racer\icudtl.dat:.
--add-data D:\myfiles\softwares\miniconda\envs\tmp\Lib\site-packages\py_mini_racer\snapshot_blob.bin:.

with pyinstaller and it will place these files under .\dist\test\_internal and everything will be ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions