0

I have a py file stored on amazon s3 bucket, which I read the content as bytes into python runtime(file is not download and saved locally).

This python file has a function. I would like to invoke the function of the py file which stored on amazon s3.

def generate(id:str):
   pass

Will appreciate tips and help.

Thanks

Madhuprathap
  • 213
  • 1
  • 3
  • 14
  • 1
    Instead of storing file directly, I would recommend you to serialize (pickle) your class/object and save the same in S3. You should then be able to read pickle file -> deserialize (unpickle) and call the required function. https://realpython.com/python-pickle-module/ – Hussain Bohra Jun 01 '22 at 17:32
  • I can't save the serialized. People can edit this file and reupload it. – Madhuprathap Jun 01 '22 at 17:42

1 Answers1

0

This question has been asked a few times. This might be what you're looking for Python import from byte IO (or more generally from an object in memory)