Error when importing from facebook_business

Good day everyone,

I’m getting the following >_Output message…

SyntaxError: invalid syntax (abstractcrudobject.py, line 552)
at /usr/local/lib/python3.7/site- 
packages/facebook_business/adobjects/abstractcrudobject.py, line 552
called from Home, line 16

when I include the following statement in a Server Module using “Full Python 3 (3.7)”:

from facebook_business.adobjects.adaccount import AdAccount

I’m not calling anything in particular from the “Home” form that refers to the python package nor I have any other code using it yet on the server module, the mere act of importing it on a Server Module and running the application produces that output.

Maybe I missed something and I’m not properly importing it but there is very little I can debug on my end with the output referring to a server side directory.

Thank you.

Hi Marcos,

That does seem odd - we install those packages with pip, and that should just work, so my first guess is a corrupt download. I’ve rebuilt the server side environment - is it working now? If not, we shall spelunk deeper…

More weirdness to follow up. I did this after your reply, @meredydd

  1. I tried again, without changing anything, to see if what you did server side had any effect, but I kept seeing the error.

  2. Next, I created a new app in Anvil just to test if by simply adding a server module with the import statements made it break. It didn’t complain or throw out the error.

  3. So then went back to my app that has the problem, and commented out line 16 of the Home form as pointed out in the error. It’s a simple statement that gets data to a repeating panel:

        self.clients_rp.items = anvil.server.call('get_dashboard_data')
    

To my surprise, the app doesn’t throw the error.

That statement only calls a server module function defined as such:

@anvil.server.callable
 def get_dashboard_data():
     return app_tables.clients.search()

That server module where the function is defined doesn’t import anything from Facebook Business. The Facebook Business import occurs in a different server module.

Obviously, I don’t want to remove that statement, as I want to populate the repeating panel with my table. I’m left with more confusion.

I don’t see why these 2 things are related or why having a call server callable on my Home form that populates a repeating panel would break a python package import (or vice versa).

Hi Marcos,

The issue was that the version of facebook_business we had installed did not support Python 3.7. (It used async as a variable name!)

We have now installed an up-to-date version of facebook_business, which should now work fine.

Hi @meredydd, I can confirm that I no longer get the error. Thanks for your help.