title: Why do I get a UnicodeDecodeError after reading my ping with Python?
body: <p>to make my job easier, i am currently working on a network tool script to find out which switches are online/offline on my network using python. i have this short code:</p>
  <pre><code>import os
  
  ping = os.popen(&quot;ping 9.9.9.9&quot;).read()
  print(ping)
  
  input(&quot;close&quot;)
  </code></pre>
  <p>at home this code runs fine, but when I run this code on my work VM I get this error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;c:\Users\..\Documents\network_tool.py&quot;, line 3, in &lt;module&gt;
      ping = os.popen(&quot;ping 9.9.9.9&quot;).read()
    File &quot;C:\Users\..\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py&quot;, line 23, in decode
      return codecs.charmap_decode(input,self.errors,decoding_table)[0]
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 18: character maps to &lt;undifed_&gt;
  </code></pre>
  <p>thanks for the help in advance :)</p>