giampaolo / psutil

Cross-platform lib for process and system monitoring in Python
BSD 3-Clause "New" or "Revised" License
10.28k stars 1.39k forks source link

psutil decode error #652

Closed PyEldar closed 9 years ago

PyEldar commented 9 years ago

Hi, I have unrecognized problem in my code when using "psutil" module:

--------------------------------------------------------------------------------------------------------------------------
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import psutil
>>> psutil.net_if_addrs()
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    psutil.net_if_addrs()
  File "C:\Python34-32bit\lib\site-packages\psutil\__init__.py", line 1763, in net_if_addrs
    rawlist = _psplatform.net_if_addrs()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 1: invalid start byte
>>> psutil.net_if_stats()
Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    psutil.net_if_stats()
  File "C:\Python34-32bit\lib\site-packages\psutil\__init__.py", line 1795, in net_if_stats
    return _psplatform.net_if_stats()
  File "C:\Python34-32bit\lib\site-packages\psutil\_pswindows.py", line 217, in net_if_stats
    ret = cext.net_if_stats()
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 1-2: invalid continuation byte
-------------------------------------------------------------------------------------------------------------------------

OS: windows 8.1 64bit Python: 3.4.3 32bit Psutil: 3.0.1

mrjefftang commented 9 years ago

Can you paste in the output of ipconfig /all from a command prompt?

PyEldar commented 9 years ago

Of course .... i do not know if letters like "ř" or "í" can cause the problem but i saw them in the names of adapters in ipconfig /all output ...... and i saw asterisk(*) there too ...... but I do not think it could be so simple

Here is the output:

Windows IP Configuration

   Host Name . . . . . . . . . . . . : Acer_006
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Wireless LAN adapter Připojení k místní síti* 4:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Hosted Network Virtual Adapter
   Physical Address. . . . . . . . . : 5E-D2-1E-8D-68-21
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Připojení k místní síti* 3:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
   Physical Address. . . . . . . . . : 1E-D2-1E-8D-68-21
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Qualcomm Atheros AR5BWB222 Wireless Netwo
rk Adapter
   Physical Address. . . . . . . . . : 9C-D2-1E-8D-68-21
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::7904:40cd:ca91:ec31%4(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.0.0.13(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.0.0.0
   Lease Obtained. . . . . . . . . . : 14. července 2015 22:40:40
   Lease Expires . . . . . . . . . . : 16. července 2015 19:52:21
   Default Gateway . . . . . . . . . : 10.0.0.2
   DHCP Server . . . . . . . . . . . : 10.0.0.2
   DHCPv6 IAID . . . . . . . . . . . : 77386270
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-DA-45-09-20-25-64-91-35-67

   DNS Servers . . . . . . . . . . . : 10.0.0.2
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Síť Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Broadcom NetLink (TM) Gigabit Ethernet
   Physical Address. . . . . . . . . : 20-25-64-91-35-67
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter Teredo Tunneling Pseudo-Interface:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv6 Address. . . . . . . . . . . : 2001:0:5ef5:79fb:cd:2a53:af43:9de6(Prefer
red)
   Link-local IPv6 Address . . . . . : fe80::cd:2a53:af43:9de6%7(Preferred)
   Default Gateway . . . . . . . . . : ::
   DHCPv6 IAID . . . . . . . . . . . : 436207616
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-DA-45-09-20-25-64-91-35-67

   NetBIOS over Tcpip. . . . . . . . : Disabled

Tunnel adapter isatap.{C1AD76A8-0586-4471-B9DF-8CC5E49C75B4}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
giampaolo commented 9 years ago

OK, this should now be fixed as part of #650.