AtuboDad / playwright_stealth

playwright stealth
MIT License
546 stars 72 forks source link

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\2\\_MEI98802\\playwright_stealth\\js\\chrome.csi.js' #7

Closed s13rw81 closed 1 year ago

s13rw81 commented 3 years ago

Greetings,

I am trying to create a tool based on this repo https://github.com/itsjafer/schwab-api and when i try to create an exe using pyinstaller -F --add-binary credentials;. gui.pyw for it the exe is generated just fine but when i run it i get this error.

Traceback (most recent call last):
  File "gui.pyw", 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 "schwab.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\__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\\ADMINI~1\\AppData\\Local\\Temp\\2\\_MEI98802\\playwright_stealth\\js\\chrome.csi.js'

could you kindly help me understand this error so that i can generate an exe for my code.

lichuhui commented 2 years ago

Add playwright_stealth/js by --add-data when using Pyinstaller.

pyinstaller -F -n AppName --add-data="favicon.ico;." --add-data="../pypackages/3.10/lib/playwright_stealth/js;./playwright_stealth/js" --nowindow --disable-windowed-traceback --icon=favicon.ico main.py

lichuhui commented 2 years ago

Greetings,

I am trying to create a tool based on this repo https://github.com/itsjafer/schwab-api and when i try to create an exe using pyinstaller -F --add-binary credentials;. gui.pyw for it the exe is generated just fine but when i run it i get this error.

Traceback (most recent call last):
  File "gui.pyw", 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 "schwab.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\__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\\ADMINI~1\\AppData\\Local\\Temp\\2\\_MEI98802\\playwright_stealth\\js\\chrome.csi.js'

could you kindly help me understand this error so that i can generate an exe for my code.

Add playwright_stealth/js by --add-data when using Pyinstaller.

pyinstaller -F -n AppName --add-data="favicon.ico;." --add-data="../pypackages/3.10/lib/playwright_stealth/js;./playwright_stealth/js" --nowindow --disable-windowed-traceback --icon=favicon.ico main.py