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

Named tuples in psutil._common not picklable #461

Closed
giampaolo opened this issue May 23, 2014 · 2 comments
Closed

Named tuples in psutil._common not picklable #461

giampaolo opened this issue May 23, 2014 · 2 comments

Comments

@giampaolo
Copy link
Owner

From countac...@gmail.com on December 29, 2013 20:26:39

What steps will reproduce the problem?  
1. Call psutil function that returns named tuple (e.g. psutil.disk_partitions())
2. Try to call pickle.dumps on returned value 

What is the expected output?  
Should return pickle serialized version of named tuple. 

What do you see instead?  
Throws pickle error. This is because the namedtuple variables are not named the 
same as the namedtuples themselves. For example:

nt_sysmeminfo = namedtuple('usage', 'total used free percent')

Pickle attempts to find the type that the namedtuple object is derived from via 
the psutil._common.usage variable, which does not exist (since it is instead 
located at psutil._common.nt_sysmeminfo). The problem can be corrected simply 
by changing the above line to:

nt_sysmeminfo = namedtuple('nt_sysmeminfo', 'total used free percent') 

What version of psutil are you using? What Python version?  
Python 2.7.6, psutil 1.2.1 

On what operating system? Is it 32bit or 64bit version?  
Debian Jessie, 64-bit 

Please provide any additional information below.  
See above ^^^

Original issue: http://code.google.com/p/psutil/issues/detail?id=461

@giampaolo
Copy link
Owner Author

From g.rodola on December 31, 2013 02:51:44

Thanks. I should have had a test for this.
Fixed in revision 49e78beda34c and others.

Status: FixedInHG
Labels: -Priority-Medium Priority-High Milestone-1.3.0

@giampaolo
Copy link
Owner Author

From g.rodola on March 10, 2014 04:36:50

Closing out as fixed as 2.0.0 version is finally out.

Status: Fixed
Labels: -Milestone-1.3.0 Milestone-2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant