Error - can't download folder

Hi
i try to run report pdf on colab google it work fine get the form all tools from anvil
and make report in folder colab but when i try to so it with button clik inside anvil
i can,t get error can’t download file

i do it with example pdf table and chart but not working inside anvil but in google colab it’s fine and get report ( Reportfom) in side my folder
what’s can i do it
thanks

Hello! Please share your code and point out the line of the error and the error message.

2 Likes

this my code it’s work fine in jupyter google colab

def xx():
  this_month = pd.read_csv("this_month.csv")

  last_month = pd.read_csv("last_month.csv")

  combined = this_month.join(last_month.set_index("category"),

                           on="category", rsuffix="_last_month")

  print(combined)

  records = combined.to_dict('records')

  pdf = anvil.pdf.render_form("Shop_Template.TestF",records)

  anvil.media.write_to_file(pdf, "Your-Report.pdf")

  print(records)

  return pdf


but inside anvil get error like this


AnvilWrappedError: Internal server error: 3675fdbd886f at /downlink/anvil/pdf.py, line 17 
called from /downlink/anvil/pdf.py, line 26 
called from /usr/local/lib/python3.7/dist-packages/anvil/pdf.py, line 4 
called from <ipython-input-5-76a8f1b53b6b>, line 19 
called from [ServerModule3, line 52](javascript:void(0)) 
called from [Main, line 147](javascript:void(0))


code server like this

@anvil.server.callable
def createFile():
  anvil.server.call('xx')

the event click like this

 anvil.server.call('createFile')
    anvil.media.download(pdf)

in google colab work fine and create pdf file in the seam path
but when i try run it in anvil under button event click get this error

Hi
i will try to create pdf file in jupyter it’ work fine and created ( Bill ) but when i try read funcation from inside anvil get error

AnvilWrappedError: Internal server error: 40481286d52e
at /downlink/anvil/pdf.py, line 17
called from /downlink/anvil/pdf.py, line 26

my funcation is

@anvil.server.callable
def createFile():
 anvil.server.call('xx')

it’s call by button like this

  pdf=anvil.server.call('createFile')
    anvil.media.download(pdf)

whey this get Error
outside anvil work fine but in side not work
thanks