python - Why does os.path.getsize() return a negative number for a 10gb file? -


i using function os.path.getsize() gives size of file in bytes.

as 1 file size 10gb give me size in negative(bytes).

so can give me idea why happen?

this code:

import os ospathsize = os.path.getsize('/home/user/desktop/test1.nrg') print (ospathsize)  

your linux kernel has large file support, since ls -l works correctly. thus, it's python installation lacking support. (are using distribution's python package? distribution it?)

the documentation on posix large file support in python states python should typically make use of large file support if available on linux. suggests try , configure python command line

cflags='-d_largefile64_source -d_file_offset_bits=64' opt="-g -o2 $cflags" \     ./configure 

and finally, quoting man page of stat system call:

this can occur when application compiled on 32-bit platform without -d_file_offset_bits=64 calls stat() on file size exceeds (1<<31)-1 bits.

(i believe last word should "bytes".)


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -