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


Groups > comp.lang.python > #37276 > unrolled thread

Re: Retrieving the full command line

Started byTerry Reedy <tjreedy@udel.edu>
First post2013-01-22 09:53 -0500
Last post2013-01-22 09:53 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Retrieving the full command line Terry Reedy <tjreedy@udel.edu> - 2013-01-22 09:53 -0500

#37276 — Re: Retrieving the full command line

FromTerry Reedy <tjreedy@udel.edu>
Date2013-01-22 09:53 -0500
SubjectRe: Retrieving the full command line
Message-ID<mailman.791.1358866454.2939.python-list@python.org>
On 1/22/2013 4:24 AM, Tim Golden wrote:
> [Python 2.7/3.3 (and hg tip) running on Windows. Not Windows-specific,
> though].
>
> I use the python -mpackage incantation to run a package which has a
> __main__.py module and which uses relative imports internally.
>
> I'm developing under cherrypy which includes a reloader for development.
> The reloader attempts to rebuild the original
> command line by combining sys.executable and sys.argv and then does an
> execv.
>
> There does not appear to be any way within Python of determining the
> command line I used. The combination of sys.executable and sys.argv in
> this case will look like: "c:\python33\python.exe app/__main__.py". But
> running this precludes the use of package-relative imports.

If I understand right, the reloader should be updated to translate 
'x/__main__.py' to '-m x'. Filenames of form'__x__' are reserved, in a 
sense, like similar identifiers in programs, and '__main__.py' should 
not be used for a file meant to executed directly.

-- 
Terry Jan Reedy

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web