[issue29908] Inconsistent crashing with an access violation

2017-03-26 Thread Cameron Mckain

Cameron Mckain added the comment:

The problem was fixed after updating to Django 1.11; apparently, Django 1.10 is 
not fully compatible with Python 3.6. Thanks for your time.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19824] string.Template: Rewrite docs to emphasize i18n use case

2017-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In that case issue20314 looks related.

--
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29763] test_site failing on AppVeyor

2017-03-26 Thread Zachary Ware

Changes by Zachary Ware :


--
pull_requests: +738

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27425] Tests fail because of git's newline preferences on Windows

2017-03-26 Thread Zachary Ware

Changes by Zachary Ware :


--
pull_requests: +737

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29908] Inconsistent crashing with an access violation

2017-03-26 Thread Eryk Sun

Eryk Sun added the comment:

Steve, I added 3.5 because the crash involved ucrtbase.dll. I'll remove it for 
now since the problem is only confirmed in 3.6.

Offset 0x3bd9e in 32-bit ucrtbase.dll is in wdupenv_s [1]. It's probably from 
calling new_spawnve in pydev_monkey.py, as shown in the faulthandler output. I 
don't use PyCharm, so I can't confirm this, but we know wdupenv_s is called by 
the CRT's wspawnve function. For example:

>>> os.spawnve(os.P_WAIT, sys.executable, ['python', '-V'], os.environ)

Breakpoint 0 hit
eax=01b412b0 ebx= ecx=01b41280 edx=01b412b2 esi=01b41280 
edi=
eip=7672bd9e esp=013ef368 ebp=013ef380 iopl=0 nv up ei pl nz na po 
nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b 
efl=0202
ucrtbase!wdupenv_s+0x18e:
7672bd9e 668b08  mov cx,word ptr [eax]
ds:002b:01b412b0=0070
0:000> kc 7
ucrtbase!wdupenv_s
ucrtbase!wsearchenv_s
ucrtbase!wspawnlpe
ucrtbase!wspawnlpe
ucrtbase!wspawnve
python36!os_spawnve_impl
python36!os_spawnve

[1]: https://msdn.microsoft.com/en-us/library/ms175774.aspx

--
versions:  -Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20774] collections.deque should ship with a stdlib json serializer

2017-03-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks Lisa.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20552] Use specific asserts in bytes tests

2017-03-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Raymond, Am I correct in thinking that your comment is not specific to bytes 
but applies to all patches like this?  If so, I think I agree because any 
future changes that break tests will almost certain happen in 3.7+, so that the 
extra work of backporting will have almost 0 gain.  In a few years, the changes 
will be in all currently active branches for free.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Δευτέρα, 27 Μαρτίου 2017 - 6:00:34 π.μ. UTC+3, ο χρήστης Chris Angelico 
έγραψε:
> On Mon, Mar 27, 2017 at 1:52 PM, Νίκος Βέργος  wrote:
> > Its NOT that i have not read it exactly, but for some strange reason i was 
> > under the belief that the way i had syntactically typed the UPDATE query 
> > was correctly and more consistent and similar to thr INSERT query and it 
> > was prefered to me over the other one.
> >
> > UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) 
> > VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"
> >
> > Its still a mystery to em whay this fails syntactically when at the same 
> > time INSERT works like that.
> >
> > We give each columnn a specific value i don't see why it must only be 
> > written as UPDATE visitors SET a=1, b=2, c=3 ... WHERE host LIKE %s.
> >
> > i knew that would work, but the first way although proven syntactically 
> > wrong seems so right .
> 
> It'd be even more logical to write:
> 
> UPDATE visitors INCREMENT visits WHERE host CONTAINS %s;
> 
> I should just use that syntax, and if it doesn't work, I'm going to
> post onto a mailing list until it magically starts working. It's NOT
> that I haven't read the docs - I'm just going to wilfully ignore them.
> 
> Okay, I'm done now.
> 
> ChrisA

Okey i have taken my lesson.
I should have written it as the doc suggested instead of being persistent on 
finding what was worng in the way i had written it
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: [Python-ideas] Proposal: Query language extension to Python (PythonQL)

2017-03-26 Thread Gerald Britton
(Forgot the subject)


> >* On 25 Mar 2017, at 15:51, Gerald Britton  >> wrote:
> *> >* On 25 March 2017 at 11:24, Pavel Velikhov   >> wrote:
> *>* > No, the current solution is temporary because we just don’t have the
> *>* > manpower to
> *>* > implement the full thing: a real system that will rewrite parts of 
> PythonQL
> *>* > queries and
> *>* > ship them to underlying databases. We need a real query optimizer and 
> smart
> *>* > wrappers
> *>* > for this purpose. But we’ll build one of these for demo purposes soon
> *>* > (either a Spark
> *>* > wrapper or a PostgreSQL wrapper).
> *>* One thought, if you're lacking in manpower now, then proposing
> *>* inclusion into core Python means that the core dev team will be taking
> *>* on an additional chunk of code that is already under-resourced. That
> *>* rings alarm bells for me - how would you imagine the work needed to
> *>* merge PythonQL into the core Python grammar would be resourced?
> *>* I should say that in practice, I think that the solution is relatively
> *>* niche, and overlaps quite significantly with existing Python features,
> *>* so I don't really see a compelling case for inclusion. The parallel
> *>* with C# and LINQ is interesting here - LINQ is a pretty cool
> *>* technology, but I don't see it in widespread use in general-purpose C#
> *>* projects (disclaimer: I don't get to see much C# code, so my
> *>* experience is limited).
> *> >* I see lots of C# code, but (thankfully) not so much LINQ to SQL.  Yes, 
> it is a cool technology.  But I sometimes have a problem with the SQL it 
> generates.  Since I'm also a SQL developer, I'm sensitive to how queries are 
> constructed, for performance reasons, as well as how they look, for 
> readability and aesthetic reasons.
> *> >* LINQ queries can generate poorly-performing SQL, since LINQ is a 
> basically a translator, but not an AI.  As far as appearances go, LINQ 
> queries can look pretty gnarly, especially if they include sub queries or a 
> few joins.  That makes it hard for the SQL dev (me!) to read and understand 
> if there are performance problems (which there often are, in my experience)
> *>

We want to go beyond being a basic translator. Especially if the
common use-case will be integrating multiple databases. We can also
introduce decent-looking hints (maybe not always decent looking) to
generate better plans. Not sure about asethetics though...

>* So, I would tend to code the SQL separately and put it in a SQL view, 
>function or stored procedure.  I can still parse the results with LINQ (not 
>LINQ to SQL), which is fine.
> *> >* For similar reasons, I'm not a huge fan of ORMs either.  Probably my 
> bias towards designing the database first and building up queries to meet the 
> business goals before writing a line of Python, C#, or the language de jour.
> *

This sounds completely reasonable, but this means you’re tied to a
specific DBMS (especially if you’re using a lot of built-in functions
that are usually very specific to a database). PythonQL (when it has
enough functionality) should give you independence.


True though not always needed.  e.g. at present I'm working for a large
company with thousands of db servers in all the popular flavors.  The
probability of changing even one of them to a different vendor is
essentially zero.  The costs and dependencies far outweigh any hoped-for
advantage.  At the same time, I'm happy to optimize the SQL for different
target environments.  If I lack the specific expertise, I know where to go
to find it.  The Adapter pattern helps here.

It's actually more important for me to build queries that can be used in
multiple client languages. We're using Java, C++, C#, F#, VB, ...  and
Python, of course (and probably others that I don't know we use). I can
optimize the query once and not worry about the clients messing it up.

-- 
Gerald Britton, MCSE-DP, MVP
LinkedIn Profile: http://ca.linkedin.com/in/geraldbritton
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 1:52 PM, Νίκος Βέργος  wrote:
> Its NOT that i have not read it exactly, but for some strange reason i was 
> under the belief that the way i had syntactically typed the UPDATE query was 
> correctly and more consistent and similar to thr INSERT query and it was 
> prefered to me over the other one.
>
> UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) 
> VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"
>
> Its still a mystery to em whay this fails syntactically when at the same time 
> INSERT works like that.
>
> We give each columnn a specific value i don't see why it must only be written 
> as UPDATE visitors SET a=1, b=2, c=3 ... WHERE host LIKE %s.
>
> i knew that would work, but the first way although proven syntactically wrong 
> seems so right .

It'd be even more logical to write:

UPDATE visitors INCREMENT visits WHERE host CONTAINS %s;

I should just use that syntax, and if it doesn't work, I'm going to
post onto a mailing list until it magically starts working. It's NOT
that I haven't read the docs - I'm just going to wilfully ignore them.

Okay, I'm done now.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Changes by Ned Deily :


--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Ned Deily added the comment:


New changeset 6f95b37f290e0225aed5f8f7733ad0730601201b by Ned Deily (cocoatomo) 
in branch '2.7':
bpo-29888: Fix the link referring to "Python download page" (GH-823)
https://github.com/python/cpython/commit/6f95b37f290e0225aed5f8f7733ad0730601201b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Δευτέρα, 27 Μαρτίου 2017 - 5:43:01 π.μ. UTC+3, ο χρήστης Chris Angelico 
έγραψε:
> On Mon, Mar 27, 2017 at 1:39 PM, Νίκος Βέργος  wrote:
> >> MariaDB / MySQL shows part of your SQL from where they failed to parse.
> >> In your case, your MariaDB can't parse from '('
> >> LIKE clause is not problem for this issue?
> >
> > Yes indeed it is.
> > I was just so sure that UPDATE was working like INSERT and i was persistent 
> > that the WHERE LIKE clause was cauing this.
> >
> > I'am still surprised that:
> >> mysql> update test_update set (b, c) values (4, 5) where a = 1;
> >
> > is failign to parse. It just seems so undoubtly straightforward and correct 
> > syntactically.
> 
> So when people told you to read the docs, what did you do, exactly?
> 
> ChrisA

Its NOT that i have not read it exactly, but for some strange reason i was 
under the belief that the way i had syntactically typed the UPDATE query was 
correctly and more consistent and similar to thr INSERT query and it was 
prefered to me over the other one.

UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) 
VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"

Its still a mystery to em whay this fails syntactically when at the same time 
INSERT works like that.

We give each columnn a specific value i don't see why it must only be written 
as UPDATE visitors SET a=1, b=2, c=3 ... WHERE host LIKE %s.

i knew that would work, but the first way although proven syntactically wrong 
seems so right .
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29911] Uninstall command line in Windows registry does not uninstall

2017-03-26 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy:  -zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29911] Uninstall command line in Windows registry does not uninstall

2017-03-26 Thread Christian Ullrich

Christian Ullrich added the comment:

Thank you.


As for the pointing out: It worked for Cato, didn't it? He may not have lived 
to see it, but his perseverance in the face of rejection eventually brought 
about the years-long bloody war he had dreamed about.

(Any historical inaccuracies in the above are the property of the author.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 1:39 PM, Νίκος Βέργος  wrote:
>> MariaDB / MySQL shows part of your SQL from where they failed to parse.
>> In your case, your MariaDB can't parse from '('
>> LIKE clause is not problem for this issue?
>
> Yes indeed it is.
> I was just so sure that UPDATE was working like INSERT and i was persistent 
> that the WHERE LIKE clause was cauing this.
>
> I'am still surprised that:
>> mysql> update test_update set (b, c) values (4, 5) where a = 1;
>
> is failign to parse. It just seems so undoubtly straightforward and correct 
> syntactically.

So when people told you to read the docs, what did you do, exactly?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Δευτέρα, 27 Μαρτίου 2017 - 2:27:31 π.μ. UTC+3, ο χρήστης INADA Naoki έγραψε:
> > i dont have to update table set column1 = this value, column2=that value and
> > so on
> 
> Why do you think so?  Did you really read the manual?
> 
> mysql> create table test_update (a int primary key, b int, c int);
> Query OK, 0 rows affected (0.02 sec)
> 
> mysql> insert into test_update values (1, 2, 3);
> Query OK, 1 row affected (0.00 sec)
> 
> mysql> update test_update set (b, c) values (4, 5) where a = 1;
> ERROR 1064 (42000): You have an error in your SQL syntax; check the
> manual that corresponds to your MySQL server version for the right
> syntax to use near '(b, c) values (4, 5) where a = 1' at line 1
> 
> mysql> update test_update set b=4, c=5 where a = 1;
> Query OK, 1 row affected (0.01 sec)
> Rows matched: 1  Changed: 1  Warnings: 0
> 
> >
> > It's just when the LIKE clause jumps in that is causing all this trouble
> 
> Your MariaDB said:
> 
> > check the manual that corresponds to your MariaDB server version for the 
> > right syntax to use near '(pagesID, host, ...
> 
> MariaDB / MySQL shows part of your SQL from where they failed to parse.
> In your case, your MariaDB can't parse from '('
> LIKE clause is not problem for this issue?

Yes indeed it is.
I was just so sure that UPDATE was working like INSERT and i was persistent 
that the WHERE LIKE clause was cauing this.

I'am still surprised that:
> mysql> update test_update set (b, c) values (4, 5) where a = 1;

is failign to parse. It just seems so undoubtly straightforward and correct 
syntactically.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29162] pyshell.py: name 'sys' is not defined

2017-03-26 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +736

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29162] pyshell.py: name 'sys' is not defined

2017-03-26 Thread Jelle Zijlstra

Changes by Jelle Zijlstra :


--
pull_requests: +735

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29162] pyshell.py: name 'sys' is not defined

2017-03-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Reopening because I missed file=sys.__stderr__ in the print() above sys.exit 
;-(.  Reported by JelleZijlstra in PR.

I wonder if there is any way to force an import to fail when testing.  I could 
at least partly test by moving the code for import failure and that for "if 
TkVersion < 8.5" into functions.

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Kinebuchi Tomohiko

Kinebuchi Tomohiko added the comment:

@ned.deily Thank you for the commend. I updated the 2.7 PR.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20774] collections.deque should ship with a stdlib json serializer

2017-03-26 Thread Lisa Roach

Lisa Roach added the comment:

I made PR 830 for this issue, it seems to be a nice feature to have in my 
opinion. 

Let me know if I should add some unit tests :)

--
nosy: +lisroach
pull_requests: +734

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Tim Chase
On 2017-03-27 02:37, Chris Angelico wrote:
> > In DOS, (I don't remember if in all versions or only some)
> > one could do all this and this opens very rich possibilities for
> > approximating of objects with tiles. The only limitations
> > that one uses 255 tiles, but even this enables to build
> > whole 'worlds' and state of the art apps. So I would call this
> > pseudographics and not few sticks and corner tiles
> > (which I cannot even define and upload easily).  
> 
> Yeah; if my memory serves me, this was an IBM BIOS feature, so all
> versions of DOS would be equally able to do it. But it's basically a
> form of tile graphics, not text. 

It was a function of the EGA/VGA card (maybe CGA? Though I think
that might have been limited to the upper 128 chars while the lower
128 were fixed), not the IBM BIOS.  But yes, there were font-editors
for the EGA/VGA fonts and, once set, they'd appear even in things
like WordPerfect, QuattroPro, Lotus, or Turbo Pascal.  All the rage
back in my 286-wolfenstein3d-playing-turbopascal-programming days. ;-)

-tkc


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29911] Uninstall command line in Windows registry does not uninstall

2017-03-26 Thread Steve Dower

Steve Dower added the comment:

I'll take a look at having separate commands set, but the component responsible 
is external and this may be an issue for them.

Also, for future reference, continuing to point out that you would have 
preferred an MSI does not help you get faster assistance, and does not count as 
more "votes" towards any change. Continuing to add it will eventually annoy the 
volunteers who work on CPython sufficiently that you may find it very hard to 
get any attention at all.

--
assignee:  -> steve.dower
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29908] Inconsistent crashing with an access violation

2017-03-26 Thread Steve Dower

Steve Dower added the comment:

Have you confirmed this occurring with 3.5? PyCharm has a very invasive 
debugger that is almost certainly responsible, but there's a significant 
difference between the 3.5 and 3.6 implementations that is probably relevant.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19824] string.Template: Rewrite docs to emphasize i18n use case

2017-03-26 Thread R. David Murray

R. David Murray added the comment:

Let's retitle this, then.

--
nosy: +r.david.murray
title: string.Template: Add PHP-style variable expansion example -> 
string.Template: Rewrite docs to emphasize i18n use case

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Steve D'Aprano
On Mon, 27 Mar 2017 07:13 am, Νίκος Βέργος wrote:

> OMG!!! It actually worked!
> 
> Can't believe that 3 days in a row i have tried everything concerning
> string manipulation and mysql escaping nd the error was the UPDATE
> itself

You tried everything except what we told you, over and over and over again:

READ THE MANUAL.

The error message told you it was a SQL syntax error, but no, you insisted
that you knew better, and refused to do what the error message said.

So you wasted three days due to your own stubbornness and laziness.

I have no sympathy for your self-inflicted problems.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29909] types.coroutine monkey patches original function

2017-03-26 Thread Eric Hopper

Eric Hopper added the comment:

Here's an update to types.coroutine that fixes the problem for me.

--
Added file: http://bugs.python.org/file46756/types.coroutine.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Mikhail V
On 26 March 2017 at 21:53, Chris Angelico  wrote:
> On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V  wrote:
>> On 26 March 2017 at 20:10, Steve D'Aprano  wrote:
>>> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote:
>>>
>>> [...]
>> And more important: can one use binary (bitmap) fonts in default modern
>> linux console? If yes, can one patch them with custom tiles at
>> the application start?
>
> If you really need something completely custom, it's not text any
> more.

 Obvious fact, but if I need e.g. rounded corners in table drawing
 characters? Or I just want to fix some characters which look especially
 ugly? Create a new TTF? No, thanks, this would be worst nightmare to
 do without a special tool (which have prices with several zeros, otherwise
 just don't work and can even break things system-wide)
>>>
>>> Don't be silly. It took me ten seconds on Google to find this:
>>>
>>> https://birdfont.org/
>>>
>>
>> It takes you ten seconds to Google, and what if I ask you
>> to take, say Courier New font TTF file (which includes not only
>> vector information but all that is responsible for bitmap
>> rendering, subpixeling, etc), then edit one character (and
>> all corresponding information for subpixeling),
>> then compile it as a new font, then install it on Win,
>> without that making any conflicts, and without _any_
>> further glitches or changes in other characters, and no such
>> things across all applications.
>> If you'd try that, and you will succeed, _then_ I will publicly admit
>> that I was silly.
>>
>> And paying even 50$ for correcting one glyph... well
>> probably I'll do it if one gives guarantee that all above
>> will work.
>
> See previous comments about font substitution. Create a font with just
> one character in it. Use that font in your application. Voila! No
> changes to any other applications (because they'll still be using the
> original font), and no changes to any other characters.

Good tip, I'll try that. Though still one need an app, even
for one character, and it'll need fallback setup on each
computer I use.
Dont get it wrong, I don't say it is impossible. There are
guys that have figured out such things and I've read once
something about hacking bitmap and subpixeling
information directly in the font file, but I was not
stubborn enough to learn that.


> Is it that decades of typographical research is incorrect, or that the
> designers of this font just sucked? You're pretty unambiguous in your
> description that you are "correcting" a glyph. Not adapting it to your
> own purposes - you're correcting something that's fundamentally wrong
> in someone else's font. Impressive.

Call it "modify for own purpose" if it sounds better.
In Courier, the brackets are too small, tilde char is too
much like hyphen, some other minor things.
And Courier New bold is best readable (for me ;) font on Win
 so I don't want another font, which has better brackets,
but less readable. And as said, if possible I avoid
monospaced font where possible, so this means
that probably I'll need to modfy some other fonts too.


 And for own standalone app, I would not use any TTF or
 anything vector-based font, since why?
>>>
>>> Right, because your users will *love* to see their native language displayed
>>> in a crappy bitmapped font with jagged or blurry edges.
>>>
>>
>> I am working on text rendering algorithms an have prototyped
>> several bitmap-based text rendering algorithms,
>> both managed and prerendered approaches, and there
>> is _nothing_ jagged or [incorrectly] blurred there, when
>> one knows what he's doing of course.
>> So it would be _very_ hard to catch me on incompetence
>> here, but you can try, and feel free to do it :
>
> Sure. Render me two characters on a half-meter-wide 1920x1080 screen.
> I'll choose the exact size dynamically, at run-time, in response to
> the amount of chrome I have on the window. Make sure the two
> characters look perfect whether I make this a tiny marker on the
> screen, or make it completely fill the entire monitor.
> [...]
> Even if high-DPI displays *do* prevail, you still have to render
> text at a wide variety of pixel sizes.

Seems like you are jumping from one corner case to another.
In general, if you want huge letters or some design tasks
(e.g. huge letters for a print) you can use vector paths.
But remember that a photo or a bitmap texture will not
become new information if you convert each pixel to a vector square, or
circle.  It is only question of scalability.

Concentrate on these points:
- Restrict the case to display only
- Making one letter fill half of a monitor, or rotating it arbitrary,
has little to do with reading text on a monitor in real situation.
- Your understanding of "look perfect" and relation with
information cognition (e.g. a retro game upscaled with
integer scaler versus a remake of this game made 

[issue29912] Overlapping tests between list_tests and seq_tests

2017-03-26 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Seems the CommonTests class defined in list_tests duplicates the testing 
performed by seq_tests.CommonTests in the following functions:

test_index, test_count

Additionally, a part of test_imul from list_tests.CommonTests can be moved to 
seq_tests.CommonTests. (specifically, up until `self.assertEqual(u, 
self.type2test([]))`).

Am I missing some non-obvious thing here or can I safely remove the two test 
functions in list_tests.CommonTests and move (while also adding a super call) 
part of test_imul from list_tests.CommonTests to test_imul in 
seq_tests.CommonTests?

Some links:

[1a] seq_tests test_index: 
https://github.com/python/cpython/blob/1e73dbbc29c96d0739ffef92db36f63aa1aa30da/Lib/test/seq_tests.py#L363
[1b] list_tests test_index:
https://github.com/python/cpython/blob/1e73dbbc29c96d0739ffef92db36f63aa1aa30da/Lib/test/list_tests.py#L376

[2a] seq_tests test_count:
https://github.com/python/cpython/blob/1e73dbbc29c96d0739ffef92db36f63aa1aa30da/Lib/test/seq_tests.py#L344
[2b] list_tests test_count:
https://github.com/python/cpython/blob/1e73dbbc29c96d0739ffef92db36f63aa1aa30da/Lib/test/list_tests.py#L357

[3a] seq_tests test_imul:
https://github.com/python/cpython/blob/1e73dbbc29c96d0739ffef92db36f63aa1aa30da/Lib/test/seq_tests.py#L300
[3b] list_tests test_imul:
https://github.com/python/cpython/blob/1e73dbbc29c96d0739ffef92db36f63aa1aa30da/Lib/test/list_tests.py#L550

--
components: Tests
messages: 290550
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Overlapping tests between list_tests and seq_tests
type: behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread INADA Naoki
> i dont have to update table set column1 = this value, column2=that value and
> so on

Why do you think so?  Did you really read the manual?

mysql> create table test_update (a int primary key, b int, c int);
Query OK, 0 rows affected (0.02 sec)

mysql> insert into test_update values (1, 2, 3);
Query OK, 1 row affected (0.00 sec)

mysql> update test_update set (b, c) values (4, 5) where a = 1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '(b, c) values (4, 5) where a = 1' at line 1

mysql> update test_update set b=4, c=5 where a = 1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

>
> It's just when the LIKE clause jumps in that is causing all this trouble

Your MariaDB said:

> check the manual that corresponds to your MariaDB server version for the 
> right syntax to use near '(pagesID, host, ...

MariaDB / MySQL shows part of your SQL from where they failed to parse.
In your case, your MariaDB can't parse from '('
LIKE clause is not problem for this issue?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread breamoreboy
On Sunday, March 26, 2017 at 8:33:49 PM UTC+1, Νίκος Βέργος wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 10:23:27 μ.μ. UTC+3, ο χρήστης 
> bream...@gmail.com έγραψε:
> > On Sunday, March 26, 2017 at 4:11:54 PM UTC+1, Νίκος Βέργος wrote:
> > > Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
> > > 
> > > > The database wrapper won't do substitution into the middle of a string
> > > > like that. Either concatenate the literal %'s on in the SQL statement
> > > > or add them to the string before you pass it in, i.e. '%' + domain +
> > > > '%' or '%%%s%%' % domain or '%{}%'.format(domain).
> > > 
> > > I just tried:
> > > 
> > > domain = '.'.join( host.split('.')[-2:] )
> > > domain = '%' + domain + '%'
> > > 
> > > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> > > browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" 
> > > ''', 
> > >   
> > >   
> > >   
> > > (pID, domain, ref, 
> > > location, useros, browser, lastvisit, domain) )
> > > 
> > > 
> > > and i received no error in the error_log but
> > > ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> > > manual that corresponds to your MariaDB server version for the right 
> > > syntax to use near '(pagesID, host, ref, location, useros, browser, 
> > > visits) VALUES (1, '%cyta.gr%', ' at line 1")
> > > 
> > > which you can see at http://superhost.gr
> > > 
> > > You said somethign about concatenating the literal % in the SQL to which 
> > > i didnt actually i understand how to implement.
> > 
> > I knew that I had a sense of deja vu about this 
> > https://mail.python.org/pipermail/python-list/2013-June/649809.html
> > 
> > Kindest regards.
> > 
> > Mark Lawrence
> 
> Since i'm incopetent as you suggest i'am show us your level of skills and 
> expertise and provide a solution, otherwise you are also what you claim of me.

*plonk*
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread breamoreboy
On Sunday, March 26, 2017 at 4:11:54 PM UTC+1, Νίκος Βέργος wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
> 
> > The database wrapper won't do substitution into the middle of a string
> > like that. Either concatenate the literal %'s on in the SQL statement
> > or add them to the string before you pass it in, i.e. '%' + domain +
> > '%' or '%%%s%%' % domain or '%{}%'.format(domain).
> 
> I just tried:
> 
> domain = '.'.join( host.split('.')[-2:] )
> domain = '%' + domain + '%'
> 
> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" 
> ''', 
>   
>   
>   
> (pID, domain, ref, location, 
> useros, browser, lastvisit, domain) )
> 
> 
> and i received no error in the error_log but
> ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> manual that corresponds to your MariaDB server version for the right syntax 
> to use near '(pagesID, host, ref, location, useros, browser, visits) VALUES 
> (1, '%cyta.gr%', ' at line 1")
> 
> which you can see at http://superhost.gr
> 
> You said somethign about concatenating the literal % in the SQL to which i 
> didnt actually i understand how to implement.

I knew that I had a sense of deja vu about this 
https://mail.python.org/pipermail/python-list/2013-June/649809.html

Kindest regards.

Mark Lawrence
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29910] Ctrl-D eats a character on IDLE

2017-03-26 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Checking, I see that the default ^D binding to DEL is documented in IDLE Help, 
section 2, Editing and Navigation, along with other Text defaults.  (I need to 
determine if the list is complete.  Is it the same on all systems?)  

I question whether IDLE should allow these to be changed, or whether at least 
some should be fixed.  The information should certainly be made available 
somehow in the key customization UI. The UI should inform users when a proposed 
customization creates a conflict with existing bindings.  (This last is more or 
less covered by other issues.)

In Shell, ^D is treated as EOF and closes the window (but not IDLE if another 
window is open), even (recently) on Windows.

> Ctrl-D is binded to commenting out a block in IDLE.

This is only true in the IDLE Modern UNIX binding that you wrote for 3.6 (and 
possibly in user customizations).  All other builtin bindings use Alt-3 for 
'comment-region'.  If I had noticed the conflict before pushing, I would have 
brought it up.  Too late.

As for the patch.  Adding "return 'break'" in general looks good, but I have 
not checked each case yet.  (Not having side by side diffs as with Rietveld 
makes this much harder.)  In some places, you add "return None" instead.  I am 
not sure why the difference.  If there is a masked binding, having 'key-x' do 
one thing sometimes and something else other times would seem disconcerting. 

Removing "assertIsNone()" in test_parenmatch.py appears valid 
since the assert did not really test much for calls that always returned None 
(and now always 'break').  Improving that test file would be a new issue.

Testing the change in wrapper functions of the form
def xyz_event(event):
xyz()
return 'break'
will be easy: check that a mock xyz is called and that the wrapper returns 
'break'.  Testing xyz itself can be deferred.  Testing event handlers that do 
the work internally, as in (un)comment_region_event, will require some fixture 
setup.  As before, I expect to work on adding tests.

Since idelib essentially identical in 3.6 and 3.7, I think your original 
cherry-pick 3.6 tag was correct in that the patch should work as is.  It would 
have to be changed at least as far as file names is concerned for other 
versions, but since the Modern Unix keyset and associated changes were new in 
3.6 and not backported, I am not inclined to backport this either.

--
stage: patch review -> test needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 6:57 PM, Chris Angelico  wrote:
>
> In actual UCS-2, surrogates are entirely disallowed; in UTF-16, they *must* be
> correctly paired.

Strictly-speaking UCS-2 disallows codes that aren't defined by the
standard, but the kernel couldn't be that restrictive. Unicode was a
moving target in the period that NT was developed (1988-93). The
object manager simply allows any 16-bit code in object names, except
its path separator, backslash. Since a UNICODE_STRING is counted, even
NUL is allowed in object names. But that's uncommon and should be
avoided since the user-mode API uses null-terminated strings.

The file-system runtime library further restricts this by reserving
NUL, ASCII control codes, forward slash, pipe, and the wildcard
characters asterisk, question mark, double quote, less than, and
greater than. The rules are loosened for NTFS named streams, which
only reserve NUL, forward slash, and backslash.

>> Windows file systems are also UCS-2. For the most part it's not an
>> issue since the source of text and filenames will be valid UTF-16.
>
> I'm actually not sure on that one. Poking around on both Stack
> Overflow and MSDN suggests that NTFS does actually use UTF-16, which
> implies that lone surrogates should be errors, but I haven't proven
> this. In any case, file system encoding is relatively immaterial; it's
> file system *API* encoding that matters, and that means the
> CreateFileW function and its friends:

Sure, the file system itself can use any encoding, but Microsoft use a
permissive UCS-2 in its file systems. The API uses 16-bit WCHARs, and
except for a relatively small set of codes (assuming it uses the
FsRtl), the system generally doesn't care about the values. Let's
review the major actors.

CreateFile uses the runtime library in ntdll.dll to fill in an
OBJECT_ATTRIBUTES [1] with a UNICODE_STRING [2]. This is where the
current-directory handle is set as the attributes RootDirectory handle
for relative paths; where slash is replaced with backslash; and where
weird MS-DOS rules are applied, such as DOS device names and trimming
trailing spaces. Once it has a native object attributes record, it
calls the real system call NtCreateFile [3]. In kernel mode this in
turn calls the I/O manager function IoCreateFile [4], which creates an
open packet and calls the object manger function ObOpenObjectByName.

Now it's time for path parsing. In the normal case the system
traverses several object directories and object symbolic links before
finally arriving at an I/O device (e.g. \??\C: => \Global??\C: =>
\Device\HarddiskVolume2). Parsing the rest of the path is in the hands
of the I/O manager via the Device object's ParseProcedure. The I/O
manager creates a File object and an I/O request packet (IRP) for the
major function IRP_MJ_CREATE [5] and calls the driver for the device
stack via IoCallDriver [6]. If the device is a volume that's managed
by a file-system driver (e.g. ntfs.sys), the file-system parses the
remaining path to open or create the directory/file/stream and
complete the IRP. The object manager creates a handle for the File
object in the handle table of the calling process, and this handle
value is finally passed back to the caller.

[1]: https://msdn.microsoft.com/en-us/library/ff557749
[2]: https://msdn.microsoft.com/en-us/library/ff564879
[3]: https://msdn.microsoft.com/en-us/library/ff566424
[4]: https://msdn.microsoft.com/en-us/library/ff548418
[5]: https://msdn.microsoft.com/en-us/library/ff548630
[6]: https://msdn.microsoft.com/en-us/library/ff548336

The object manager only cares about its path separator, backslash,
until it arrives at an object type that it doesn't manage, such as a
Device object. If a file system uses the FsRtl, then the remaining
path is subject to Windows file-system rules. It would be ill-advised
to diverge from these rules.

> I *think* it's the naive (and very common) hybrid of UCS-2 and UTF-16

It's just the way the system evolved over time. UTF-16 wasn't
standardized until 1996 circa NT 4.0. Windows started integrating it
around NT 5 (Windows 2000), primarily for the GUI controls in the
windowing system that directly affect text processing for most
applications. It was good enough to leave most of the lower layers of
the system passively naive when it comes to UTF-16.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 11:59:21 μ.μ. UTC+3, ο χρήστης Larry Hudson 
έγραψε:
> On 03/26/2017 01:21 AM, Νίκος Βέργος wrote:
> > print('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> > browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE 
> > "%s"''', (pID, domain, ref, location, useros, browser, lastvisit, domain) )
> >
> > prints out:
> >
> > UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) 
> > VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" (1, 'cyta.gr', 
> > 'Άμεση Πρόσβαση', 'Greece', 'Windows', 'Chrome', '17-03-24 22:04:24', 
> > 'cyta.gr')
> >
> > How should i write the cursor.execute in order to be parsed properly?
> > As i have it now %s does not get substituted.
> 
> You don't get the substitution because you're missing a %.
> 
> Change:
>  ... LIKE "%s"''', (pID, ...
> To:
>  ... LIKE "%s"''' % (pID, ...
> 
> -- 
>   -=- Larry -=-

No, i have tried it many times. 
It fails and is prone to sql injection within a cursor execute.

As i understood i can have UPDATE syntax be as similar to INSERT like

(pagesID, host, ref, location, useros, browser, visits) VALUES (%s, %s, %s, %s, 
%s, %s, %s)

each column needs to be set respectively as column1 = value1, column2 = value 2 
and so on.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Larry Hudson via Python-list

On 03/26/2017 01:21 AM, Νίκος Βέργος wrote:

print('''UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) 
VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"''', (pID, domain, ref, 
location, useros, browser, lastvisit, domain) )

prints out:

UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) VALUES (%s, 
%s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" (1, 'cyta.gr', 'Άμεση Πρόσβαση', 
'Greece', 'Windows', 'Chrome', '17-03-24 22:04:24', 'cyta.gr')

How should i write the cursor.execute in order to be parsed properly?
As i have it now %s does not get substituted.


You don't get the substitution because you're missing a %.

Change:
... LIKE "%s"''', (pID, ...
To:
... LIKE "%s"''' % (pID, ...

--
 -=- Larry -=-
--
https://mail.python.org/mailman/listinfo/python-list


[issue19824] string.Template: Add PHP-style variable expansion example

2017-03-26 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

We should really restructure string.Template documentation to emphasize i18n.  
That's always been its prime use case, and f-strings don't change that (because 
f-strings are not really appropriate for translations).  Before f-strings, 
string.Template had other common uses. But f-strings do fulfill most other 
cases where people were using string.Template, so let's make sure that 
distinction is clear to people.

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 11:05:34 μ.μ. UTC+3, ο χρήστης Νίκος Βέργος 
έγραψε:
> Τη Κυριακή, 26 Μαρτίου 2017 - 10:56:07 μ.μ. UTC+3, ο χρήστης Chris Angelico 
> έγραψε:
> > On Mon, Mar 27, 2017 at 6:33 AM, Νίκος Βέργος  wrote:
> > > Since i'm incopetent as you suggest i'am show us your level of skills and 
> > > expertise and provide a solution, otherwise you are also what you claim 
> > > of me.
> > 
> > It's not his problem. An expert does not have to provide solutions to
> > prove his expertise, unless s/he is suffering from severe self-image
> > problems. Someone who's getting paid to host other people's web sites,
> > on the other hand, needs to solve the problems that come up.
> > 
> > ChrisA
> 
> Okey although i beleive my UPDATE query to be correct i'll now try this:
> 
> cur.execute('''UPDATE visitors SET pagesID=%s, host=%s, ref=%s, location=%s, 
> useros=%s, browser=%s, visits=%s WHERE host LIKE %s''', (pID, domain, ref, 
> location, useros, browser, lastvisit, domain_query) )

OMG!!! It actually worked!

Can't believe that 3 days in a row i have tried everything concerning string 
manipulation and mysql escaping nd the error was the UPDATE itself

OMG!!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 10:56:07 μ.μ. UTC+3, ο χρήστης Chris Angelico 
έγραψε:
> On Mon, Mar 27, 2017 at 6:33 AM, Νίκος Βέργος  wrote:
> > Since i'm incopetent as you suggest i'am show us your level of skills and 
> > expertise and provide a solution, otherwise you are also what you claim of 
> > me.
> 
> It's not his problem. An expert does not have to provide solutions to
> prove his expertise, unless s/he is suffering from severe self-image
> problems. Someone who's getting paid to host other people's web sites,
> on the other hand, needs to solve the problems that come up.
> 
> ChrisA

Okey although i beleive my UPDATE query to be correct i'll now try this:

cur.execute('''UPDATE visitors SET pagesID=%s, host=%s, ref=%s, location=%s, 
useros=%s, browser=%s, visits=%s WHERE host LIKE %s''', (pID, domain, ref, 
location, useros, browser, lastvisit, domain_query) )
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 6:33 AM, Νίκος Βέργος  wrote:
> Since i'm incopetent as you suggest i'am show us your level of skills and 
> expertise and provide a solution, otherwise you are also what you claim of me.

It's not his problem. An expert does not have to provide solutions to
prove his expertise, unless s/he is suffering from severe self-image
problems. Someone who's getting paid to host other people's web sites,
on the other hand, needs to solve the problems that come up.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 6:25 AM, Mikhail V  wrote:
> On 26 March 2017 at 20:10, Steve D'Aprano  wrote:
>> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote:
>>
>> [...]
> And more important: can one use binary (bitmap) fonts in default modern
> linux console? If yes, can one patch them with custom tiles at
> the application start?

 If you really need something completely custom, it's not text any
 more.
>>>
>>> Obvious fact, but if I need e.g. rounded corners in table drawing
>>> characters? Or I just want to fix some characters which look especially
>>> ugly? Create a new TTF? No, thanks, this would be worst nightmare to
>>> do without a special tool (which have prices with several zeros, otherwise
>>> just don't work and can even break things system-wide)
>>
>> Don't be silly. It took me ten seconds on Google to find this:
>>
>> https://birdfont.org/
>>
>
> It takes you ten seconds to Google, and what if I ask you
> to take, say Courier New font TTF file (which includes not only
> vector information but all that is responsible for bitmap
> rendering, subpixeling, etc), then edit one character (and
> all corresponding information for subpixeling),
> then compile it as a new font, then install it on Win,
> without that making any conflicts, and without _any_
> further glitches or changes in other characters, and no such
> things across all applications.
> If you'd try that, and you will succeed, _then_ I will publicly admit
> that I was silly.
>
> And paying even 50$ for correcting one glyph... well
> probably I'll do it if one gives guarantee that all above
> will work.

See previous comments about font substitution. Create a font with just
one character in it. Use that font in your application. Voila! No
changes to any other applications (because they'll still be using the
original font), and no changes to any other characters.

However, I'm impressed that you found a bug in a well-used font.

http://www.catb.org/esr/faqs/smart-questions.html#idm46227256017920

Is it that decades of typographical research is incorrect, or that the
designers of this font just sucked? You're pretty unambiguous in your
description that you are "correcting" a glyph. Not adapting it to your
own purposes - you're correcting something that's fundamentally wrong
in someone else's font. Impressive.

>> Why? Because you think you know better than the thousands of professionals
>> who have worked with text formats for decades?
>
> Sounds provocative, but yes, in some cases I know what I am
> doing ;-).
> But that is not because professionals does not know,
> there are many other aspects which come in play here.
> It depends on the use case, Unicode solves only some
> problems.
> I was talking only about _my own_ usage, it
> will be obviously incompatible e.g. for copy-pasting
> between othr apps.
> There are benefits to store language-specific values (+ their glyphs)
> in separate stacks.
> Anyway this discussion will require concrete
> examples and much deeper investigation.

I generally find that when people say that Unicode doesn't solve their
problems and they need to roll their own, it's usually one of two
possibilities:

1) "Their problems" are all about simplicity. They don't want to have
to deal with all the complexities of real-world text, so they
arbitrarily restrict things.
2) Unicode _would_ solve their problems, they just don't realize it.

So if you're rolling your own text display system, you should start by
making a signed declaration:

"""
I, the undersigned, acknowledge that my program is intentionally
excluding everyone who does not fit the following requirements:
[choose all applicable]

[ ] Speaks English exclusively
[ ] Uses no diacritical marks
[ ] Writes all text top-to-bottom, left-to-right
[ ] Uses only characters from the Basic Multilingual Plane
[ ] Uses only characters from this codepage: 
[ ] Uses a monospaced font
[ ] Uses a proportionally-spaced font
[ ] Uses this font: _
[ ] Uses a mouse
[ ] Uses a keyboard
[ ] Other: ___
(use additional pages if required)

Signed: ___
"""

Sure, there are good reasons to place restrictions on people's text.
But those restrictions are part of your public API and UI. Acknowledge
them. Own them. And justify them.

>>> And for own standalone app, I would not use any TTF or
>>> anything vector-based font, since why?
>>
>> Right, because your users will *love* to see their native language displayed
>> in a crappy bitmapped font with jagged or blurry edges.
>>
>
> I am working on text rendering algorithms an have prototyped
> several bitmap-based text rendering algorithms,
> both managed and prerendered approaches, and there
> is _nothing_ jagged or [incorrectly] blurred there, when
> one knows what he's doing of course.
> So it would be _very_ hard to catch me on incompetence
> here, but you can try, and feel free to do it :

Sure. Render me two 

Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 10:23:27 μ.μ. UTC+3, ο χρήστης bream...@gmail.com 
έγραψε:
> On Sunday, March 26, 2017 at 4:11:54 PM UTC+1, Νίκος Βέργος wrote:
> > Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
> > 
> > > The database wrapper won't do substitution into the middle of a string
> > > like that. Either concatenate the literal %'s on in the SQL statement
> > > or add them to the string before you pass it in, i.e. '%' + domain +
> > > '%' or '%%%s%%' % domain or '%{}%'.format(domain).
> > 
> > I just tried:
> > 
> > domain = '.'.join( host.split('.')[-2:] )
> > domain = '%' + domain + '%'
> > 
> > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> > browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" 
> > ''', 
> > 
> > 
> > 
> > (pID, domain, ref, 
> > location, useros, browser, lastvisit, domain) )
> > 
> > 
> > and i received no error in the error_log but
> > ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> > manual that corresponds to your MariaDB server version for the right syntax 
> > to use near '(pagesID, host, ref, location, useros, browser, visits) VALUES 
> > (1, '%cyta.gr%', ' at line 1")
> > 
> > which you can see at http://superhost.gr
> > 
> > You said somethign about concatenating the literal % in the SQL to which i 
> > didnt actually i understand how to implement.
> 
> I knew that I had a sense of deja vu about this 
> https://mail.python.org/pipermail/python-list/2013-June/649809.html
> 
> Kindest regards.
> 
> Mark Lawrence

Since i'm incopetent as you suggest i'am show us your level of skills and 
expertise and provide a solution, otherwise you are also what you claim of me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Mikhail V
On 26 March 2017 at 20:10, Steve D'Aprano  wrote:
> On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote:
>
> [...]
 And more important: can one use binary (bitmap) fonts in default modern
 linux console? If yes, can one patch them with custom tiles at
 the application start?
>>>
>>> If you really need something completely custom, it's not text any
>>> more.
>>
>> Obvious fact, but if I need e.g. rounded corners in table drawing
>> characters? Or I just want to fix some characters which look especially
>> ugly? Create a new TTF? No, thanks, this would be worst nightmare to
>> do without a special tool (which have prices with several zeros, otherwise
>> just don't work and can even break things system-wide)
>
> Don't be silly. It took me ten seconds on Google to find this:
>
> https://birdfont.org/
>

It takes you ten seconds to Google, and what if I ask you
to take, say Courier New font TTF file (which includes not only
vector information but all that is responsible for bitmap
rendering, subpixeling, etc), then edit one character (and
all corresponding information for subpixeling),
then compile it as a new font, then install it on Win,
without that making any conflicts, and without _any_
further glitches or changes in other characters, and no such
things across all applications.
If you'd try that, and you will succeed, _then_ I will publicly admit
that I was silly.

And paying even 50$ for correcting one glyph... well
probably I'll do it if one gives guarantee that all above
will work.

>
>>> More likely, you don't truly need something custom - what you need is
>>> a different subset of characters (maybe you need to mix Latin, Greek,
>>> and Hebrew letters, in order to show interlinear translation of the
>>> Bible). Instead of messing around with character sets, you can just
>>> use Unicode and have all of them available.
>>
>> If I was to deal with multiple language charsets in _my own_ rendering
>> app, I would still use discrete encoding for inner algorithms.
>> i.e. I would place separate charsets on separate code ranges.
>
> Why? Because you think you know better than the thousands of professionals
> who have worked with text formats for decades?

Sounds provocative, but yes, in some cases I know what I am
doing ;-).
But that is not because professionals does not know,
there are many other aspects which come in play here.
It depends on the use case, Unicode solves only some
problems.
I was talking only about _my own_ usage, it
will be obviously incompatible e.g. for copy-pasting
between othr apps.
There are benefits to store language-specific values (+ their glyphs)
in separate stacks.
Anyway this discussion will require concrete
examples and much deeper investigation.

>
>> And for own standalone app, I would not use any TTF or
>> anything vector-based font, since why?
>
> Right, because your users will *love* to see their native language displayed
> in a crappy bitmapped font with jagged or blurry edges.
>

I am working on text rendering algorithms an have prototyped
several bitmap-based text rendering algorithms,
both managed and prerendered approaches, and there
is _nothing_ jagged or [incorrectly] blurred there, when
one knows what he's doing of course.
So it would be _very_ hard to catch me on incompetence
here, but you can try, and feel free to do it :

FYI vector-based fonts were mainly motivated by print design.
Modern GPUs have capabilities for fast vector
glyph rendering, but it is not needed for screen rendering,
much less when higher DPI displays will prevale.

Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue19824] string.Template: Add PHP-style variable expansion example

2017-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Formatting with locals() and globals() should be used with careful. This is not 
the most idiomatic way of formatting. I think that the post in specialised blog 
would be better place for describing it than Python stdlib documentation.

Peoples coming from PHP world can use f-strings.

--
nosy: +serhiy.storchaka
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 10:04:31 μ.μ. UTC+3, ο χρήστης Chris Angelico 
έγραψε:
> On Mon, Mar 27, 2017 at 5:52 AM, Νίκος Βέργος  wrote:
> > Τη Κυριακή, 26 Μαρτίου 2017 - 9:32:13 μ.μ. UTC+3, ο χρήστης Chris Angelico 
> > έγραψε:
> >> On Mon, Mar 27, 2017 at 4:54 AM, Νίκος Βέργος  wrote:
> >> > Τη Κυριακή, 26 Μαρτίου 2017 - 8:06:07 μ.μ. UTC+3, ο χρήστης INADA Naoki 
> >> > έγραψε:
> >> >> Read my mail again.
> >> >>
> >> >> > This error came from MySQL.  If there are no logs in error_log, it's
> >> >> > your configuration issue.
> >> >>
> >> >> > See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update
> >> >> > statement syntax.
> >> >
> >> > I cannot understand where the error is.
> >> > Could you how it to me please?
> >>
> >> Are people paying you to run their servers, and you're not even
> >> prepared to spend a few minutes reading the documentation before
> >> firing another post to a newsgroup/mailing list with thousands of
> >> participants? (Actually, I have no idea how many people read
> >> python-list/clp - 10K? 100K? 1M?)
> >>
> >> ChrisA
> >
> > So the answer is within that url link and i cannot see it?!
> >
> > Give me a hint!
> 
> You cannot see it? Why not - are you unable to access the web? Then
> track down the equivalent local documentation. I don't have MySQL or
> MariaDB installed here, but with PostgreSQL, I can fire up the CLI and
> get documentation on SQL commands.
> 
> So no, I won't give you a hint until you get a clue.
> 
> ChrisA

I can see it Chris, but i just cannot "see" it.

If i remove the WHERE LIKE clause statement executes properly.

Its when adding the clause that does not interpolated correctly.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 5:52 AM, Νίκος Βέργος  wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 9:32:13 μ.μ. UTC+3, ο χρήστης Chris Angelico 
> έγραψε:
>> On Mon, Mar 27, 2017 at 4:54 AM, Νίκος Βέργος  wrote:
>> > Τη Κυριακή, 26 Μαρτίου 2017 - 8:06:07 μ.μ. UTC+3, ο χρήστης INADA Naoki 
>> > έγραψε:
>> >> Read my mail again.
>> >>
>> >> > This error came from MySQL.  If there are no logs in error_log, it's
>> >> > your configuration issue.
>> >>
>> >> > See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update
>> >> > statement syntax.
>> >
>> > I cannot understand where the error is.
>> > Could you how it to me please?
>>
>> Are people paying you to run their servers, and you're not even
>> prepared to spend a few minutes reading the documentation before
>> firing another post to a newsgroup/mailing list with thousands of
>> participants? (Actually, I have no idea how many people read
>> python-list/clp - 10K? 100K? 1M?)
>>
>> ChrisA
>
> So the answer is within that url link and i cannot see it?!
>
> Give me a hint!

You cannot see it? Why not - are you unable to access the web? Then
track down the equivalent local documentation. I don't have MySQL or
MariaDB installed here, but with PostgreSQL, I can fire up the CLI and
get documentation on SQL commands.

So no, I won't give you a hint until you get a clue.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 5:37 AM, eryk sun  wrote:
> On Sun, Mar 26, 2017 at 5:58 PM, Chris Angelico  wrote:
>>> The Windows console can render any character in the BMP, but it
>>> requires configuring font linking for fallback fonts. It's Windows, so
>>> of course the supported UTF format is UTF-16. The console's UTF-8
>>> support (codepage 65001) is too buggy to even consider using it.
>>
>> Is it actually UTF-16, or is it UCS-2?
>
> Pedantically speaking it's UCS-2. Console buffers aren't necessarily
> valid UTF-16, i.e. they can have lone surrogate codes or invalid
> surrogate pairs. The way a surrogate code gets rendered depends on the
> font. It could be an empty box, a box containing a question mark, or
> simply empty space. That applies even if it's a valid UTF-16 surrogate
> pair, so the console can't display non-BMP characters such as emojis.
> They can be copied to the clipboard and displayed in another program.

Exactly. So it's not supporting the entire Unicode range, but only the
BMP. That restricts its usability for anything other than simple text.

> Windows file systems are also UCS-2. For the most part it's not an
> issue since the source of text and filenames will be valid UTF-16.

I'm actually not sure on that one. Poking around on both Stack
Overflow and MSDN suggests that NTFS does actually use UTF-16, which
implies that lone surrogates should be errors, but I haven't proven
this. In any case, file system encoding is relatively immaterial; it's
file system *API* encoding that matters, and that means the
CreateFileW function and its friends:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/gg269344(v=exchg.10).aspx

My reading of this is that:

a) The API is defined in terms of the WCHAR type, a 16-bit code unit.
b) Limits are described in terms of "characters" (eg a max of 32767
for a path that starts "\\?\")
c) ???
d) Profit??

I *think* it's the naive (and very common) hybrid of UCS-2 and UTF-16
that says "surrogates are allowed anywhere, and you're allowed to
interpret pairs of them as UTF-16". But that's not a standard
encoding. In actual UCS-2, surrogates are entirely disallowed; in
UTF-16, they *must* be correctly paired.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 8:58:55 μ.μ. UTC+3, ο χρήστης alister έγραψε:
> On Sun, 26 Mar 2017 07:43:51 -0700, Νίκος Βέργος wrote:
> 
> > Τη Κυριακή, 26 Μαρτίου 2017 - 5:38:57 μ.μ. UTC+3, ο χρήστης alister
> > έγραψε:
> >> On Sun, 26 Mar 2017 07:24:49 -0700, Νίκος Βέργος wrote:
> >> 
> >> > Τη Κυριακή, 26 Μαρτίου 2017 - 5:19:27 μ.μ. UTC+3, ο χρήστης Ian
> >> > έγραψε:
> >> > 
> >> >> You need to change the placeholders back. The poster who told you to
> >> >> replace them was misinformed.
> >> > 
> >> > okey altered them back to
> >> > 
> >> > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location,
> >> > useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE
> >> > host LIKE "%%s%" ''',
> >> > 
> >> > 
> >> (pID, domain, ref, location, useros,
> >> > 
> >> > 
> >> browser, lastvisit, domain) )
> >> > 
> >> > but now the problem is how to exact;y type the Where HOST like "%%%"
> >> > 
> >> > I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character.
> >> 
> >> 
> >> as a quick thought (untested) it is probably best to have %s as your
> >> parameter for the Like clause & ad the sql wild-cards (% symbols) to
> >> the data you pass in as I think the expansion of %s adds quote marks
> >> which will certainly cause the sql parser issues.
> > 
> > How do you propose writing that cur.execute statement Alister?
> 
> 
> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location,
> >> > useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE
> >> > host LIKE %s '''
> 
> but you will need to amend the data  you pass so that the last element 
> has the surrounding % characters .
> 
> 
> -- 
> T-1's congested due to porn traffic to the news server.

i have done so ith 3 different ways to prepare the string before sending it as 
an argument to update query as i mentioned in a previous post.

Unfortunately all 3 ways weren't able to make the query work.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 9:32:13 μ.μ. UTC+3, ο χρήστης Chris Angelico 
έγραψε:
> On Mon, Mar 27, 2017 at 4:54 AM, Νίκος Βέργος  wrote:
> > Τη Κυριακή, 26 Μαρτίου 2017 - 8:06:07 μ.μ. UTC+3, ο χρήστης INADA Naoki 
> > έγραψε:
> >> Read my mail again.
> >>
> >> > This error came from MySQL.  If there are no logs in error_log, it's
> >> > your configuration issue.
> >>
> >> > See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update
> >> > statement syntax.
> >
> > I cannot understand where the error is.
> > Could you how it to me please?
> 
> Are people paying you to run their servers, and you're not even
> prepared to spend a few minutes reading the documentation before
> firing another post to a newsgroup/mailing list with thousands of
> participants? (Actually, I have no idea how many people read
> python-list/clp - 10K? 100K? 1M?)
> 
> ChrisA

So the answer is within that url link and i cannot see it?!

Give me a hint!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread breamoreboy
On Sunday, March 26, 2017 at 3:11:50 PM UTC+1, Ian wrote:
> On Sun, Mar 26, 2017 at 7:39 AM, MeV wrote:
> > On Sunday, March 26, 2017 at 6:34:30 AM UTC-7, Νίκος Βέργος wrote:
> >> with import cgitb; cgitb.enable()
> >>
> >> ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> >> manual that corresponds to your MariaDB server version for the right 
> >> syntax to use near '(pagesID, host, ref, location, useros, browser, 
> >> visits) VALUES (1, 'cyta.gr', '' at line 1")
> >>
> >> that is all i get form error. error_log doesnt produce errors when iam 
> >> trying
> >>
> >> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> >> browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE %s''',
> >>
> >>
> >>
> >>  (pID, domain, ref, 
> >> location, useros, browser, lastvisit, domain) )
> >>
> >> WHY the valued aren't getting substituted wi the aeguments i give it in to 
> >> work with?
> >
> > The % construct is Python 2 and no longer supported in Python 3. You should 
> > read up on the "{}" and format method.
> >
> > https://docs.python.org/3/tutorial/inputoutput.html#fancier-output-formatting
> 
> Rubbish, it works just fine in Python 3:
> 
> Python 3.6.0 (default, Jan  1 2017, 22:51:19)
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> '%s %s' % ('Hello', 'world')
> 'Hello world'
> 
> And contrary to popular belief, it's not even deprecated (although use
> of the newer format method is encouraged). What's more, in this case
> it's part of the PEP 249 DBAPI specification:
> https://www.python.org/dev/peps/pep-0249/#paramstyle. As far as I know
> pymysql and DBAPI libraries in general don't even accept "{}".

There was quite a chat about the issue of deprecated or not 
http://www.gossamer-threads.com/lists/python/dev/969817

Kindest regards.

Mark Lawrence.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 5:49 PM, eryk sun  wrote:
> On Sun, Mar 26, 2017 at 5:29 PM, Chris Angelico  wrote:
>> Rounded corners?
>>
>> ╭─┬─╮
>> ├─┼─┤
>> ╰─┴─╯
>
> This prints fine in the Windows console with Consolas as the font, but
> the older Courier New and Lucida Console fonts lack glyphs for the
> rounded corners.

I configured Consolas as a fallback for Lucida Console, and now it
shows the rounded corners in the console, but it beats me why anyone
would do that instead of simply using Consolas.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 5:58 PM, Chris Angelico  wrote:
>> The Windows console can render any character in the BMP, but it
>> requires configuring font linking for fallback fonts. It's Windows, so
>> of course the supported UTF format is UTF-16. The console's UTF-8
>> support (codepage 65001) is too buggy to even consider using it.
>
> Is it actually UTF-16, or is it UCS-2?

Pedantically speaking it's UCS-2. Console buffers aren't necessarily
valid UTF-16, i.e. they can have lone surrogate codes or invalid
surrogate pairs. The way a surrogate code gets rendered depends on the
font. It could be an empty box, a box containing a question mark, or
simply empty space. That applies even if it's a valid UTF-16 surrogate
pair, so the console can't display non-BMP characters such as emojis.
They can be copied to the clipboard and displayed in another program.

Windows file systems are also UCS-2. For the most part it's not an
issue since the source of text and filenames will be valid UTF-16.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 4:54 AM, Νίκος Βέργος  wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 8:06:07 μ.μ. UTC+3, ο χρήστης INADA Naoki 
> έγραψε:
>> Read my mail again.
>>
>> > This error came from MySQL.  If there are no logs in error_log, it's
>> > your configuration issue.
>>
>> > See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update
>> > statement syntax.
>
> I cannot understand where the error is.
> Could you how it to me please?

Are people paying you to run their servers, and you're not even
prepared to spend a few minutes reading the documentation before
firing another post to a newsgroup/mailing list with thousands of
participants? (Actually, I have no idea how many people read
python-list/clp - 10K? 100K? 1M?)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 5:10 AM, Steve D'Aprano
 wrote:
>> And for own standalone app, I would not use any TTF or
>> anything vector-based font, since why?
>
> Right, because your users will *love* to see their native language displayed
> in a crappy bitmapped font with jagged or blurry edges.

Side point: I have spent many hours wrestling with VLC to try to get a
subtitles font that looks good for all the world's languages. My
current setup has Latin, Cyrillic, and Greek looking great, Hebrew and
Arabic looking adequate (I'm no expert so I don't know beyond that),
but Thai, Chinese, Japanese, and Korean characters have jagged edges.
Thanks guys. It's 2017 and we're still using bitmap fonts.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue12414] getsizeof() on code objects is wrong

2017-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See gettotalsizeof.py attached to issue19048. It contains two functions that 
calculates the total size of the object with subobjects recursively. The 
problem is that virtually all objects are linked, two functions use slightly 
different criteria for stopping.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 4:43 AM, Steve D'Aprano
 wrote:
> On Mon, 27 Mar 2017 02:37 am, Chris Angelico wrote:
>
>> Just use Unicode. Everything else, these days, is a subset of Unicode
>> anyway. Unless you're stuck on the default Windows shell/terminal, you
>> should be able to use UTF-8 everywhere and have the entire Unicode
>> range available. For example, the IBM OEM box-drawing characters are
>> available in Code Page 437... or as Unicode code points in the U+25xx
>> range.
>
> You are absolutely correct in theory, but in practice the availability of
> glyphs in most fonts is only a tiny proportion of the Unicode range. And
> even when the glyphs are available, the quality often varies: for example,
> in all of the monospaced fonts I've looked at, the superscripts ¹²³ are a
> different size to ⁴⁵⁶⁷⁸⁹⁰, both vertically and horizontally. And I've come
> across a few fonts where the box drawing characters don't all line up.
>
> Don't misunderstand me: Unicode is a HUGE improvement over the Bad Old Days
> of dozens of incompatible character sets. But let's not pretend that it
> makes it *easy*.

Unicode makes it about as easy as it can possibly be, given the
diversity of human languages and their various needs, plus the reality
that nobody has infinite resources for creating fonts. The most
important thing is that you have a single universal specification that
governs the interpretation of text, which means you can aim for that
standard, and if a renderer doesn't match up to it, that's a bug that
can be fixed, not behaviour that has to be maintained for backward
compatibility. So, for instance, Eryk Sun commented that my rounded
box example didn't render correctly in all fonts - but in the future,
a new version of those fonts could be released, adding support for
those characters. We *know* that the code points I used are
permanently and irrevocably allocated to the purposes I used them for,
so we can all be confident that they'll be used correctly if at all.

>>> And more important: can one use binary (bitmap) fonts in default modern
>>> linux console? If yes, can one patch them with custom tiles at
>>> the application start?
>>
>> If you really need something completely custom, it's not text any
>> more.
>
> That's not quite right. Unicode includes 137000 or so Private Use
> Characters, which anyone can define for their own purposes, "by private
> agreement". There's an unofficial registry of such private use characters
> here:
>
> http://www.evertype.com/standards/csur/
>
> More info here:
>
> https://en.wikipedia.org/wiki/Private_Use_Areas

This is true, but at some point, it's not text any more. The PUAs are
great if you're working with non-standard forms of text (eg Klingon,
or Elvish), but aren't well suited to arbitrary graphics. You should
be able to copy and paste text from one application into another and
have it retain its meaning; the PUAs weaken this guarantee in that the
applications have to agree to coexist, but within that, the same
ability to copy and paste should hold. It sounds like Mikhail is
trying to warp the console into something pseudo-graphical like a
Roguelike game, but instead of designing the game around available
glyphs, wants to design the glyphs to suit the game - and at that
point, it's time to just go graphical, IMO.

>> More likely, you don't truly need something custom - what you need is
>> a different subset of characters (maybe you need to mix Latin, Greek,
>> and Hebrew letters, in order to show interlinear translation of the
>> Bible). Instead of messing around with character sets, you can just
>> use Unicode and have all of them available.
>
> Assuming you have a text widget which is capable of displaying LTR and RTL
> text, and support for all the glyphs you need.

This is true. Fortunately, some measure of this is available in all
the major GUI toolkits, although some applications need to have their
own handling too. But here's what it takes to have full Unicode
support in my MUD client:

1) Use GTK and Pango. That's the biggest part.
2) Due to the nature of MUDs, RTL text is still left-justified.
3) Due to the interaction of left-justified RTL text and indentation,
special handling is needed for lines that begin with spaces and/or
tabs and then an RTL character. (Solution: Prepend U+200E
LEFT-TO-RIGHT MARK.)
4) Individual lines may be painted in multiple colours, so the text
gets divided up and measured in pieces. I let Pango do the actual
measurements.

That's about it. Basically I just let Pango do all the heavy lifting;
if it says this text in this font takes up this many pixels, that's
how many pixels of width I allocate it. RTL? LTR? Mixed? No problem.
It'll do all that for me.

So yeah. Unicode isn't a panacea, and if you come from an ASCII-only
environment, Unicode will look hard - but it's making life far easier
than the alternatives would be.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29908] Inconsistent crashing with an access violation

2017-03-26 Thread Cameron Mckain

Cameron Mckain added the comment:

C:\Users\cmcka\PycharmProjects\test>wevtutil qe application /rd:true /c:1 
/format:text /q:"*[System[Provider[@Name='Application 
Error']]][EventData[Data='python.exe'][Data='ucrtbase.dll']]"
Event[0]:
  Log Name: Application
  Source: Application Error
  Date: 2017-03-26T01:46:20.230
  Event ID: 1000
  Task: Application Crashing Events
  Level: Error
  Opcode: Info
  Keyword: Classic
  User: N/A
  User Name: N/A
  Computer: CAMERON-OMEN
  Description:
Faulting application name: python.exe, version: 3.6.1150.1013, time stamp: 
0x58d169bd
Faulting module name: ucrtbase.dll, version: 10.0.14393.0, time stamp: 
0x57898db2
Exception code: 0xc005
Fault offset: 0x0003bd9e
Faulting process id: 0x4464
Faulting application start time: 0x01d2a60d6fdf23d2
Faulting application path: C:\Python36\python.exe
Faulting module path: C:\windows\System32\ucrtbase.dll
Report Id: 109058c0-4e02-4bb6-a799-d6a975fe0d6f
Faulting package full name:
Faulting package-relative application ID:

This is from Python's faulthandler as well:
Windows fatal exception: access violation

Thread 0x44b0 (most recent call first):
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\pydevd.py",
 line 96 in _on_run
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\_pydevd_bundle\pydevd_comm.py",
 line 291 in run
  File "C:\Python36\lib\threading.py", line 916 in _bootstrap_inner
  File "C:\Python36\lib\threading.py", line 884 in _bootstrap

Thread 0x44ac (most recent call first):
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\_pydevd_bundle\pydevd_comm.py",
 line 353 in _on_run
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\_pydevd_bundle\pydevd_comm.py",
 line 291 in run
  File "C:\Python36\lib\threading.py", line 916 in _bootstrap_inner
  File "C:\Python36\lib\threading.py", line 884 in _bootstrap

Thread 0x39d4 (most recent call first):
  File "C:\Python36\lib\threading.py", line 299 in wait
  File "C:\Python36\lib\queue.py", line 173 in get
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\_pydevd_bundle\pydevd_comm.py",
 line 430 in _on_run
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\_pydevd_bundle\pydevd_comm.py",
 line 291 in run
  File "C:\Python36\lib\threading.py", line 916 in _bootstrap_inner
  File "C:\Python36\lib\threading.py", line 884 in _bootstrap

Current thread 0x446c (most recent call first):
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\_pydev_bundle\pydev_monkey.py",
 line 380 in new_spawnve
  File "C:\Python36\lib\site-packages\django\utils\autoreload.py", line 290 in 
restart_with_reloader
  File "C:\Python36\lib\site-packages\django\utils\autoreload.py", line 304 in 
python_reloader
  File "C:\Python36\lib\site-packages\django\utils\autoreload.py", line 333 in 
main
  File 
"C:\Python36\lib\site-packages\django\core\management\commands\runserver.py", 
line 106 in run
  File 
"C:\Python36\lib\site-packages\django\core\management\commands\runserver.py", 
line 97 in handle
  File "C:\Python36\lib\site-packages\django\core\management\base.py", line 345 
in execute
  File 
"C:\Python36\lib\site-packages\django\core\management\commands\runserver.py", 
line 58 in execute
  File "C:\Python36\lib\site-packages\django\core\management\base.py", line 294 
in run_from_argv
  File "C:\Python36\lib\site-packages\django\core\management\__init__.py", line 
359 in execute
  File "C:\Python36\lib\site-packages\django\core\management\__init__.py", line 
367 in execute_from_command_line
  File "C:/Users/cmcka/PycharmProjects/test/manage.py", line 22 in 
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\_pydev_imps\_pydev_execfile.py",
 line 18 in execfile
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\pydevd.py",
 line 1015 in run
  File 
"C:\Users\cmcka\AppData\Local\JetBrains\Toolbox\apps\PyCharm-P\ch-0\171.3780.115\helpers\pydev\pydevd.py",
 line 1578 in 

Process finished with exit code -1073741819 (0xC005)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Steve D'Aprano
On Mon, 27 Mar 2017 03:57 am, Mikhail V wrote:

[...]
>>> And more important: can one use binary (bitmap) fonts in default modern
>>> linux console? If yes, can one patch them with custom tiles at
>>> the application start?
>>
>> If you really need something completely custom, it's not text any
>> more.
> 
> Obvious fact, but if I need e.g. rounded corners in table drawing
> characters? Or I just want to fix some characters which look especially
> ugly? Create a new TTF? No, thanks, this would be worst nightmare to
> do without a special tool (which have prices with several zeros, otherwise
> just don't work and can even break things system-wide)

Don't be silly. It took me ten seconds on Google to find this:

https://birdfont.org/

It is no charge for an open source licence, or $5 USD for a commercial
licence. If that's too cheap, you can use FontCreator at just $79:

http://www.high-logic.com/font-editor/fontcreator.html



>> More likely, you don't truly need something custom - what you need is
>> a different subset of characters (maybe you need to mix Latin, Greek,
>> and Hebrew letters, in order to show interlinear translation of the
>> Bible). Instead of messing around with character sets, you can just
>> use Unicode and have all of them available.
> 
> If I was to deal with multiple language charsets in _my own_ rendering
> app, I would still use discrete encoding for inner algorithms.
> i.e. I would place separate charsets on separate code ranges.

Why? Because you think you know better than the thousands of professionals
who have worked with text formats for decades?


> And for own standalone app, I would not use any TTF or
> anything vector-based font, since why?

Right, because your users will *love* to see their native language displayed
in a crappy bitmapped font with jagged or blurry edges.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29911] Uninstall command line in Windows registry does not uninstall

2017-03-26 Thread Christian Ullrich

New submission from Christian Ullrich:

The Windows installation package registers a command line for uninstalling the 
package. Running this command line does not uninstall the package.

The command line ends with "/modify". For uninstallation, it should be 
"/passive /uninstall".

Windows provides for separate command lines for modifying and uninstalling 
packages to be set in the "Uninstall" subkey:

- ModifyPath: Command line for modifying the package
- UninstallString: Command line for removing the package

By setting both keys, the ARP control panel will display separate buttons for 
the two operations.

Having an uninstallation command line that does not do what it says, and in 
fact causes modal UI to be presented, also interferes with automated package 
management.

Ceterum censeo: This bug would have been avoided by using MSI as the 
distribution package format, because "msiexec /qn /x [ProductCode]" would have 
been correct regardless of what the registry says, and even if the registry 
does not say anything because the Uninstall key (as well as the uninstaller 
executable itself) were actually deleted months ago as part of some expired 
user profile. See bug #25166.

--
components: Windows
messages: 290544
nosy: Christian.Ullrich, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Uninstall command line in Windows registry does not uninstall
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Ned Deily added the comment:

Thanks for the pull requests!  I've merged to master, 3.6, and 3.5 and I left a 
comment for the 2.7 PR.  By the way, next time you make a PR, please feel free 
to add your name to Misc/ACKS.

--
stage:  -> commit review
versions: +Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread alister
On Sun, 26 Mar 2017 07:43:51 -0700, Νίκος Βέργος wrote:

> Τη Κυριακή, 26 Μαρτίου 2017 - 5:38:57 μ.μ. UTC+3, ο χρήστης alister
> έγραψε:
>> On Sun, 26 Mar 2017 07:24:49 -0700, Νίκος Βέργος wrote:
>> 
>> > Τη Κυριακή, 26 Μαρτίου 2017 - 5:19:27 μ.μ. UTC+3, ο χρήστης Ian
>> > έγραψε:
>> > 
>> >> You need to change the placeholders back. The poster who told you to
>> >> replace them was misinformed.
>> > 
>> > okey altered them back to
>> > 
>> > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location,
>> > useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE
>> > host LIKE "%%s%" ''',
>> > 
>> > 
>> (pID, domain, ref, location, useros,
>> > 
>> > 
>> browser, lastvisit, domain) )
>> > 
>> > but now the problem is how to exact;y type the Where HOST like "%%%"
>> > 
>> > I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character.
>> 
>> 
>> as a quick thought (untested) it is probably best to have %s as your
>> parameter for the Like clause & ad the sql wild-cards (% symbols) to
>> the data you pass in as I think the expansion of %s adds quote marks
>> which will certainly cause the sql parser issues.
> 
> How do you propose writing that cur.execute statement Alister?


cur.execute('''UPDATE visitors SET (pagesID, host, ref, location,
>> > useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE
>> > host LIKE %s '''

but you will need to amend the data  you pass so that the last element 
has the surrounding % characters .


-- 
T-1's congested due to porn traffic to the news server.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 4:38 AM, eryk sun  wrote:
> On Sun, Mar 26, 2017 at 3:37 PM, Chris Angelico  wrote:
>>
>> Just use Unicode. Everything else, these days, is a subset of Unicode
>> anyway. Unless you're stuck on the default Windows shell/terminal, you
>> should be able to use UTF-8 everywhere and have the entire Unicode
>> range available.
>
> The Windows console can render any character in the BMP, but it
> requires configuring font linking for fallback fonts. It's Windows, so
> of course the supported UTF format is UTF-16. The console's UTF-8
> support (codepage 65001) is too buggy to even consider using it.

Is it actually UTF-16, or is it UCS-2?

> I don't know why you mention the shell. It has nothing to do with
> this. But, for what it's worth, the cmd shell is a Unicode application
> and always has been. It use the console's wide-character API.

Because a lot of people on Windows don't understand the distinction,
and it's common to hear people talk about "cmd.exe" when they really
mean the graphical display. But I'm aware that pedantic correctness
separates them completely.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Ned Deily added the comment:


New changeset 8ce3085bf167b702989a9db466078b5676e825e3 by Ned Deily in branch 
'3.5':
bpo-29888: Fix the link referring to the "Python download page" (GH-824) 
(GH-827)
https://github.com/python/cpython/commit/8ce3085bf167b702989a9db466078b5676e825e3


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Ned Deily added the comment:


New changeset ceff32fb833e7be42508ffa73344e2e56865e54b by Ned Deily in branch 
'3.6':
bpo-29888: Fix the link referring to the "Python download page" (GH-824) 
(GH-826)
https://github.com/python/cpython/commit/ceff32fb833e7be42508ffa73344e2e56865e54b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 8:06:07 μ.μ. UTC+3, ο χρήστης INADA Naoki έγραψε:
> Read my mail again.
> 
> > This error came from MySQL.  If there are no logs in error_log, it's
> > your configuration issue.
> 
> > See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update
> > statement syntax.

I cannot understand where the error is.
Could you how it to me please?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installation issue with Python 3.6.1 for 64 bit Windows

2017-03-26 Thread Arjun Janah
Thank you, Eryk Sun.

On Mar 26, 2017 12:40 PM, "eryk sun"  wrote:

> On Sun, Mar 26, 2017 at 4:01 AM, arjun.janah 
> wrote:
> >
> > I ran the file and it appeared to install properly. But when I tried to
> run Python from
> > the Windows All Programs menu tab, I got the following message, in a
> small
> > window by the window with a black screen:
> > --
> > python.exe - System Error
> > The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is
> missing from
> > your computer. Try reinstalling the program to fix this problem.
> >
> > I tried the following:
> >
> > (a) restarting Windows and trying again: same result;
> >
> > (a) running the installer file again and selecting repair:
> > this stalled for a long time so I had to abort it;
> >
> > (b) restarting my computer, running the installer file again and
> selecting uninstall:
> > this uninstalled Python, so it said;
> >
> > (c) running the installer file again and choosing install: this
> installed Python afresh.
> > But then I had the same problem as at the start when I tried to run
> Python.
>
> Python's installer should try to install the Universal C runtime
> update, but this seems to fail frequently. If you want to help improve
> the installer, zip up Python's installation logs that are in your
> %Temp% directory to a single zip file; open an issue on
> bugs.python.org; and attach the zip file to the issue.
>
> You probably didn't get the CRT update from Windows Update because you
> don't have the option enabled to install recommended updates. Anyway,
> you can manually download and install Windows6.1-KB3118401-x64.msu
> (the 64-bit version for NT 6.1, i.e. Windows 7) from the following
> site:
>
> https://www.microsoft.com/en-us/download/details.aspx?id=50410
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 5:29 PM, Chris Angelico  wrote:
> Rounded corners?
>
> ╭─┬─╮
> ├─┼─┤
> ╰─┴─╯

This prints fine in the Windows console with Consolas as the font, but
the older Courier New and Lucida Console fonts lack glyphs for the
rounded corners.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Changes by Ned Deily :


--
pull_requests: +733

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Steve D'Aprano
On Mon, 27 Mar 2017 02:37 am, Chris Angelico wrote:

> On Mon, Mar 27, 2017 at 2:17 AM, Mikhail V  wrote:
 Why? IIRC I can do good pseudographics on linux only with extended
 unicode character sets, so yes it is possible, is that what you mean?
>>>
>>> No.  The same ASCII character set that was available in DOS is
>>> available in Linux without unicode.
>>
>> Ok, now I have read that one can change the encoding in the terminal
>> to get same table drawing characters (if one does not want to use
>> unicode).
> 
> Just use Unicode. Everything else, these days, is a subset of Unicode
> anyway. Unless you're stuck on the default Windows shell/terminal, you
> should be able to use UTF-8 everywhere and have the entire Unicode
> range available. For example, the IBM OEM box-drawing characters are
> available in Code Page 437... or as Unicode code points in the U+25xx
> range.

You are absolutely correct in theory, but in practice the availability of
glyphs in most fonts is only a tiny proportion of the Unicode range. And
even when the glyphs are available, the quality often varies: for example,
in all of the monospaced fonts I've looked at, the superscripts ¹²³ are a
different size to ⁴⁵⁶⁷⁸⁹⁰, both vertically and horizontally. And I've come
across a few fonts where the box drawing characters don't all line up.

Don't misunderstand me: Unicode is a HUGE improvement over the Bad Old Days
of dozens of incompatible character sets. But let's not pretend that it
makes it *easy*.



[...]
>> And more important: can one use binary (bitmap) fonts in default modern
>> linux console? If yes, can one patch them with custom tiles at
>> the application start?
> 
> If you really need something completely custom, it's not text any
> more. 

That's not quite right. Unicode includes 137000 or so Private Use
Characters, which anyone can define for their own purposes, "by private
agreement". There's an unofficial registry of such private use characters
here:

http://www.evertype.com/standards/csur/

More info here:

https://en.wikipedia.org/wiki/Private_Use_Areas



> For example, suppose you redefine all the character images, and 
> then someone copies and pastes into a web browser - can they search
> the web for the characters you're displaying, and will they mean the
> same things? If you've redefined images arbitrarily, they won't.
> 
> More likely, you don't truly need something custom - what you need is
> a different subset of characters (maybe you need to mix Latin, Greek,
> and Hebrew letters, in order to show interlinear translation of the
> Bible). Instead of messing around with character sets, you can just
> use Unicode and have all of them available.

Assuming you have a text widget which is capable of displaying LTR and RTL
text, and support for all the glyphs you need.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Changes by Ned Deily :


--
pull_requests: +732

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 3:37 PM, Chris Angelico  wrote:
>
> Just use Unicode. Everything else, these days, is a subset of Unicode
> anyway. Unless you're stuck on the default Windows shell/terminal, you
> should be able to use UTF-8 everywhere and have the entire Unicode
> range available.

The Windows console can render any character in the BMP, but it
requires configuring font linking for fallback fonts. It's Windows, so
of course the supported UTF format is UTF-16. The console's UTF-8
support (codepage 65001) is too buggy to even consider using it.

I don't know why you mention the shell. It has nothing to do with
this. But, for what it's worth, the cmd shell is a Unicode application
and always has been. It use the console's wide-character API.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29888] The link referring to "Python download page" is broken

2017-03-26 Thread Ned Deily

Ned Deily added the comment:


New changeset f8beb9831acd5cf80b9c56aea5864e16118c5400 by Ned Deily (cocoatomo) 
in branch 'master':
bpo-29888: Fix the link referring to the "Python download page" (GH-824)
https://github.com/python/cpython/commit/f8beb9831acd5cf80b9c56aea5864e16118c5400


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 3:57 AM, Mikhail V  wrote:
> On 26 March 2017 at 17:37, Chris Angelico  wrote:
>> On Mon, Mar 27, 2017 at 2:17 AM, Mikhail V  wrote:
> Why? IIRC I can do good pseudographics on linux only with extended
> unicode character sets, so yes it is possible, is that what you mean?

 No.  The same ASCII character set that was available in DOS is
 available in Linux without unicode.
>>>
>>> Ok, now I have read that one can change the encoding in the terminal
>>> to get same table drawing characters (if one does not want to use
>>> unicode).
>>
>> Just use Unicode. Everything else, these days, is a subset of Unicode
>> anyway. Unless you're stuck on the default Windows shell/terminal, you
>> should be able to use UTF-8 everywhere and have the entire Unicode
>> range available.
>
> Yes I am 'stuck' on Windows console, and I use it for what it is
> made for - running command line tools.

Not really stuck; even if you can't get off Windows, you should be
able to move off the ancient terminal that you get by default.

> On Win 7 and 10, I can see UTF-8 chars everywhere.
> To be precise, to see entire range of chars, you need a _font_
> in which someone have drawn those chars according to their
> understanding how those glyphs must look, nothing more.

Duh? If you want characters to display, you need a font yes...?

> No need to say, that even for text only, monospaced cannot
> represent them even close to satisfying, and for Arabic for example they
> look ass ugly in monospaced.
> IOW, even a console-like apps would use proportional fonts in the future.

Arabic text is written right-to-left. It's a lot more complicated than
just whether your font is monospaced or not, particularly when you mix
strongly-directional characters, weakly-directional characters,
non-directional characters, and explicit directionality markers. If
you mix RTL and LTR text, is the RTL text aligned to the right of the
page, or the left? There is a LOT more than just your font to take
care of here. If you want perfect handling of international text, you
basically need to use a Unicode-compliant text renderer - and
fortunately, most graphical engines these days come with exactly that.

>>> And more important: can one use binary (bitmap) fonts in default modern
>>> linux console? If yes, can one patch them with custom tiles at
>>> the application start?
>>
>> If you really need something completely custom, it's not text any
>> more.
>
> Obvious fact, but if I need e.g. rounded corners in table drawing
> characters? Or I just want to fix some characters which look especially ugly?
> Create a new TTF? No, thanks, this would be worst nightmare to
> do without a special tool (which have prices with several zeros, otherwise
> just don't work and can even break things system-wide)

Rounded corners?

╭─┬─╮
├─┼─┤
╰─┴─╯

A good font should show this as a rounded box with cross-lines through
it. The characters here are:

U+256D BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
U+2500 BOX DRAWINGS LIGHT HORIZONTAL
U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
U+2500 BOX DRAWINGS LIGHT HORIZONTAL
U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT
U+000A LINE FEED
U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT
U+2500 BOX DRAWINGS LIGHT HORIZONTAL
U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
U+2500 BOX DRAWINGS LIGHT HORIZONTAL
U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT
U+000A LINE FEED
U+2570 BOX DRAWINGS LIGHT ARC UP AND RIGHT
U+2500 BOX DRAWINGS LIGHT HORIZONTAL
U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL
U+2500 BOX DRAWINGS LIGHT HORIZONTAL
U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT
U+000A LINE FEED

And if you think that some characters look ugly, you can create a font
with just those characters in it. Thanks to font substitution, your
font should be used for the characters it defines, but anything it
doesn't will fall back on some other font, so you don't have to create
representations for hundreds of thousands of Unicode characters.

>> More likely, you don't truly need something custom - what you need is
>> a different subset of characters (maybe you need to mix Latin, Greek,
>> and Hebrew letters, in order to show interlinear translation of the
>> Bible). Instead of messing around with character sets, you can just
>> use Unicode and have all of them available.
>
> If I was to deal with multiple language charsets in _my own_ rendering
> app, I would still use discrete encoding for inner algorithms.
> i.e. I would place separate charsets on separate code ranges.
> And for own standalone app, I would not use any TTF or
> anything vector-based font, since why?

Separate code ranges? You mean like allocating U+03xx to Greek, U+04xx
to Cyrillic (Russian and friends), U+06xx to Arabic, etc? Sounds like
a good plan

>> Yeah; if my memory serves me, this was an IBM BIOS feature, so all
>> versions of DOS would be equally able to do it. But it's basically a
>> form of 

[issue29910] Ctrl-D eats a character on IDLE

2017-03-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +731

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29910] Ctrl-D eats a character on IDLE

2017-03-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Ctrl-D is binded to commenting out a block in IDLE. But additionally it deletes 
the first character of the line after the block. The default binding of Ctrl-D 
in Text widget is deleting a character under cursor. IDLE first comment out 
selected block, and after that runs the default handler.

Proposed patch fixes this issue and presumably other potential conflicts with 
default bindings. It just adds `return "break"` at the end of most event 
handlers.

--
assignee: terry.reedy
components: IDLE
messages: 290539
nosy: serhiy.storchaka, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Ctrl-D eats a character on IDLE
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
I do not see why my UPDATE fails.

cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros,
browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s)''') works

i dont have to update table set column1 = this value, column2=that value
and so on

It's just when the LIKE clause jumps in that is causing all this trouble

How would you write it?!

Στις Κυρ, 26 Μαρ 2017 στις 8:05 μ.μ., ο/η INADA Naoki <
songofaca...@gmail.com> έγραψε:

> Read my mail again.
>
> > This error came from MySQL.  If there are no logs in error_log, it's
> > your configuration issue.
>
> > See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update
> > statement syntax.
>
-- 
What is now proved was at first only imagined!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread INADA Naoki
Read my mail again.

> This error came from MySQL.  If there are no logs in error_log, it's
> your configuration issue.

> See https://dev.mysql.com/doc/refman/5.7/en/update.html for Update
> statement syntax.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Any ideas on how to make progress on that?

After all its just an UPDATE with a WHERE clause?!
Do you also think is DBI related issue?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Mikhail V
On 26 March 2017 at 17:37, Chris Angelico  wrote:
> On Mon, Mar 27, 2017 at 2:17 AM, Mikhail V  wrote:
 Why? IIRC I can do good pseudographics on linux only with extended
 unicode character sets, so yes it is possible, is that what you mean?
>>>
>>> No.  The same ASCII character set that was available in DOS is
>>> available in Linux without unicode.
>>
>> Ok, now I have read that one can change the encoding in the terminal
>> to get same table drawing characters (if one does not want to use
>> unicode).
>
> Just use Unicode. Everything else, these days, is a subset of Unicode
> anyway. Unless you're stuck on the default Windows shell/terminal, you
> should be able to use UTF-8 everywhere and have the entire Unicode
> range available.

Yes I am 'stuck' on Windows console, and I use it for what it is
made for - running command line tools.
On Win 7 and 10, I can see UTF-8 chars everywhere.
To be precise, to see entire range of chars, you need a _font_
in which someone have drawn those chars according to their
understanding how those glyphs must look, nothing more.

No need to say, that even for text only, monospaced cannot
represent them even close to satisfying, and for Arabic for example they
look ass ugly in monospaced.
IOW, even a console-like apps would use proportional fonts in the future.


>
>> But such a question: can one do it programmaticaly?
>
> Set everything to UTF-8 and you don't have to.
>
>> And more important: can one use binary (bitmap) fonts in default modern
>> linux console? If yes, can one patch them with custom tiles at
>> the application start?
>
> If you really need something completely custom, it's not text any
> more.

Obvious fact, but if I need e.g. rounded corners in table drawing
characters? Or I just want to fix some characters which look especially ugly?
Create a new TTF? No, thanks, this would be worst nightmare to
do without a special tool (which have prices with several zeros, otherwise
just don't work and can even break things system-wide)

>
> More likely, you don't truly need something custom - what you need is
> a different subset of characters (maybe you need to mix Latin, Greek,
> and Hebrew letters, in order to show interlinear translation of the
> Bible). Instead of messing around with character sets, you can just
> use Unicode and have all of them available.

If I was to deal with multiple language charsets in _my own_ rendering
app, I would still use discrete encoding for inner algorithms.
i.e. I would place separate charsets on separate code ranges.
And for own standalone app, I would not use any TTF or
anything vector-based font, since why?

>
>> In DOS, (I don't remember if in all versions or only some)
>> one could do all this and this opens very rich possibilities for
>> approximating of objects with tiles. The only limitations
>> that one uses 255 tiles, but even this enables to build
>> whole 'worlds' and state of the art apps. So I would call this
>> pseudographics and not few sticks and corner tiles
>> (which I cannot even define and upload easily).
>
> Yeah; if my memory serves me, this was an IBM BIOS feature, so all
> versions of DOS would be equally able to do it. But it's basically a
> form of tile graphics, not text. Given how easily graphical programs
> can be built these days, I would strongly recommend that, rather than
> abusing pseudo-text as pseudo-graphics. Pick up Tk or GTK or wxWindows
> or something, or build your app to run in a web browser, or something
> like that.

Exactly, that is why I do so, and even if one wants to play around
with console hacking, there is not so many documented
ways to do it. In Windows, I can manually select raster fonts,
so in pure theory, one could hack it with custom tiles, but
since it is much easier to use a graphical library today,
too few people are interested in it.

Mikhail
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installation issue with Python 3.6.1 for 64 bit Windows

2017-03-26 Thread eryk sun
On Sun, Mar 26, 2017 at 4:01 AM, arjun.janah  wrote:
>
> I ran the file and it appeared to install properly. But when I tried to run 
> Python from
> the Windows All Programs menu tab, I got the following message, in a small
> window by the window with a black screen:
> --
> python.exe - System Error
> The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing 
> from
> your computer. Try reinstalling the program to fix this problem.
>
> I tried the following:
>
> (a) restarting Windows and trying again: same result;
>
> (a) running the installer file again and selecting repair:
> this stalled for a long time so I had to abort it;
>
> (b) restarting my computer, running the installer file again and selecting 
> uninstall:
> this uninstalled Python, so it said;
>
> (c) running the installer file again and choosing install: this installed 
> Python afresh.
> But then I had the same problem as at the start when I tried to run Python.

Python's installer should try to install the Universal C runtime
update, but this seems to fail frequently. If you want to help improve
the installer, zip up Python's installation logs that are in your
%Temp% directory to a single zip file; open an issue on
bugs.python.org; and attach the zip file to the issue.

You probably didn't get the CRT update from Windows Update because you
don't have the option enabled to install recommended updates. Anyway,
you can manually download and install Windows6.1-KB3118401-x64.msu
(the 64-bit version for NT 6.1, i.e. Windows 7) from the following
site:

https://www.microsoft.com/en-us/download/details.aspx?id=50410
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29909] types.coroutine monkey patches original function

2017-03-26 Thread Yury Selivanov

Yury Selivanov added the comment:

Yeah, we can fix this. However, I don't want to push the fix to 3.6, too much 
code uses this function now. So it's going to be 3.7 only.

--
assignee:  -> yselivanov
versions: +Python 3.7 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Joel Goldstick
On Sun, Mar 26, 2017 at 11:48 AM, Νίκος Βέργος  wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 6:39:01 μ.μ. UTC+3, ο χρήστης Steve D'Aprano 
> έγραψε:
>> On Mon, 27 Mar 2017 02:11 am, Νίκος Βέργος wrote:
>>
>> > I just tried:
>> >
>> > domain = '.'.join( host.split('.')[-2:] )
>> > domain = '%' + domain + '%'
>> >
>> > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros,
>> > browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"
>> > ''', (pID, domain, ref, location, useros, browser, lastvisit, domain) )
>> >
>> > and i received no error in the error_log but
>> > ProgrammingError(1064, "You have an error in your SQL syntax; check the
>> > manual that corresponds to your MariaDB server version for the right
>> > syntax to use near '(pagesID, host, ref, location, useros, browser,
>> > visits) VALUES (1, '%cyta.gr%', ' at line 1")
>>
>> Start by following the instructions given:
>>
>> check the manual that corresponds to your MariaDB server version
>> for the right syntax to use
>>
>> just like the error message tells you to do.
>>
>> Are you sure that the domain needs to have leading and trailing percentage
>> signs? "%cyta.gr%" instead of "cyta.gr"?
>>
>> Are you sure that the LIKE clause needs double quotes?
>>
>> LIKE "%s"
>>
>> Perhaps MariaDB requires single quotes:
>>
>> LIKE '%s'
>>
>> or perhaps no quotes at all:
>>
>> LIKE %s
>>
>>
>> But I'm just guessing, because I haven't read the MariaDB manual. You should
>> do so.
>>
>>
>> > which you can see at http://superhost.gr
>>
>> Ah, Nikos, its been a long time! I thought I recognised your style of
>> posting.

Not long enough!
>
>
> Howdy Steve!
> Yes its me and yes its have been a long time! How are you?!
>
> Yeap still trying to make my webiste better and better every day.
>
> As for MariaDB i tried with single/double/no_quoting at all and it still 
> produces
> ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> manual that corresponds to your MariaDB server version for the right syntax 
> to use near '(pagesID, host, ref, location, useros, browser, visits) VALUES 
> (1, 'cyta.gr', '' at line 1")
>
> I think that Ian Kelly is right and it has soemthign to do with the databse 
> wrapper not substituting properly the actual string contain in the LIKE 
> clause between the double quotes.
>
> Perhaps i need to change pymysql with some other database interface or there 
> is something other than that?
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Currently to avoid any misinformations my code looks as follows:

domain = '.'.join( host.split('.')[-2:] )
domain_query = '%%%s' % domain

cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE %s''', 
(pID, domain, ref, location, useros, browser, lastvisit, domain_query) )

which as i saiddisplays no error in the error_log output just the 

ProgrammingError(1064, "You have an error in your SQL syntax; check the manual 
that corresponds to your MariaDB server version for the right syntax to use 
near '(pagesID, host, ref, location, useros, browser, visits) VALUES (1, 
'cyta.gr', '' at line 1")

and i'am totally stuck.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Installation issue with Python 3.6.1 for 64 bit Windows

2017-03-26 Thread Sibylle Koczian

Am 26.03.2017 um 06:01 schrieb arjun.janah:


Hello,
I am using an HP PC, brought in 2009, which currently has on it Windows 7 
Ultimate, Service Pack 1.


Did you do all Windows updates?


System type is 64-bit operating system.

I went to https://www.python.org/downloads/windows/ and chose the following: 
Download Windows x86-64 executable installerThe downloaded file appeared, in my 
Downloads folder, as:

python-3.6.1-amd64.exe, with a filesize of 30,657 KB.

I ran the file and it appeared to install properly. But when I tried to run 
Python from the Windows All Programs menu tab, I got the following message, in 
a small window by the window with a black screen:
--
python.exe - System Error
The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing 
from your computer. Try reinstalling the program to fix this 
problem.--

I tried the following:

(a) restarting Windows and trying again: same result;

(a) running the installer file again and selecting repair:
this stalled for a long time so I had to abort it;

(b) restarting my computer, running the installer file again and selecting 
uninstall: this uninstalled Python, so it said;

(c) running the installer file again and choosing install: this installed 
Python afresh. But then I had the same problem as at the start when I tried to 
run Python.



You need the dll mentioned in the error message, and you won't get it by 
repeatedly installing Python (I don't know why the message tells you to 
do that ...). You will have to get it from Microsoft instead. Googling 
the name of the dll will probably lead you to it quickly, the problem 
seems to be quite common.



--
https://mail.python.org/mailman/listinfo/python-list


[issue21301] pathlib missing Path.expandvars(env=os.environ)

2017-03-26 Thread Alain Mellan

Alain Mellan added the comment:

Yes, you can close it.

— alain.

On Mar 25, 2017, at 23:51 , Serhiy Storchaka  wrote:

http://bugs.python.org/issue21301 

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29908] Inconsistent crashing with an access violation

2017-03-26 Thread Eryk Sun

Eryk Sun added the comment:

The offset in ucrtbase.dll where it's crashing may hint at the culprit. The 
following command should print the full event log for the most recent crash:

wevtutil qe application /rd:true /c:1 /format:text 
/q:"*[System[Provider[@Name='Application 
Error']]][EventData[Data='python.exe'][Data='ucrtbase.dll']]"

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12414] getsizeof() on code objects is wrong

2017-03-26 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Not including the Python accessible referred-to objects is consistent with how 
sys.getsizeof() works elsewhere (i.e. for object instances, the size of 
__dict__ is not included).

>>> import sys
>>> class A:
pass

>>> a = A()
>>> sys.getsizeof(a)
56
>>> sys.getsizeof(a.__dict__)
112

The result is easily misleading but this seems to have been an early design 
decision about the semanatics __sizeof__.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 2:48 AM, Νίκος Βέργος  wrote:
>> > which you can see at http://superhost.gr
>>
>> Ah, Nikos, its been a long time! I thought I recognised your style of
>> posting.
>
>
> Howdy Steve!
> Yes its me and yes its have been a long time! How are you?!
>

Irony lost.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 6:39:01 μ.μ. UTC+3, ο χρήστης Steve D'Aprano 
έγραψε:
> On Mon, 27 Mar 2017 02:11 am, Νίκος Βέργος wrote:
> 
> > I just tried:
> > 
> > domain = '.'.join( host.split('.')[-2:] )
> > domain = '%' + domain + '%'
> > 
> > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros,
> > browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"
> > ''', (pID, domain, ref, location, useros, browser, lastvisit, domain) )
> > 
> > and i received no error in the error_log but
> > ProgrammingError(1064, "You have an error in your SQL syntax; check the
> > manual that corresponds to your MariaDB server version for the right
> > syntax to use near '(pagesID, host, ref, location, useros, browser,
> > visits) VALUES (1, '%cyta.gr%', ' at line 1")
> 
> Start by following the instructions given:
> 
> check the manual that corresponds to your MariaDB server version 
> for the right syntax to use
> 
> just like the error message tells you to do.
> 
> Are you sure that the domain needs to have leading and trailing percentage
> signs? "%cyta.gr%" instead of "cyta.gr"?
> 
> Are you sure that the LIKE clause needs double quotes?
> 
> LIKE "%s"
> 
> Perhaps MariaDB requires single quotes:
> 
> LIKE '%s'
> 
> or perhaps no quotes at all:
> 
> LIKE %s
> 
> 
> But I'm just guessing, because I haven't read the MariaDB manual. You should
> do so.
> 
> 
> > which you can see at http://superhost.gr
> 
> Ah, Nikos, its been a long time! I thought I recognised your style of
> posting.


Howdy Steve!
Yes its me and yes its have been a long time! How are you?!

Yeap still trying to make my webiste better and better every day.

As for MariaDB i tried with single/double/no_quoting at all and it still 
produces 
ProgrammingError(1064, "You have an error in your SQL syntax; check the manual 
that corresponds to your MariaDB server version for the right syntax to use 
near '(pagesID, host, ref, location, useros, browser, visits) VALUES (1, 
'cyta.gr', '' at line 1")

I think that Ian Kelly is right and it has soemthign to do with the databse 
wrapper not substituting properly the actual string contain in the LIKE clause 
between the double quotes.

Perhaps i need to change pymysql with some other database interface or there is 
something other than that?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 6:28:12 μ.μ. UTC+3, ο χρήστης Chris Angelico 
έγραψε:
> On Mon, Mar 27, 2017 at 2:11 AM, Νίκος Βέργος  wrote:
> > Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
> >
> >> The database wrapper won't do substitution into the middle of a string
> >> like that. Either concatenate the literal %'s on in the SQL statement
> >> or add them to the string before you pass it in, i.e. '%' + domain +
> >> '%' or '%%%s%%' % domain or '%{}%'.format(domain).
> >
> > I just tried:
> >
> > domain = '.'.join( host.split('.')[-2:] )
> > domain = '%' + domain + '%'
> >
> > cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> > browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" 
> > ''',
> > 
> > 
> > 
> > (pID, domain, ref, 
> > location, useros, browser, lastvisit, domain) )
> >
> >
> > and i received no error in the error_log but
> > ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> > manual that corresponds to your MariaDB server version for the right syntax 
> > to use near '(pagesID, host, ref, location, useros, browser, visits) VALUES 
> > (1, '%cyta.gr%', ' at line 1")
> >
> > which you can see at http://superhost.gr
> >
> > You said somethign about concatenating the literal % in the SQL to which i 
> > didnt actually i understand how to implement.
> 
> Stop panicking.
> 
> Stop just trying one thing very quickly, getting an error message, and
> firing a post back to this list.
> 
> Slow down and read the messages you are getting.
> 
> You have already been told about UPDATE queries not using this syntax,
> and the error message is referring to that. You have an error in your
> SQL syntax; **check the manual**.

> This is the same problem that you had the last time you were here on
> this list - you had a different email address then, and I can't
> remember what name you were going by, but I won't quickly forget
> superhost.gr, which at the moment looks like Geocities found a new
> domain name.
> 
> ChrisA

I'am reading all the answers and trying everything mentioned.

As for the SQL syntax i dont see where the error is.
I use many UPDATE statements within my scripts in exactyly the same why i have 
been showing them to you.
The only UPDATE is failing is this one with the LIKE clause.

I think that Ian's is correct saying that the substitution is ain't done as we 
intend form the database wrapper which is PyMYSQL.

And last but not least it would be nice if you actually made a contributing 
comment regarding to my questions(which bothers me 3 days in a row by now) 
instead of making ironic remarks related to how my website looks like 
aesthitically to you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Steve D'Aprano
On Mon, 27 Mar 2017 02:11 am, Νίκος Βέργος wrote:

> I just tried:
> 
> domain = '.'.join( host.split('.')[-2:] )
> domain = '%' + domain + '%'
> 
> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros,
> browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s"
> ''', (pID, domain, ref, location, useros, browser, lastvisit, domain) )
> 
> and i received no error in the error_log but
> ProgrammingError(1064, "You have an error in your SQL syntax; check the
> manual that corresponds to your MariaDB server version for the right
> syntax to use near '(pagesID, host, ref, location, useros, browser,
> visits) VALUES (1, '%cyta.gr%', ' at line 1")

Start by following the instructions given:

check the manual that corresponds to your MariaDB server version 
for the right syntax to use

just like the error message tells you to do.

Are you sure that the domain needs to have leading and trailing percentage
signs? "%cyta.gr%" instead of "cyta.gr"?

Are you sure that the LIKE clause needs double quotes?

LIKE "%s"

Perhaps MariaDB requires single quotes:

LIKE '%s'

or perhaps no quotes at all:

LIKE %s


But I'm just guessing, because I haven't read the MariaDB manual. You should
do so.


> which you can see at http://superhost.gr

Ah, Nikos, its been a long time! I thought I recognised your style of
posting.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 2:37 AM, Chris Angelico  wrote:
> Just use Unicode. Everything else, these days, is a subset of Unicode
> anyway.

(Caveat: There are a few counter-examples to my statement, but I very
much doubt that someone who's talking about PC OEM graphics is going
to be running into them.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 2:17 AM, Mikhail V  wrote:
>>> Why? IIRC I can do good pseudographics on linux only with extended
>>> unicode character sets, so yes it is possible, is that what you mean?
>>
>> No.  The same ASCII character set that was available in DOS is
>> available in Linux without unicode.
>
> Ok, now I have read that one can change the encoding in the terminal
> to get same table drawing characters (if one does not want to use
> unicode).

Just use Unicode. Everything else, these days, is a subset of Unicode
anyway. Unless you're stuck on the default Windows shell/terminal, you
should be able to use UTF-8 everywhere and have the entire Unicode
range available. For example, the IBM OEM box-drawing characters are
available in Code Page 437... or as Unicode code points in the U+25xx
range.

> But such a question: can one do it programmaticaly?

Set everything to UTF-8 and you don't have to.

> And more important: can one use binary (bitmap) fonts in default modern
> linux console? If yes, can one patch them with custom tiles at
> the application start?

If you really need something completely custom, it's not text any
more. For example, suppose you redefine all the character images, and
then someone copies and pastes into a web browser - can they search
the web for the characters you're displaying, and will they mean the
same things? If you've redefined images arbitrarily, they won't.

More likely, you don't truly need something custom - what you need is
a different subset of characters (maybe you need to mix Latin, Greek,
and Hebrew letters, in order to show interlinear translation of the
Bible). Instead of messing around with character sets, you can just
use Unicode and have all of them available.

> In DOS, (I don't remember if in all versions or only some)
> one could do all this and this opens very rich possibilities for
> approximating of objects with tiles. The only limitations
> that one uses 255 tiles, but even this enables to build
> whole 'worlds' and state of the art apps. So I would call this
> pseudographics and not few sticks and corner tiles
> (which I cannot even define and upload easily).

Yeah; if my memory serves me, this was an IBM BIOS feature, so all
versions of DOS would be equally able to do it. But it's basically a
form of tile graphics, not text. Given how easily graphical programs
can be built these days, I would strongly recommend that, rather than
abusing pseudo-text as pseudo-graphics. Pick up Tk or GTK or wxWindows
or something, or build your app to run in a web browser, or something
like that.

If what you're doing really is text, just with custom images, you MAY
be able to ask your users to install a TTF or something. But I
wouldn't use a program that demands that I reconfigure my terminal.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Chris Angelico
On Mon, Mar 27, 2017 at 2:11 AM, Νίκος Βέργος  wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
>
>> The database wrapper won't do substitution into the middle of a string
>> like that. Either concatenate the literal %'s on in the SQL statement
>> or add them to the string before you pass it in, i.e. '%' + domain +
>> '%' or '%%%s%%' % domain or '%{}%'.format(domain).
>
> I just tried:
>
> domain = '.'.join( host.split('.')[-2:] )
> domain = '%' + domain + '%'
>
> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" ''',
>   
>   
>   
>   (pID, domain, ref, location, 
> useros, browser, lastvisit, domain) )
>
>
> and i received no error in the error_log but
> ProgrammingError(1064, "You have an error in your SQL syntax; check the 
> manual that corresponds to your MariaDB server version for the right syntax 
> to use near '(pagesID, host, ref, location, useros, browser, visits) VALUES 
> (1, '%cyta.gr%', ' at line 1")
>
> which you can see at http://superhost.gr
>
> You said somethign about concatenating the literal % in the SQL to which i 
> didnt actually i understand how to implement.

Stop panicking.

Stop just trying one thing very quickly, getting an error message, and
firing a post back to this list.

Slow down and read the messages you are getting.

You have already been told about UPDATE queries not using this syntax,
and the error message is referring to that. You have an error in your
SQL syntax; **check the manual**.

This is the same problem that you had the last time you were here on
this list - you had a different email address then, and I can't
remember what name you were going by, but I won't quickly forget
superhost.gr, which at the moment looks like Geocities found a new
domain name.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
domain = '.'.join( host.split('.')[-2:] )

domain = '%' + domain + '%' 
domain = '%%%s%%' % domain 
domain = '%{}%'.format(domain)

cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" ''', 



(pID, domain, ref, location, useros, 
browser, lastvisit, domain) )

i just tried both of these 3 ways and the database wrapper failed on all of 
them respectively.

they gave no error_log output though just the usual
ProgrammingError(1064, .)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python question

2017-03-26 Thread Steve D'Aprano
On Sun, 26 Mar 2017 10:35 pm, Cameron Simpson wrote:

> On 26Mar2017 20:55, Steve D'Aprano  wrote:
>>On Sun, 26 Mar 2017 01:55 pm, c...@zip.com.au wrote:
>>> 1: He BCCed the list, not us individually. Look at the headers.
>>
>>BCCed addresses aren't visible in the headers. That's why they're BLIND
>>CC.
> 
> Of course, but the received headers etc show it passed though the list.

Sending to the list is not a bad thing. We know the OP sent to the list,
because his post appeared on the list :-)

The question is whether he BCCed a bunch of regulars or not.

[...]
> If the headers say it went though the list, _that_ copy went through the
> list, _not_ to your personal address (well, not from him; of course the
> list delivered it to you).

Unfortunately I deleted the email so I can't look at the headers, but
nevertheless I can categorically say that it didn't come from the mailing
list, because the python-list@python.org mailing list doesn't have my
address. I've always read this though the newsgroup.

I do still have the relevant mail logs:

Mar 25 03:08:36 ando postfix/smtpd[24188]: connect from
  mail-wr0-f194.google.com[209.85.128.194]
Mar 25 03:08:37 ando postfix/smtpd[24188]: 2093D1204E2:
  client=mail-wr0-f194.google.com[209.85.128.194]
Mar 25 03:08:37 ando postfix/cleanup[24192]: 2093D1204E2:
  message-id=
Mar 25 03:08:37 ando postfix/qmgr[3004]: 2093D1204E2:
  from=, size=3258, nrcpt=1 (queue active)
Mar 25 03:08:38 ando postfix/smtpd[24188]: disconnect from
  mail-wr0-f194.google.com[209.85.128.194]

I'm not an expert, but to me that looks pretty convincing that the email
came directly from Google, not from the mailing list. Am I wrong?


>>Your interpretation doesn't explain why I received a copy sent to my
>>personal email address. I read this via the newsgroup comp.lang.python,
>>not the mailing list, and I'm not subscribed to the email mailing list. If
>>the OP had merely BCCed the mailing list, I wouldn't have received a copy
>>in my personal inbox.
> 
> Fair point. Though I thought I only got one copy, might be wrong.

Maybe you weren't one of the people he BCCed :-)





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Text-mode apps (Was :Who are the "spacists"?)

2017-03-26 Thread Mikhail V
On 26 March 2017 at 16:28, Wildman via Python-list
 wrote:
> On Sun, 26 Mar 2017 15:18:06 +0200, Mikhail V wrote:
>
>> On 26 March 2017 at 06:16, Wildman via Python-list
>>  wrote:
>>> On Tue, 21 Mar 2017 15:15:14 +0100, Mikhail V wrote:
>>>
 And on linux console, by default one does not even have good
 possibilities for text-mode pseudographics, it was more relevant
 in DOS where one had rich possibilities and programmable
 binary fonts.

 Mikhail
>>>
>>> Nonsense.
>>
>> Why? IIRC I can do good pseudographics on linux only with extended
>> unicode character sets, so yes it is possible, is that what you mean?
>
> No.  The same ASCII character set that was available in DOS is
> available in Linux without unicode.

Ok, now I have read that one can change the encoding in the terminal
to get same table drawing characters (if one does not want to use
unicode).
But such a question: can one do it programmaticaly?
And more important: can one use binary (bitmap) fonts in default modern
linux console? If yes, can one patch them with custom tiles at
the application start?
In DOS, (I don't remember if in all versions or only some)
one could do all this and this opens very rich possibilities for
approximating of objects with tiles. The only limitations
that one uses 255 tiles, but even this enables to build
whole 'worlds' and state of the art apps. So I would call this
pseudographics and not few sticks and corner tiles
(which I cannot even define and upload easily).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2017-03-26 Thread Νίκος Βέργος
Τη Κυριακή, 26 Μαρτίου 2017 - 5:49:00 μ.μ. UTC+3, ο χρήστης Ian έγραψε:

> The database wrapper won't do substitution into the middle of a string
> like that. Either concatenate the literal %'s on in the SQL statement
> or add them to the string before you pass it in, i.e. '%' + domain +
> '%' or '%%%s%%' % domain or '%{}%'.format(domain).

I just tried:

domain = '.'.join( host.split('.')[-2:] )
domain = '%' + domain + '%'

cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" ''', 



(pID, domain, ref, location, useros, 
browser, lastvisit, domain) )


and i received no error in the error_log but
ProgrammingError(1064, "You have an error in your SQL syntax; check the manual 
that corresponds to your MariaDB server version for the right syntax to use 
near '(pagesID, host, ref, location, useros, browser, visits) VALUES (1, 
'%cyta.gr%', ' at line 1")

which you can see at http://superhost.gr

You said somethign about concatenating the literal % in the SQL to which i 
didnt actually i understand how to implement.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18022] Inconsistency between quopri.decodestring() and email.quoprimime.decode()

2017-03-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thus currently the table of discrepancies looks as:

   quoprimime  binascii  quopri

 b'='  ''  b''   b'='
 b'= ' ''  b'= ' b'= '
 b'= \n'   ''  b'= \n'   b''
 b'=\r'''  b''   b'=\r'
 b'==41'   '=A'b'=41'b'=41'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >