expected str, bytes or os.PathLike object, not InMemoryUploadedFile
The error is happening because the function handle_uploaded_file(f)
is trying to open an already opened file.
The value of request.FILES['file']
is a InMemoryUploadedFile
and can be used like a normal file. You don't need to open it again.
To fix, just remove the line that tries to open the file:
def handle_uploaded_file(f):
for x in f:
if x.startswith('newick;'):
print('')
return cutFile(x)