Chris Angelico schreef:
On Fri, Oct 2, 2020 at 7:51 PM Gertjan Klein wrote:
Is it possible to determine, from within Python, whether Python
allocated or inherited the console? This could be useful to know in a
(global) error trap: to be able to see a traceback, the console must
remain open
Eryk Sun schreef:
On 10/2/20, Gertjan Klein wrote:
Is it possible to determine, from within Python, whether Python
allocated or inherited the console?
If a console session isn't headless (i.e. it's not a pseudoconsole)
and has a window (i.e. not allocated with CREATE_NO_WINDOW)
Eryk Sun wrote:
If .py files are associated with py.exe or python.exe, then running a
.py script either inherits or allocates a console and attaches to it.
Is it possible to determine, from within Python, whether Python
allocated or inherited the console? This could be useful to know in a
(g
Peter Otten wrote:
The following works on my linux system:
import subprocess
p = subprocess.Popen(
["ping", "google.com"],
stdout=subprocess.PIPE)
instream = iter(p.stdout.readline, "")
for line in instream:
print line.rstrip()
I don't have Windows available to test, but if i
Ian Simcock wrote:
When I use this code I can see that the Popen works, any code between
the Popen and the for will run straight away, but as soon as it gets to
the for and tries to read p.stdout the code blocks until the command
line program completes, then all of the lines are returned.
Does
Thomas Rachel wrote:
Am 07.01.2013 18:56 schrieb Gertjan Klein:
(Watch out for line wraps! I don't know how to stop Thunderbird from
inserting them.)
Do "insert as quotation" (in German Thunderbird: "Als Zitat einfügen"),
or Strg-Shift-O. Then it gets inserted with
Kurt Hansen wrote:
To convert tab-separated text lines into a HTML-table:
As you apparently didn't receive answers that worked for you I tried to
get what you want to work and test it in Gedit. Here's the result:
$<
lines = $GEDIT_SELECTED_TEXT.split("\n");
output = '\n';
max_columns = 0
f
Duncan Booth wrote:
> @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF
> import sys
> print sys.version
> # raise RuntimeError # uncomment to trigger the 'pause'
That is nice! This should probably be in the documentation, here:
http://docs.python.org/using/cmdline.ht
Alf P. Steinbach wrote:
>* Gertjan Klein:
>> Alf P. Steinbach wrote:
>>
>> Thinking about it some more, perhaps that way I can't get at return
>> codes a python script might provide. I haven't used those, but they may
>> be useful at some point.
>
Alf P. Steinbach wrote:
>* Gertjan Klein:
>>
>> What I've been thinking about is to write a single [Windows] executable that
>> gets associated with .py and .pyw (instead of python.exe itself).
>
>Well, you need two: one for console subsystem, and one for GUI su
Gabriel Genellina wrote:
>En Thu, 14 Jan 2010 08:21:28 -0300, luis escribió:
>
>> Is there any way to indicate the version of the python interpreter
>> must use a script?
>
>See http://www.effbot.org/zone/exemaker.htm
>It uses the #! line to determine which version to load, resembling the
>Unix
Alf P. Steinbach wrote:
>* Gertjan Klein:
>> I reproduced (with Python 2.5.2 on WinXP) the code the OP wrote after
>> creating an empty (0-byte) test file; after the write() the read()
>> returns random garbage. I can't imagine why anyone would want that
>> beh
Alf P. Steinbach wrote:
>So with 'w+' the only way to get garbage is if 'read' reads beyond the end of
>file, or 'open' doesn't conform to the documentation.
It does read beyond the end of file. This is perhaps the way the
underlying C library works, but it looks like an "unexpected feature"
(re
ws to assume/support UTF-8 encoding in the console,
programatically or otherwise. :(
Gertjan.
--
Gertjan Klein <[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
, I'd simply try to
decode as CP1252 on error, especially if the content-type claims
iso-8859-1. Many Windows mail clients consider iso-8859-1 equivalent to
1252 (it's not; the former doesn't use code points in the range \x8n and
\x9n, the latter does.)
Regards,
Gertjan.
--
Gert
n library. It is counter-intuitive, buggy, ill-documented, and has
needless limitations in functionality.
Regards,
Gertjan.
--
Gertjan Klein <[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list
16 matches
Mail list logo