python - How to re-instatiate stavfs output -


why last statement fails?

>>> import posix >>> os.statvfs('/boot') posix.statvfs_result(f_bsize=1024, f_frsize=1024, f_blocks=495844l, f_bfree=412223l, f_bavail=386623l, f_files=128016l, f_ffree=127969l, f_favail=127969l, f_flag=4096, f_namemax=255) >>> posix.statvfs_result(f_bsize=1024, f_frsize=1024, f_blocks=495844l, f_bfree=412223l, f_bavail=386623l, f_files=128016l, f_ffree=127969l, f_favail=127969l, f_flag=4096, f_namemax=255) traceback (most recent call last):   file "<stdin>", line 1, in <module> typeerror: structseq() takes @ 2 arguments (10 given) 

the "system" asks explain why problem different potential duplicate. not problem different, it's find providing direct solution here better pragmatic reasons: answer other question doesn't establish happening and, in doing so, keeps scope of answer narrow , more difficult generalize.

thanks duplicate suggestion able transpose solution problem.

changing

posix.statvfs_result(f_bsize=1024, f_frsize=1024, f_blocks=495844l, f_bfree=412223l, f_bavail=386623l, f_files=128016l, f_ffree=127969l, f_favail=127969l, f_flag=4096, f_namemax=255) 

to

posix.statvfs_result((1024, 1024, 495844l, 412223l, 386623l, 128016l, 127969l, 127969l, 4096, 255)) 

solves problem:

>>> posix.statvfs_result((1024, 1024, 495844l, 412223l, 386623l, 128016l, 127969l, 127969l, 4096, 255)) posix.statvfs_result(f_bsize=1024, f_frsize=1024, f_blocks=495844l, f_bfree=412223l, f_bavail=386623l, f_files=128016l, f_ffree=127969l, f_favail=127969l, f_flag=4096, f_namemax=255) 

so make more complete , convenient, here how converting tuple allows recreating results of os.statvfs:

>>> tuple(os.statvfs('/boot')) (1024, 1024, 495844l, 412223l, 386623l, 128016l, 127969l, 127969l, 4096, 255) >>> posix.statvfs_result(tuple(os.statvfs('/boot'))) posix.statvfs_result(f_bsize=1024, f_frsize=1024, f_blocks=495844l, f_bfree=412223l, f_bavail=386623l, f_files=128016l, f_ffree=127969l, f_favail=127969l, f_flag=4096, f_namemax=255) 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -