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
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Madhuprathap
  • 209
  • 1
  • 3
  • 15
  • 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
  • Does this answer your question? [Python import from byte IO (or more generally from an object in memory)](https://stackoverflow.com/questions/61175428/python-import-from-byte-io-or-more-generally-from-an-object-in-memory) – Mark Rotteveel Jun 10 '22 at 08:59

0 Answers0