facebook / facebook-python-business-sdk

Python SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
1.29k stars 635 forks source link

Errors when Installing SDK #513

Closed rfusunday closed 6 years ago

rfusunday commented 6 years ago

I'm a new python dev trying to use the Ads API for the first time. On installation I see errors such as...

Extracting facebook_business-3.1.2-py3.7.egg to /usr/local/lib/python3.7/site-packages File "/usr/local/lib/python3.7/site-packages/facebook_business-3.1.2-py3.7.egg/facebook_business/adobjects/abstractcrudobject.py", line 552 params=None, async=False, include_summary=True, ^ SyntaxError: invalid syntax

File "/usr/local/lib/python3.7/site-packages/facebook_business-3.1.2-py3.7.egg/facebook_business/adobjects/helpers/businessmixin.py", line 25 def get_insights(self, fields=None, params=None, async=False): ^ SyntaxError: invalid syntax

When I try to run the bootstrap test, I get error ...

File "/Users/rfu/PycharmProjects/FacebookAdManager/venv37/lib/python3.7/site-packages/facebook_business/adobjects/adaccountuser.py", line 22, in from facebook_business.adobjects.abstractcrudobject import AbstractCrudObject File "/Users/rfu/PycharmProjects/FacebookAdManager/venv37/lib/python3.7/site-packages/facebook_business/adobjects/abstractcrudobject.py", line 552 params=None, async=False, include_summary=True, ^ SyntaxError: invalid syntax

This happens when I'm trying to import any of the facebook_business.adobjects. I'm new, so sorry if I'm wasting your time, but what am I doing wrong?

brandonkane commented 6 years ago

@rfusunday - async is a keyword in Python 3.7. Facebook uses it as a variable or argument name in several places which is now invalid syntax. This repository is not compatible with Python 3.7. Suggest you downgrade to an older version of Python until Facebook catches up with the latest version.

They have made some changes to remove async, so make sure you are on the latest version of the SDK (3.1.2 as of this writing)

rfusunday commented 6 years ago

Thanks so much, Brandon.

jingping2015 commented 6 years ago

I think this already fix in our current version.