anfedorov / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

Process.groupname doesn't work on Windows 7 #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
>>> import psutil, os
>>> psutil.Process(os.getpid()).groupname
''
>>>

Note that for returning the empty string it takes about 10 seconds.
The slowness is caused by NetUserGetLocalGroups(), presumably because of
something related with name resolutions.
If LG_INCLUDE_INDIRECT is replaced with a "0" it returns immediately but
that doesn't solve the problem anyway.

Original issue reported on code.google.com by billiej...@gmail.com on 26 Jan 2010 at 10:35

GoogleCodeExporter commented 9 years ago

Original comment by jlo...@gmail.com on 27 Jan 2010 at 7:24

GoogleCodeExporter commented 9 years ago
I solved the hanging problem in r475. NetUserGetLocalGroups now returns 
immediately
altough an empty string is still returned.

Original comment by billiej...@gmail.com on 10 Feb 2010 at 8:10

GoogleCodeExporter commented 9 years ago
More progresses: there was no error handling for NetUserGetLocalGroups.
I checked its returning value and used PyErr_SetFromWindowsErr() (r476) and now 
a
WindowsError exception is raised instead of having an empty string in return.

By doing some more dubbing I discovered that the real culprit is 
get_proc_username()
function which returns a wrong username (in my case "Administrators", while the 
user
owning the process is "giampaolo") so that is why get_proc_groupname() is 
currently
failing.

Original comment by billiej...@gmail.com on 10 Feb 2010 at 8:10

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 10 Feb 2010 at 8:11

GoogleCodeExporter commented 9 years ago
A comment related to this issue can be found here:
http://code.google.com/p/psutil/issues/detail?id=14&can=1&colspec=ID%20Summary%2
0Type%20Opsys%20Status%20Milestone%20Opened%20Owner%20Progress#c20

Original comment by billiej...@gmail.com on 17 Feb 2010 at 7:41

GoogleCodeExporter commented 9 years ago
We decided to remove groupname functionnality.

Original comment by billiej...@gmail.com on 17 Feb 2010 at 7:46

GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r475 == revision 946561250dc6
r476 == revision 90e3b291077e

Original comment by g.rodola on 2 Mar 2013 at 11:51