I am learning python os
module and faced the issue with os.sendfile(...)
method. Here's my code
import os
f1 = os.open('f1.txt', os.O_RDONLY)
f2 = os.open('f2.txt', os.O_RDWR | os.O_CREAT)
os.sendfile(f2, f1, 0, 100) # <-- Raises OSError: [Errno 38] Socket operation on non-socket
os.close(f1)
os.close(f2)
Python version: 3.9.6 OS: macos monterey (12.6.1)
Here's the link with article that I am trying to follow: https://www.geeksforgeeks.org/python-os-sendfile-method/
What am I doing wrong?