Closed GoogleCodeExporter closed 9 years ago
I tried to look into this but so far I wasn't able to find any solution as the
way we're retrieving the NIC name is the one recommended by the official
Windows documentation.
For posterity, problem is here:
https://code.google.com/p/psutil/source/browse/psutil/_psutil_mswindows.c?name=r
elease-1.2.1#2258
Original comment by g.rodola
on 2 Dec 2013 at 7:42
Also, another note: on my Windows 7 box the NIC gets listed but its name is
truncated after encountering the first unicode character (whereas you state it
is not listed at all - are you sure about that?).
Original comment by g.rodola
on 2 Dec 2013 at 7:44
Yup, I'm sure. Maybe try re-encode the string or add an option to strip unicode
characters?
In my case NICs with unicode characters simply doesn't appear in the returned
list, they aren't counted into overall stats too.
Original comment by lukasgu...@gmail.com
on 7 Dec 2013 at 2:46
Does ipconfig /all show the NIC?
Original comment by g.rodola
on 7 Dec 2013 at 2:47
Yes, of course.
Original comment by lukasgu...@gmail.com
on 7 Dec 2013 at 2:49
Any progress?
Original comment by lukasgu...@gmail.com
on 31 Jan 2014 at 10:59
No, sorry. I'm also pretty swamped lately because of a new job so I won't have
time to dedicate to this issue (and psutil in general to be entirely honest).
Original comment by g.rodola
on 1 Feb 2014 at 1:24
Issue 491 has been merged into this issue.
Original comment by g.rodola
on 31 Mar 2014 at 4:55
The problem is here:
https://code.google.com/p/psutil/source/browse/psutil/_psutil_mswindows.c?name=r
elease-1.2.1#2260
The Py_BuildValue able to decode only the UNICODE characters.
I made the following path to replace these characters with "_".
while (pCurrAddresses) {
py_nic_name = NULL;
py_nic_info = NULL;
> int i;
...
sprintf(ifname, "%ws", pCurrAddresses->FriendlyName);
> for (i=0; i<100; i++) {
> if ( *(ifname+i) < 0 || *(ifname+i) > 256 ) {
> // Replace the NON UNICODE character
> *(ifname+i)='_';
> }
> if (*(ifname+i) == '\0') {
> // end of friendly name
> break;
> }
> }
py_nic_name = Py_BuildValue("s", ifname);
@g.rodola: can you put this patch into the next release?
Original comment by szigeti....@gmail.com
on 17 Apr 2014 at 12:59
Issue 500 has been merged into this issue.
Original comment by g.rodola
on 29 Apr 2014 at 5:40
Despite this is a dirty hack I couldn't find any better solution so I committed
your patch as of revision f5bbb4efc031.
Thanks.
Original comment by g.rodola
on 29 Apr 2014 at 7:16
Original comment by g.rodola
on 13 May 2014 at 2:42
Original issue reported on code.google.com by
lukasgu...@gmail.com
on 28 Nov 2013 at 6:12