Back

Python

  • 0
  • Functions
muratdoglu
25 May, 2023, 14:50

hi, I used python to write function. I tested basic code, everything is okay. build completed. But, when I use 'from appwrite.client import Client' , I see Internal Runtime error. on Appwrite panel. What is the problem?

TL;DR
The user is having trouble using the 'appwrite' package in their Python project. When they try to import 'Client' from 'appwrite.client', they encounter an internal runtime error. They are asking for assistance with resolving this issue. Solution: It is recommended to check if the 'appwrite' package is added as a dependency to the function.
safwan
25 May, 2023, 17:08

could you share the code you're using in the function?

muratdoglu
25 May, 2023, 18:42

@safwan sure

muratdoglu
25 May, 2023, 18:42

import random from appwrite.client import Client

def main(req, res): payload = req.payload or 'No payload provided. Add custom data when executing function.'

TypeScript
secretKey = req.variables.get(
    'SECRET_KEY',
    'SECRET_KEY variable not found. You can set it in Function settings.'
)

randomNumber = random.random()
return res.json({
    'message': 'Hello from Appwrite!',
    'payload': payload,
    'secretKey': secretKey,
    'randomNumber': randomNumber
})
muratdoglu
25 May, 2023, 18:42

When I add 'from appwrite.client import Client', it will be problem

Drake
25 May, 2023, 20:32

did you add the appwrite package as a dependency to your function?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more