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

permission denied #843

Closed
xzripper opened this issue Aug 25, 2023 · 4 comments
Closed

permission denied #843

xzripper opened this issue Aug 25, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@xzripper
Copy link

Bug description
I'm running basic G4F code from README:

import g4f


response = g4f.ChatCompletion.create(
    model=g4f.models.gpt_4,
    messages=[{"role": "user", "content": "hi"}],
)  # alterative model setting

print(response)

Error:

Traceback (most recent call last):
  File "C:\Users\IonE\Desktop\main.py", line 3, in <module>
    import g4f
  File "D:\Program Files\Python399\lib\site-packages\g4f\__init__.py", line 1, in <module>
    from . import models
  File "D:\Program Files\Python399\lib\site-packages\g4f\models.py", line 3, in <module>
    from .Provider import Bard, BaseProvider, GetGpt, H2o, Liaobots, Vercel, Equing
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\__init__.py", line 6, in <module>
    from .Bard import Bard
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\Bard.py", line 11, in <module>
    class Bard(AsyncProvider):
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\Bard.py", line 22, in Bard
    cookies: dict = get_cookies(".google.com"),
  File "D:\Program Files\Python399\lib\site-packages\g4f\Provider\base_provider.py", line 45, in get_cookies
    for cookie in browser_cookie3.load(cookie_domain):
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 1233, in load
    for cookie in cookie_fn(domain_name=domain_name):
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 1160, in chrome
    return Chrome(cookie_file, domain_name, key_file).load()
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 489, in load
    with _DatabaseConnetion(self.cookie_file) as con:
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 349, in __enter__
    return self.get_connection()
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 383, in get_connection
    con = method()
  File "D:\Program Files\Python399\lib\site-packages\browser_cookie3\__init__.py", line 374, in __get_connection_legacy
    shutil.copyfile(self.__database_file, self.__temp_cookie_file)
  File "D:\Program Files\Python399\lib\shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\IonE\\AppData\\Roaming\\..\\Local\\Google\\Chrome\\User Data\\Default\\Network\\Cookies'

Environement

  • python 3.9.9
  • ukraine
@xzripper xzripper added the bug Something isn't working label Aug 25, 2023
@bagusindrayana
Copy link
Contributor

same here, problem related to browser_cookie3 in get_cookies function d765551
get_cookies function always called even not use Bard provider

check this issue from official browser_cookie3 repo : borisbabic/browser_cookie3#180

@saulojoab
Copy link

Hey! I was getting the same error on my M1 Macbook Pro, solved it by giving full disk access permission to Terminal and VSCode.

Not sure how to fix on Windows, tho.

@hlohaus
Copy link
Collaborator

hlohaus commented Aug 26, 2023

Oh, i created a hotfix to remove get_cookies from global:
#847

With this fix, you can pass cookies manually to the provider. Then browser_cookie3 will not used.

@xzripper You can try use the gpt4free with administration rights. Then they will maybe not a Permission denied.

@xzripper
Copy link
Author

Using @hlohaus hotfix removed the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants