Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67653 > unrolled thread

Decoding a process output

Started byFrancis Moreau <francis.moro@gmail.com>
First post2014-03-04 10:29 +0100
Last post2014-03-04 10:29 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Decoding a process output Francis Moreau <francis.moro@gmail.com> - 2014-03-04 10:29 +0100

#67653 — Decoding a process output

FromFrancis Moreau <francis.moro@gmail.com>
Date2014-03-04 10:29 +0100
SubjectDecoding a process output
Message-ID<mailman.7697.1393925404.18130.python-list@python.org>
Hi,

In my understanding (I'm relatively new to python), I need to decode any
bytes data provided, in my case, by a shell command (such as findmnt)
started by the subprocess module. The goal of my application is to parse
the command outputs.

My application runs only on linux BTW and should run fine on both python
2.7 and py3k.

My question is when decoding the output bytes data of the external
command, which encoding should I use ?

Should I guess the encoding by inspecting LANG or any LC_* environment
variables ?

Should I force one of those environment variable to a specific value
before running my external command ?

Thanks for any tips.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web