[ python-Bugs-1062708 ] pwent objects from the pwd module ar e not pickle-able

SourceForge.net noreply at sourceforge.net
Mon Dec 19 06:08:53 CET 2005


Bugs item #1062708, was opened at 2004-11-08 14:03
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1062708&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Python 2.3
>Status: Closed
>Resolution: Works For Me
Priority: 5
Submitted By: Keith Dart (kdart)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: pwent objects from the pwd module ar e not pickle-able

Initial Comment:
cPickle.PicklingError: Can't pick
le <type 'pwd.struct_passwd>: attribute lookup
pwd.struct_passwd failed

There seems to be some name discrepancy in the pwd
module, and the pickling of a struct_passwd fails.


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2005-12-18 21:08

Message:
Logged In: YES 
user_id=33168

Works for me.  Reopen if you still have problems.

>>> import pickle, cPickle, pwd
>>> n = pwd.getpwnam('nobody')
>>> n
('nobody', 'x', 65534, 65534, 'nobody', '/', '/bin/false')
>>> type(n)
<type 'pwd.struct_passwd'>
>>> pickle.dumps(n)
"cpwd\nstruct_passwd\np0\n((S'nobody'\np1\nS'x'\np2\nI65534\nI65534\nS'nobody'\np3\nS'/'\np4\nS'/bin/false'\np5\ntp6\n(dp7\ntp8\nRp9\n."
>>> cPickle.dumps(n)
"cpwd\nstruct_passwd\np1\n((S'nobody'\np2\nS'x'\nI65534\nI65534\nS'nobody'\np3\nS'/'\nS'/bin/false'\np4\nt(dtRp5\n."


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1062708&group_id=5470


More information about the Python-bugs-list mailing list