Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: num_fds() should be get_num_fds() #509

Closed
gjcarneiro opened this issue May 30, 2014 · 9 comments
Closed

Documentation: num_fds() should be get_num_fds() #509

gjcarneiro opened this issue May 30, 2014 · 9 comments
Labels

Comments

@gjcarneiro
Copy link

I am using psutil 2.1.1. Documentation mentions a method Process.num_fds(), but apparently it is named get_num_fds() instead. Probably other getters are mis-named as well.

@gjcarneiro
Copy link
Author

Link to the documentation I was following: http://pythonhosted.org//psutil/#psutil.Process.num_fds

@giampaolo
Copy link
Owner

Prior to 2.0.0 all Process methods started with "get_".
With 2.0.0 I removed the "get_" prefix and left the old method names in place for backward compatibility reasons.
Full story is here: http://grodola.blogspot.com/2014/01/psutil-20-porting.html
...and don't feel bad: it's Python's fault which disabled DeprecationWarnings by default, not yours. =)

@gjcarneiro
Copy link
Author

It's strange. In your blog post you mention that p.get_num_fds() was replaced with p.num_fds(). However, in psutils 2.1.1 (the version that pip install psutil installed), I found that p.get_num_fds() works but p.num_fds() doesn't work. I don't mind that API changes as this is a new project, but the documentation doesn't match the code that I am getting.

@giampaolo
Copy link
Owner

Define "doesn't work". What do you get?

@giampaolo giampaolo reopened this May 30, 2014
@gjcarneiro
Copy link
Author

Well, this happend at my office computer, and I went home, so I cannot check from there. I tried to reproduce the same problem at home, but it appears num_fds() works perfectly here!

Well, I guess it's possible I was doing something stupid, who knows. I'll just close this and ask to reopen later if I can reproduce it at work. Thanks.

@giampaolo
Copy link
Owner

My best guess is that you had a version < 2.0.0 installed.

@gjcarneiro
Copy link
Author

Well, not in theory, I was running everything in a virtualenv created with --no-site-packages. I don't usually make such noob mistakes, but who knows, maybe I did...

@gjcarneiro
Copy link
Author

Argh, I'm such a noob! My problem is that I have a virtualenv, but it is used by some Python 3 code, while the problem I had was with some Python 2 code (a supervisord extension). So in fact, the code that uses psutil was Python 2 and did not use the virtual environment at all :P

@giampaolo
Copy link
Owner

Shit happens (all the time). =)

@giampaolo giampaolo added the doc label Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants