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

Missing type error for Python 3?

Open danragnar opened this issue 7 years ago • 0 comments

In python 3.6.2 when writing a string to a file directly like this: volume = gfapi.Volume('server', 'volume') volume.mount() with volume.fopen('testfile', 'w') as f: f.write("test write")

The resulting file gets weirdly cut like this: xxd testfile 00000000: 7400 0000 6500 0000 7300 00 t...e...s..

This works: with volume.fopen('testfile', 'w') as f: f.write(b'test write') xxd testfile 00000000: 7465 7374 2077 7269 7465 test write

Maybe the write function should throw a type error in Python 3 if the object is not a bytearray/byte?

danragnar avatar Oct 05 '18 12:10 danragnar