Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyinstaller support #29

Open
NBAFrigge opened this issue Dec 4, 2023 · 1 comment
Open

Pyinstaller support #29

NBAFrigge opened this issue Dec 4, 2023 · 1 comment

Comments

@NBAFrigge
Copy link

Using hrequersts, after creating an exe from my Python script, I get this error at the exe startup:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\frige\AppData\Local\Temp\_MEI441402\hrequests\bin\CR_VERSIONS.json'.

The script works fine.

import hrequests
session = hrequests.Session('chrome', version=103)
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0',
    'Accept': '*/*',
    'Accept-Language': 'it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3',
    'Referer': 'https://sell.wethenew.com/login',
    'content-type': 'application/json',
    'Alt-Used': 'sell.wethenew.com',
    'Connection': 'keep-alive',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'If-None-Match': 'W/17gujz3lxj828',
}

csrf = eval(session.get('https://sell.wethenew.com/api/auth/csrf', headers=headers, proxies=proxy).text)['csrfToken']

That is the command that auto-py-to-exe run:
pyinstaller --noconfirm --onefile --console --hidden-import "discord_webhook" "D:/Dev/Main.py"

Can anybody help me?

I tried to put the hrequest in the hidden-import while using auto-py-to-exe but nothing happened

@daijro daijro changed the title FileNotFoundError Pyinstaller support Feb 5, 2024
@kairon0x00
Copy link

kairon0x00 commented Feb 22, 2024

I face similar issue. Compiling with pyinstaller is working fine (I use hrequests without automated browsing support installed)
but when executing I get this error :

  Downloading hrequests-cgo library from daijro/hrequests...
Traceback (most recent call last):
  File "test.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "hrequests\__init__.py", line 30, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "hrequests\response.py", line 13, in <module>
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
  File "hrequests\cffi.py", line 199, in <module>
  File "hrequests\cffi.py", line 154, in __init__
  File "hrequests\cffi.py", line 132, in load_library
  File "hrequests\cffi.py", line 39, in __init__
  File "hrequests\cffi.py", line 67, in check_library
  File "hrequests\cffi.py", line 101, in download_library
  File "hrequests\cffi.py", line 106, in download_file
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User1\\AppData\\Local\\Temp\\_MEI68602\\hrequests\\bin\\hrequests-cgo-2.1-windows-4.0-amd64.dll'
[14612] Failed to execute script 'test' due to unhandled exception!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants