AtuboDad / playwright_stealth

playwright stealth
MIT License
538 stars 71 forks source link

Not work with pyinstaller #9

Open yswtrue opened 3 years ago

yswtrue commented 3 years ago
PS D:\Code\texas_auto\dist> .\main.exe
Traceback (most recent call last):
  File "main.py", line 17, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "auto.py", line 17, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "playwright_stealth\__init__.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
  File "playwright_stealth\stealth.py", line 17, in <module>
  File "playwright_stealth\stealth.py", line 13, in from_file
  File "pkg_resources\__init__.py", line 1142, in resource_string
  File "pkg_resources\__init__.py", line 1388, in get_resource_string
  File "pkg_resources\__init__.py", line 1555, in _get
  File "PyInstaller\loader\pyimod03_importers.py", line 371, in get_data
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\yswtrue\\AppData\\Local\\Temp\\_MEI131882\\playwright_stealth\\js\\chrome.csi.js'
[3644] Failed to execute script 'main' due to unhandled exception!
yswtrue commented 3 years ago
pyinstaller --add-data ".venv/Lib/site-packages/playwright_stealth;./playwright_stealth/" -F main.py

This works for me