libnfs-python icon indicating copy to clipboard operation
libnfs-python copied to clipboard

Attribute Error

Open chuchaki opened this issue 4 years ago • 0 comments

Hello, im trying to achieve a rather simple procedure, where I copy a local image onto a nfs server. The server can be reached and I can create and modify files on it just as the readme indicates. However I'm not able to transfer a local file to the server using this library.

Target concept: targetFile = nfsHandle.open(path+"/"+filename, 'w') sourcefile = open(filename.jpg, 'r') shutil.copyfileobj( photo , targetFile )

If I use the approach above, I get an error message complaining: "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte". If I use 'wb' and 'rb'. it complains that 'byte' does not have the method 'encode'. I've tried to convert the image file handler into a bytearray, but it keeps getting back to the utf-8 message.

Either there is a bug, where the codec=none is always overwritten with utf-8, images are not supported (encoding/decoding an image with utf-8 seems kind of ... , or I have a deep misunderstanding of this issue.

Can someone have a look at this ?

Thanks & with best regards

chuchaki avatar Sep 10 '21 15:09 chuchaki