Re: Python 3.8.5 Not Launching

2020-10-03 Thread Gertjan Klein
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

Re: Python 3.8.5 Not Launching

2020-10-03 Thread Gertjan Klein
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)

Re: Python 3.8.5 Not Launching

2020-10-02 Thread Gertjan Klein
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

Re: Running a command line program and reading the result as it runs

2013-08-23 Thread Gertjan Klein
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

Re: Running a command line program and reading the result as it runs

2013-08-23 Thread Gertjan Klein
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

Re: How to modify this script?

2013-01-08 Thread Gertjan Klein
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

Re: How to modify this script?

2013-01-07 Thread Gertjan Klein
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

Re: maintain 2 versions of python on my computer

2010-01-18 Thread Gertjan Klein
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

Re: maintain 2 versions of python on my computer

2010-01-16 Thread Gertjan Klein
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. >

Re: maintain 2 versions of python on my computer

2010-01-16 Thread Gertjan Klein
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

Re: maintain 2 versions of python on my computer

2010-01-16 Thread Gertjan Klein
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

Re: problem with read() write()

2009-11-01 Thread Gertjan Klein
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

Re: problem with read() write()

2009-11-01 Thread Gertjan Klein
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

Re: How to emit Cyrillic and Chinese via unicode from console mode?

2008-09-14 Thread Gertjan Klein
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

Re: Decode email subjects into unicode

2008-03-19 Thread Gertjan Klein
, 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

Re: Spaces in path name

2008-03-17 Thread Gertjan Klein
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