Re: File opening modes (r, w, a ...)

2018-02-22 Thread Lew Pitcher
itted to seek to a point in the file, and then write from that point on. A write to a read mode ("r") file isn't permitted at all, so neither is "write after seek" to a read mode file. A write to an append mode ("a" and "a+") file always write to

RE: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Lew Pitcher
line consisting only of two hyphens followed by a space. Any lines that follow that line are considered to be part of the signature. -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about working with html entities in python 2 to use them as filenames

2016-11-22 Thread Lew Pitcher
use os.mkdir() to create a file named with the name of the sanitized path, /or/ use os.makedirs(), which will create all the subdirectories required by your given path. 2) Apparently os.mkdir() (at least) defaults to requiring an ASCII pathname. Those of your titles that contain Unicode characters cannot be stored verbatim without either a) re-encoding the title in ASCII, or b) flagging to os.mkdir() that Unicode is acceptable. Apparently, this is a common problem; a google search brought up several pages dedicated to answering this question, including one extensive paper on the topic (http://nedbatchelder.com/text/unipain.html). There apparently are ways to cause os.mkdir() to accept Unicode inputs; their effectiveness and side-effects are beyond me. HTH -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Lew Pitcher
gt; >subprocess.Popen(["python","a.py", "*"]) > > the output will be: ['a.py','*']? > > In that case forget Windows vs. Linux, you now have a program that will > get command parameters processed differently depending on whether it w

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Lew Pitcher
mal ones recommence. The best way to think about it is that all parameters are parameters, whether derived from a glob input to a shell, or explicitly specified in the invocation. If you have a need for positional parameters, then either specify that your code only accepts them in specific places,

Re: Detect Linux Runlevel

2016-12-05 Thread Lew Pitcher
") 16:36 $ python rlevel.py sh: systemctl: command not found 16:36 $ > systemd 'graphical.target' corresponds to the old runlevel 5. Yes? So? The OP asked for the runlevel, not the systemd target. -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request -- https://mail.python.org/mailman/listinfo/python-list

Re: Detect Linux Runlevel

2016-12-05 Thread Lew Pitcher
On Monday December 5 2016 17:24, in comp.lang.python, "Chris Angelico" wrote: > On Tue, Dec 6, 2016 at 8:38 AM, Lew Pitcher > wrote: >> The OP asked for the runlevel, not the systemd target. > > Runlevels don't exist in systemd. And systemd targets don't

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Lew Pitcher
isable temporarily or permanently if necessary. For example: calculate '3*5' or sh -o noglob -c "calculate 3*5" or even sh -o noglob calculate 3*5 > This expression might be seen as 345 if there happens to be file called > '345' lying around. Only if shell globbing is enabled, and you don't specifically bypass it. -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Lew Pitcher
lt shell options to parse commandlines in the Popen() method, then you need to talk to the authors of Python to see if they can give you a way to alter this behaviour. Otherwise, you are just being cranky and argumentative. Stop it. Suck it up and move on. The world doesn't revolve around B

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Lew Pitcher
On Thursday December 8 2016 11:48, in comp.lang.python, "Random832" wrote: > On Wed, Dec 7, 2016, at 15:29, Lew Pitcher wrote: >> But, point of fact is that the feature to disable globbing is not often >> needed. Most Unix programs that accept filenames are happy to acce

Re: best way to ensure './' is at beginning of sys.path?

2017-02-04 Thread Lew Pitcher
to be a complete idiot. > > I suppose all that could be a reality, but, how many > computers do you know of have been compromised in this > manor? Probably many, especially in high-use, public or semi-restricted systems like those found in Universities, libraries, and other "public" institutions. Even corporate systems have this exposure, which is why large corporations spend a lot of money on Information Systems security. -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request -- https://mail.python.org/mailman/listinfo/python-list

Re: Logic problem: need better logic for desired thruth table.

2015-05-28 Thread Lew Pitcher
;,i); rc = EXIT_FAILURE; } if (rc == EXIT_SUCCESS) puts("SUCCESS"); return rc; } 18:39 $ cc -o testlogic testlogic.c 18:39 $ ./testlogic SUCCESS -- Lew Pitcher "In Skills, We Trust" PGP public key available upon request -- https://mail.python.org/mailman/listinfo/python-list

Re: Pound sign problem

2017-04-10 Thread Lew Pitcher
r: 'ascii' codec can't encode > character u'\xa3' in position 0: ordinal not in range(128) There is no "pound sign" in ASCII[1]. Try changing your target encoding to something other than ASCII. [1]: See http://std.dkuug.dk/i18n/charmaps/ascii for a list of

Re: Pound sign problem

2017-04-11 Thread Lew Pitcher
Steve D'Aprano wrote: > On Tue, 11 Apr 2017 12:50 am, Lew Pitcher wrote: > >> David Shi wrote: >> >>> In the data set, pound sign escape appears: >>> u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000&#x

Re: Pound sign problem

2017-04-11 Thread Lew Pitcher
Chris Angelico wrote: > On Wed, Apr 12, 2017 at 1:24 AM, Lew Pitcher > wrote: >> >> What in "Try changing your target encoding to something other than ASCII" >> is encouragement to use "old legacy encodings"? >> >>> In 2017, unless yo

Re: Proposed new syntax

2017-08-17 Thread Lew Pitcher
before the invention of C. Computer languages have inherited and used it since (at least) 1948. Dartmouth BASIC (1964) had "FOR" FOR I=1 TO 10 ALGOL-60 (1960) had "for" for i:=1 step 1 until 10 ALGOL-58 (1958) had "for" for i:=1(1)10 Superplan (1948) h