
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-04-23 23:29 bytakluyver, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| compileall_silent.patch | takluyver,2014-04-24 01:28 | review | ||
| issue21338.diff | berker.peksag,2014-10-05 03:24 | review | ||
| Messages (12) | |||
|---|---|---|---|
| msg217100 -(view) | Author: Thomas Kluyver (takluyver)* | Date: 2014-04-23 23:29 | |
The compileall module's command line interface has a -q (quiet) flag which suppresses most of the output, but it still prints error messages. I'd like an entirely silent mode with no output.My use case is byte-compiling Python files as part of a graphical installer. I do this by running:py -${PY_QUALIFIER} -m compileall -q "$INSTDIR\pkgs"I'd like to be able to use pyw so a terminal doesn't pop up, but if I do that, it exits early. I think this is due to the issue with stdout/stderr buffers filling up on pythonw. | |||
| msg217102 -(view) | Author: Ezio Melotti (ezio.melotti)*![]() | Date: 2014-04-23 23:36 | |
This seems a reasonable request. Do you want to propose a patch? | |||
| msg217106 -(view) | Author: Thomas Kluyver (takluyver)* | Date: 2014-04-24 01:14 | |
Patch attached.This works by making the -q flag countable, so you pass -qq to suppress all output. In the Python API, the quiet parameter has become an integer, so passing 2 is equivalent to -qq. This should be fully backwards compatible with passing True and False, which are equivalent to 1 and 0. | |||
| msg217107 -(view) | Author: Steven D'Aprano (steven.daprano)*![]() | Date: 2014-04-24 01:15 | |
Can't you just re-direct stdout or stderr? I'm sure that works even on Windows. E.g.py -${PY_QUALIFIER} -m compileall -q "$INSTDIR\pkgs" 2> nullIs there a reason you cannot do this? I think that adding functionality to compileall to duplicate what your OS already provides should be a last resort.I also don't understand what you mean by "it exits early". What exits early? Surely python doesn't exit until compileall finishes running. If it does, that's a bug. | |||
| msg217108 -(view) | Author: Thomas Kluyver (takluyver)* | Date: 2014-04-24 01:26 | |
Sorry, I somehow attached an old version of the patch. This one should be correct.Steven: Redirection relies on a shell - the native 'run a process' interface that the installer uses can't do that. There are ways to work around this, but I think this approach makes sense.It exits early because stdout and stderr don't go anywhere, so once either of them has filled up a fairly small buffer, attempts to write to it throw an error. I'd love to see that fixed, but it's been known about for years (seeissue 706263), and it seems unlikely to change any time soon. | |||
| msg217109 -(view) | Author: Thomas Kluyver (takluyver)* | Date: 2014-04-24 01:28 | |
Gah, still wrong. Trying again. | |||
| msg217111 -(view) | Author: Thomas Kluyver (takluyver)* | Date: 2014-04-24 02:12 | |
In fact, I will probably end up working around this anyway, because I'll have to support versions of Python without this fix for some time. So I don't feel strongly that it needs to go in, but I will do any revisions or changes requested if people think it would be useful. | |||
| msg217167 -(view) | Author: Éric Araujo (eric.araujo)*![]() | Date: 2014-04-25 19:26 | |
Patch looks to me comprehensive and backward-compatible. Thanks Thomas! | |||
| msg227800 -(view) | Author: R. David Murray (r.david.murray)*![]() | Date: 2014-09-29 14:34 | |
Berker: I had some review comments pending on the docs, but reitveld isn't letting me publish them for some reason (it says the patch set doesn't exist).The comments are: the method docs should probably say "``False`` or ``0`` (the default)" (and all the numbers should be marked up as code), and the versionchanged I think should say that the option was changed to a multilevel value.Otherwise the patch looks good to me, too. | |||
| msg228534 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2014-10-05 03:24 | |
Here's an updated patch. Thanks David. | |||
| msg229406 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-10-15 08:10 | |
New changeset34436ae65523 by Berker Peksag in branch 'default':Issue#21338: Add silent mode for compileall.https://hg.python.org/cpython/rev/34436ae65523 | |||
| msg229407 -(view) | Author: Berker Peksag (berker.peksag)*![]() | Date: 2014-10-15 08:11 | |
Thanks for the patch, Thomas. | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:02 | admin | set | github: 65537 |
| 2014-10-15 08:11:56 | berker.peksag | set | status: open -> closed resolution: fixed messages: +msg229407 stage: commit review -> resolved |
| 2014-10-15 08:10:24 | python-dev | set | nosy: +python-dev messages: +msg229406 |
| 2014-10-05 03:24:36 | berker.peksag | set | files: +issue21338.diff messages: +msg228534 |
| 2014-09-29 14:34:33 | r.david.murray | set | messages: +msg227800 |
| 2014-08-22 13:02:22 | berker.peksag | set | assignee:berker.peksag nosy: +berker.peksag |
| 2014-05-14 13:46:57 | r.david.murray | set | nosy: +r.david.murray |
| 2014-04-25 19:26:39 | eric.araujo | set | nosy: +eric.araujo messages: +msg217167 type: enhancement stage: needs patch -> commit review |
| 2014-04-24 02:12:45 | takluyver | set | messages: +msg217111 |
| 2014-04-24 01:28:47 | takluyver | set | files: +compileall_silent.patch messages: +msg217109 |
| 2014-04-24 01:28:27 | takluyver | set | files: -compileall_silent.patch |
| 2014-04-24 01:26:54 | takluyver | set | files: +compileall_silent.patch messages: +msg217108 |
| 2014-04-24 01:15:38 | steven.daprano | set | nosy: +steven.daprano messages: +msg217107 |
| 2014-04-24 01:15:26 | takluyver | set | files: -compileall_silent.patch |
| 2014-04-24 01:14:22 | takluyver | set | files: +compileall_silent.patch type: enhancement -> (no value) messages: +msg217106 keywords: +patch |
| 2014-04-23 23:36:44 | ezio.melotti | set | type: enhancement versions: + Python 3.5 keywords: +easy nosy: +ezio.melotti messages: +msg217102 stage: needs patch |
| 2014-04-23 23:29:32 | takluyver | create | |