Decoding a process output

F

Francis Moreau

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top