Fix some Python warnings #221

wants to merge 5 commits into


None yet
2 participants

vadmium commented Nov 16, 2013

These changes fix two DeprecationWarning warnings in Python 2 and some warnings about unclosed files in Python 3. Also included is a quick documentation addition, since it wasn’t obvious how to include the “--player-no-close” option in the config file.

Martin Panter added some commits Nov 15, 2013

Martin Panter
Stop hash() from working in Python 2, to match Python 3 behaviour
This avoids DeprecationWarning warnings when running with “python2 -3”.

Martin Panter
Close new pipe to background process immediately
Otherwise it would be left open for at least the lifetime of the process
object, and garbage collection would trigger a ResourceWarning.

Also rename the “stdin” variables to be less confusing.
Martin Panter
Close the player’s redirected input and output streams
This avoids ResourceWarning warnings in Python 3.

Also, close the input to the player process before killing it. Some players
will then terminate of their own accord, including MPV, M Player, and VLC
with “vlc://quit” at the end of its playlist.

This also disables buffering of the input pipe in all Python versions. Recent
versions of Python 3 would otherwise enable buffering by default, and this
causes trouble when closing the input pipe and the pipe is broken.

chrippa added a commit that referenced this pull request Nov 16, 2013

Merge pull request #221 from vadium/master
* vadmium-master:
  cli: Close the player’s redirected input and output streams.
  stream.streamprocess: Close the error output stream once it has been passed to the subprocess.
  packages.pbs: Close new pipe to background process immediately.
  docs: Document how to configure options that don’t take an argument.
  packages.pbs: Stop hash() from working in Python 2, to match Python 3 behaviour.

This comment has been minimized.

Show comment
Hide comment

chrippa Nov 16, 2013


Nice fixes, thanks.


chrippa commented Nov 16, 2013

Nice fixes, thanks.

@chrippa chrippa closed this Nov 16, 2013

javiercantero pushed a commit to javiercantero/livestreamer that referenced this pull request Jan 7, 2017

Added support. (#221)
* Added support.
Credit to skulblakka for original implementation in livestreamer.

* Changed string chops to regexes.

* Added to URL detection regex.

* Cleaned up regex to have fewer unnecessary groups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment