aspiers / git-deps

git commit dependency analysis tool
GNU General Public License v2.0
299 stars 47 forks source link

Fix ValueError:can't have unbuffered text I/O (fixes #87) #93

Closed dwrobel closed 3 years ago

dwrobel commented 5 years ago

Fixes: Traceback (most recent call last): File "/usr/bin/git-deps", line 10, in sys.exit(run()) File "/usr/lib/python3.7/site-packages/git_deps/cli.py", line 146, in run main(sys.argv[1:]) File "/usr/lib/python3.7/site-packages/git_deps/cli.py", line 138, in main sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) File "/usr/lib64/python3.7/os.py", line 1026, in fdopen return io.open(fd, *args, **kwargs) ValueError: can't have unbuffered text I/O

aspiers commented 5 years ago

/cc @bmwiedemann

bmwiedemann commented 5 years ago

Why not use 1 instead?

https://docs.python.org/2/library/functions.html#open says

The optional buffering argument specifies the file’s desired buffer size:
0 means unbuffered,
1 means line buffered,
any other positive value means use a buffer of (approximately)
that size (in bytes). A negative buffering means to use the system default,
which is usually line buffered for tty devices and fully buffered for other files.
If omitted, the system default is used.

https://docs.python.org/3/library/functions.html#open is similar

dwrobel commented 5 years ago

Why not use 1 instead?

As per https://docs.python.org/3/library/functions.html#open 1 is the default one.

bmwiedemann commented 5 years ago

nay, it says buffering=-1

dwrobel commented 5 years ago

nay, it says buffering=-1

Indeed, I didn't spot - in front of 1.

catskul commented 4 years ago

Can confirm that this PR resolves https://github.com/aspiers/git-deps/issues/87 for me.

Tried to resolve the travis issues in a separate PR(https://github.com/aspiers/git-deps/pull/99), but it seems it needs someone who understands both Travis and TOX.

aspiers commented 3 years ago

Fixed by 1f6c7f8 instead.