I had problems getting the file on the memory card, and I was hoping to solve this problem. I described the problem in detail and showed my code below.
What I import:
import os
import mmap
Now for the code:
file = r'otest'
if os.path.isfile(file):
os.remove(file)
f = open(file, 'wb')
print(os.getcwd())
This is where I ran into a problem with my code (I included both and commented each time every time I run the program):
mfile = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_WRITE)
I encounter an error with any of the mfile lines. To line mmap.mmapwith the argument 0I get this error: ValueError: cannot mmap an empty file. If I use an argument instead 10**7, I get this error:PermissionError: [WinError 5] Access is denied
And for this:
"""
Other stuff goes here
"""
f.close()
“Other stuff here” is simply the owner of the place where I am going to add more code.
, , , , , ftruncate os.truncate, , .