0

I am running this command on my terminal :

C:\Ad-Library-API-Script-Repository-main\python> py fb_ads_library_api_cli.py -t (token) -f "id,page_id,page_name,ad_creative_bodies,spend,demographic_distribution,bylines,ad_delivery_start_time" -c "CA" -s "climate" --after-date "2024年05月01日" save_to_csv file.csv

And I get the following error :

Traceback (most recent call last):
File "C:\Ad-Library-API-Script-Repository-main\python\fb_ads_library_api_cli.py", line 147, in
main()
File "C:\Ad-Library-API-Script-Repository-main\python\fb_ads_library_api_cli.py", line 134, in main
save_to_csv(
File "C:\Ad-Library-API-Script-Repository-main\python\fb_ads_library_api_operators.py", line 96, in save_to_csv
with open(output_file, "w") as csvfile:
^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied.

Does anyone have a solution ? i'm not sure I understand how the Permission system works in the Graph Api.

I have tried adding "encoding="utf-8" in the fb_ads_library_api_operators file to fix the encoding issue, but it didn't work (i am able to get one dataset then i get the same error all over again)

TylerH
21.3k85 gold badges84 silver badges122 bronze badges
asked May 30, 2024 at 9:30
3
  • 1
    Please include a minimal reproducible example. Is it trying to save file.csv to the same directory as your script? Do you have RW permissions on it? Commented May 30, 2024 at 9:42
  • "i'm not sure I understand how the Permission system works in the Graph Api." PermissionError: [Errno 13] Permission denied. has nothing to do with the Graph API, that is a python error relating to the file system operation it tries to perform on your system. Commented May 30, 2024 at 10:13
  • Yes it is trying to save file.csv to the same directory as the script. the script i'm using is a script i downloaded on my computer from here github.com/facebookresearch/… Commented May 31, 2024 at 10:21

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.