On 2016-12-05 23:00, Wildman via Python-list wrote:
> On Mon, 05 Dec 2016 21:42:52 -0600, Tim Chase wrote:
> > This works based on my poking at it in both Py2 and Py3:
> 
> That works perfectly.  I owe you a big thanks.  That was a
> lot of work and time on your part.  I really appreciate it.

It was pretty straightforward to map it into a namedtuple using the
links I provided.  The only killer for me was that the struct module
doesn't return an entry for "padding" bytes.  Which makes sense, but
threw me off for a good while as I tried to figure why my
tuple-creation was complaining about a missing parameter (fixed by
commenting out the "__unused" member of the namedtuple; could also
have kept it while changing the "20x" to "20c" in the struct
format-string)

The rest was just basic text manipulation in vim to convert the C
structs into Python code.

And despite what Bernd Nawothnig wrote:

> It looks for me like a worthless learning experience.

it gave me the opportunity to learn about the internals of the utmp
format, something that has long been a curiosity ("it's a binary log,
not text, I wonder what all is in there? But I don't have real cause
to go poking around in there to learn the answer right now.") and this
gave me the push I needed to explore that.

Glad it helped.

-tkc




-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to