Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72108
| From | Dave Angel <davea@davea.name> |
|---|---|
| Subject | Re: Check to see if the script has been previously used? |
| Date | 2014-05-27 07:05 -0400 |
| Organization | news.gmane.org |
| References | <CAG6fH=YuAYnkJHY1Az7sSsEhr++XbM4k=1+Vcs21LXV6Xuu=nw@mail.gmail.com> <CAPTjJmqLvLXHx9M47sEk1hjK9K+fdcrAy2ep4Uxhd1RUwE34Ew@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10366.1401188699.18130.python-list@python.org> (permalink) |
Chris Angelico <rosuav@gmail.com> Wrote in message: > On Tue, May 27, 2014 at 5:45 PM, KC Sparks <kcrsparks@gmail.com> wrote: >> I was wondering if there was an extension or way that would allow me to >> print instructions if it is the first the the user has used the script. > > The trickiest part is defining the 'user'. Generally, this sort of > thing is done by creating a file; if the file's not there, it's the > first time. Some versions of sudo will create a file called > .sudo_as_admin_successful in the user's home directory; others create > /var/lib/sudo/<username> as a directory, and storing information > there. Either technique works well for recognizing a first-time user. > > ChrisA > The problem can be simpler if you're assuming a machine with only one user, or more complicated if the obvious disk location is either read-only to the user, or volatile. You also might want to clear all such flags upon an upgrade. If so, it's not just a file needed, but a sortable version string. Preferred approach is usually to respond to one of the conventional argv switches. And let the user decide. -- DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Check to see if the script has been previously used? Dave Angel <davea@davea.name> - 2014-05-27 07:05 -0400
csiph-web