Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37590

Re: Retrieving the full command line

Date 2013-01-24 13:45 +0000
From Tim Golden <mail@timgolden.me.uk>
Subject Re: Retrieving the full command line
References (6 earlier) <mailman.879.1358935287.2939.python-list@python.org> <5100bd49$0$29877$c3e8da3$5496439d@news.astraweb.com> <CAHVvXxSHY5OztqH526b3DSuOvR6s8iA4ybh9pbj0pT4BDxQTCw@mail.gmail.com> <51011340.6020309@timgolden.me.uk> <CAHVvXxRFVn0BQy=4EsW30OJB+reVhO7teNyrRVdczVD+W_+R_A@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.985.1359035152.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 24/01/2013 11:30, Oscar Benjamin wrote:
> I don't really understand what your spec is. Why do you need to
> inspect this information from sys.argv? Can you not just always use
> 'python -m pkg' as your entry point?

Sorry about the confusion. I think my original point was simply one
of surprise that sys.argv wouldn't essentially mirror the elements
of the command line which I used to get there.
The specifics of my use-case weren't really too important.

For completeness, I'm talking about the cherrypy Autoreloader which
attempts to restart (via execv) whatever process was responsible for
loading it in the first place, via an identical or equivalent command
line. The current (cherrypy) code simply joins sys.executable and
sys.argv but this fails in the face of python -m as we have seen.

The cherrypy package has no especial knowledge of the structure of the
application which imported it and so must piece together the command
line somehow. Clearly, I can take various approaches of the sort
which you've outlined, or subclass the reloader, or fetch the original
command line from the OS, etc. It's not that this is a showstopper,
merely slightly surprising. (To me).

TJG

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-22 15:07 +0000
  Re: Retrieving the full command line Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:46 +0000
    Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-23 00:53 +0000
      Re: Retrieving the full command line Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 03:58 +0000
        Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-23 09:58 +0000
        Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-23 10:01 +0000
          Re: Retrieving the full command line Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-24 04:49 +0000
            Re: Retrieving the full command line Chris Angelico <rosuav@gmail.com> - 2013-01-24 16:06 +1100
            Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-24 10:06 +0000
            Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-24 10:56 +0000
            Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-24 11:04 +0000
            Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-24 11:30 +0000
            Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-24 13:45 +0000
            Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-24 15:28 +0000
            Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-24 15:51 +0000
            Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-24 16:08 +0000
            Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-24 16:53 +0000
            Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-24 17:13 +0000
            Re: Retrieving the full command line Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-24 20:01 +0000
            Re: Retrieving the full command line Tim Golden <mail@timgolden.me.uk> - 2013-01-24 20:54 +0000

csiph-web