-
-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Labels
Description
Hi,
May I ask your kind help on a dummie question, I am strugling with in related to MemoryFs ?
I need to pass a screenshot image to telegram chat, and its only accept file path or url for the image:
photo_file_fullpath = "" # variable to store the image full path
bot.sendPhoto (<id>, photo = open (photo_file_fullpath, 'rb')
Its working perfectly when i save the image file on local files system, but I would like to avoid that, so I though I use MemoryFS as "memory filesystem" and access the file form there. To keep it simple, I do the following:
from fs.memoryfs import MemoryFS
import pyautogui
screenshot_image = pyautogui.screenshot ()
mem_fs = MemoryFS()
storage = mem_fs.open ("test_image.png", 'wb')
screenshot_image.save (storage)
storage.close ()
.... need to acccess the saved image with by memoryfs file path ....
mem_fs.close()
Could you help me please how can I get the file path of the image file stored in memoryfs as string on windows to be able to pass it to photo_file_fullpath variable and tehrefore sendPhoto could acces it (so it'll behave as a normal file) ?
Many thanks for your time and help!
Reactions are currently unavailable