Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-22 Thread Chris Warrick
On 22 September 2017 at 03:57, Evuraan wrote: result = subprocess.run(["tail", "-400", "/tmp/pmaster.txt"], stdout=subprocess.PIPE) result.returncode > 0 subprocess.getstatusoutput("file /tmp/pmaster.txt",) > (0, '/tmp/pmaster.txt: Non-ISO extended-ASCII text, with very long

Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Evuraan
> > getstatusoutput is a "legacy" function. It still exists for code that > has already been using it, but it is not recommended for new code. > > https://docs.python.org/3.5/library/subprocess.html#using-the-subprocess-module > > Since you're using Python 3.5, let's try using the brand new `run` >

Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Steven D'Aprano
On Thu, Sep 21, 2017 at 03:46:29PM -0700, Evuraan wrote: > How can I work around this issue where subprocess.getstatusoutput gives > up, on Python 3.5.2: getstatusoutput is a "legacy" function. It still exists for code that has already been using it, but it is not recommended for new code. htt

Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Evuraan
> > But: do you really want to "tail" what's probably not really a plaintext > file? Just guessing, but the .db as well as the error msgs are a hint. although the filename ends with a ".db", it is just a text file. not tailing a SQLite or a binary file, just happened to name it so. I work around

Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Mats Wichmann
On 09/21/2017 04:46 PM, Evuraan wrote: > Greetings! > > My search-fu failed me, so thought of finally asking this question here. > > > How can I work around this issue where subprocess.getstatusoutput gives > up, on Python 3.5.2: You picked a fun one! First off, subprocess.getstatusoutput is

[Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Evuraan
Greetings! My search-fu failed me, so thought of finally asking this question here. How can I work around this issue where subprocess.getstatusoutput gives up, on Python 3.5.2: >>> subprocess.getstatusoutput("tail -3 /tmp/pmaster.db",) Traceback (most recent call last): File "", line 1, in