Re: Re: Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Peter Otten
Paul St George wrote: > This is very helpful indeed, thank you. Awe-inspiring. > > It occurred to me that I could edit the PIL/ImageShow.py, replacing ‘xv’ > (in five places) with the utility of my choice and using ‘executable’ as > the command. > > Or, is this just not done? No, this tends to

Re: help

2018-05-29 Thread Steven D'Aprano
On Mon, 28 May 2018 15:43:45 +0530, Mutyala Veera Vijaya Teja wrote: > Hello, > This is vijayteja am getting an error like ssl certificate > failure when try to install packages. You get an error *like* SSL certificate failure? Is it a secret what the error is? Would you like us to try

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Peter J. Holzer
On 2018-05-23 08:43:02 +1000, Chris Angelico wrote: > On Wed, May 23, 2018 at 8:31 AM, Peter J. Holzer wrote: > > On 2018-05-23 07:38:27 +1000, Chris Angelico wrote: > >> > 1) For any given file it is almost always possible to find the correct > >> >encoding (or *a* correct encoding, as there

String encoding in Py2.7

2018-05-29 Thread ftg
Hello, Using Python 2.7 (will switch to Py3 soon but Before I'd like to understand how string encoding worked) Could you please tell me is I understood well what occurs in Python's mind: in a .py file: if I write s="héhéhé", if my file is declared as unicode coding, python will store in memory s=

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Peter J. Holzer
On 2018-05-23 06:03:38 +, Steven D'Aprano wrote: > On Wed, 23 May 2018 00:31:03 +0200, Peter J. Holzer wrote: > > On 2018-05-23 07:38:27 +1000, Chris Angelico wrote: > >> You can find an encoding which is capable of decoding a file. That's > >> not the same thing. > > > > If the result is corr

Re: String encoding in Py2.7

2018-05-29 Thread Thomas Jollans
On 2018-05-29 09:55, f...@lutix.org wrote: > Hello, > Using Python 2.7 (will switch to Py3 soon but Before I'd like to understand > how string encoding worked) Oh dear. This is probably the exact wrong way to go about it: the interplay between string encoding, unicode and bytes is much less clear

Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-29 Thread Peter J. Holzer
On 2018-05-23 11:08:48 -0600, Ian Kelly wrote: > On Wed, May 23, 2018 at 10:25 AM, Peter J. Holzer wrote: > > How about this? > > > > x = > > Here is a multi-line string > > with > > indentation. > > > > > > This would be equivalent to > > > >

Re: how to handle captcha through machanize module or any module

2018-05-29 Thread Peter J. Holzer
On 2018-05-24 09:59:14 +1000, Ben Finney wrote: > If you are attempting to fool a CAPTCHA with an automated tool, you are > entering an arms race against those who design the CAPTCHA to *prevent* > exactly what you're doing. > > Any technique someone can describe to fool the CAPTCHA, will most lik

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Chris Angelico
On Tue, May 29, 2018 at 6:15 PM, Peter J. Holzer wrote: > So if the text is German it will contain more words with > umlauts and each byte which is part of a correctly spelled German word > when interpreted according to ISO-8859-1 increases the probability that > decoding with ISO-8859-1 will prod

Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Peter J. Holzer
On 2018-05-28 06:34:30 +0200, Christian Gollwitzer wrote: > I think this is a bug/misfeature in the PIL code. On all 3 major platforms > there is a way to invoke the standard program for a given file or URL. On > Windows, it is "cmd.exe /c start ...", on OSX it is "open " and on Linux > it is "

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Chris Angelico
On Tue, May 29, 2018 at 6:34 PM, Peter J. Holzer wrote: > On 2018-05-23 06:03:38 +, Steven D'Aprano wrote: >> Mojibake is especially difficult to deal with when you are dealing with >> short text snippets like file names or user names which can contain >> arbitrary characters, where there is r

Re: String encoding in Py2.7

2018-05-29 Thread Fabien LUCE
May 29 2018 11:12 AM, "Thomas Jollans" wrote: > On 2018-05-29 09:55, f...@lutix.org wrote: > >> Hello, >> Using Python 2.7 (will switch to Py3 soon but Before I'd like to understand >> how string encoding >> worked) > > Oh dear. This is probably the exact wrong way to go about it: the > interpl

Re: String encoding in Py2.7

2018-05-29 Thread Chris Angelico
On Tue, May 29, 2018 at 5:55 PM, wrote: > Hello, > Using Python 2.7 (will switch to Py3 soon but Before I'd like to understand > how string encoding worked) > Could you please tell me is I understood well what occurs in Python's mind: > in a .py file: > if I write s="héhéhé", if my file is decla

Re: cProfile, timed call tree

2018-05-29 Thread Peter J. Holzer
On 2018-05-26 07:38:09 +0200, dieter wrote: > But, in general, you are right: you cannot reconstruct complete > call trees. The reason is quite simple: maintaining information > for the complete caller ancestry (rather than just the immediate > caller) is expensive (both in terms of runtime and sto

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Peter J. Holzer
On 2018-05-29 19:46:24 +1000, Chris Angelico wrote: > On Tue, May 29, 2018 at 6:15 PM, Peter J. Holzer wrote: > > So if the text is German it will contain more words with > > umlauts and each byte which is part of a correctly spelled German word > > when interpreted according to ISO-8859-1 increas

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Peter J. Holzer
On 2018-05-29 19:47:37 +1000, Chris Angelico wrote: > On Tue, May 29, 2018 at 6:34 PM, Peter J. Holzer wrote: > > On 2018-05-23 06:03:38 +, Steven D'Aprano wrote: > >> Mojibake is especially difficult to deal with when you are dealing with > >> short text snippets like file names or user names

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Chris Angelico
On Tue, May 29, 2018 at 8:09 PM, Peter J. Holzer wrote: > On 2018-05-29 19:46:24 +1000, Chris Angelico wrote: >> On Tue, May 29, 2018 at 6:15 PM, Peter J. Holzer wrote: >> > So if the text is German it will contain more words with >> > umlauts and each byte which is part of a correctly spelled Ge

Re: String encoding in Py2.7

2018-05-29 Thread Steven D'Aprano
On Tue, 29 May 2018 09:19:52 +, Fabien LUCE wrote: > May 29 2018 11:12 AM, "Thomas Jollans" wrote: >> On 2018-05-29 09:55, f...@lutix.org wrote: >> >>> Hello, >>> Using Python 2.7 (will switch to Py3 soon but Before I'd like to >>> understand how string encoding worked) >> >> Oh dear. This

Re: String encoding in Py2.7

2018-05-29 Thread Chris Angelico
On Tue, May 29, 2018 at 8:39 PM, Steven D'Aprano wrote: > On Tue, 29 May 2018 09:19:52 +, Fabien LUCE wrote: > >> May 29 2018 11:12 AM, "Thomas Jollans" wrote: >>> On 2018-05-29 09:55, f...@lutix.org wrote: >>> Hello, Using Python 2.7 (will switch to Py3 soon but Before I'd like to

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Peter J. Holzer
On 2018-05-29 20:28:54 +1000, Chris Angelico wrote: > On Tue, May 29, 2018 at 8:09 PM, Peter J. Holzer wrote: > > On 2018-05-29 19:46:24 +1000, Chris Angelico wrote: > >> That's basically what the chardet module does, and its error rate is > >> far FAR higher than that. If you think it's easy to d

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Chris Angelico
On Tue, May 29, 2018 at 8:59 PM, Peter J. Holzer wrote: > On 2018-05-29 20:28:54 +1000, Chris Angelico wrote: >> Sure, but you're describing a set of rules. If you can define a set of >> rules that pin down the encoding, you could teach chardet to follow >> those rules. If you can't teach chardet

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Peter J. Holzer
On 2018-05-29 21:13:43 +1000, Chris Angelico wrote: > You can always solve a subset of problems. Using your own knowledge of > German, you are able to better solve problems involving German text. > But that doesn't make you any better than chardet at validating > Chinese text, or Korean text, or Kl

ANN: EuroScipy 2018

2018-05-29 Thread Valerio Maggio
*** Apologies if you receive multiple copies *** Dear Colleagues, We are delighted to invite you to join us for the **11th European Conference on Python in Science**. The EuroSciPy 2018 (https://www.euroscipy.org/2018/) Conference will be organised by Fondazione Bruno Kessler (FBK) and will take

EuroPython 2018: Financial Aid Program

2018-05-29 Thread M.-A. Lemburg
As part of our commitment to the Python community, we are pleased to announce that we offer special grants for people in need of a financial aid to attend EuroPython 2018. We offer financial aid conference grants in these 3 categories: - Free and discounted ticket: Get a standard ticket for the c

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Steven D'Aprano
On Tue, 29 May 2018 10:34:50 +0200, Peter J. Holzer wrote: > On 2018-05-23 06:03:38 +, Steven D'Aprano wrote: >> On Wed, 23 May 2018 00:31:03 +0200, Peter J. Holzer wrote: >> > On 2018-05-23 07:38:27 +1000, Chris Angelico wrote: >> >> You can find an encoding which is capable of decoding a fil

Re: Indented multi-line strings (was: "Data blocks" syntax specification draft)

2018-05-29 Thread Ian Kelly
On Tue, May 29, 2018 at 3:19 AM, Peter J. Holzer wrote: > On 2018-05-23 11:08:48 -0600, Ian Kelly wrote: >> >> How about we instead just use the rules from PEP 257 so that there >> aren't two different sets of multi-line string indentation rules to >> have to remember? >> >> https://www.python.org

Re: '_' and '__'

2018-05-29 Thread Mike McClain
To the many who responded, many thanks. I,too, found Nick Coghlan's answer iluminating. Mike -- There are always gossips everywhere you go and few of them limit themselves to veracity when what they consider a good story is available to keep their audience entertained. - MM -- https://mail

Re: Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Paul St George
Should the PIL code be corrected? On 28/05/2018 06:34, Christian Gollwitzer wrote: Am 27.05.18 um 23:58 schrieb Cameron Simpson: On 27May2018 20:15, Paul St George wrote: This is very helpful indeed, thank you. Awe-inspiring. It occurred to me that I could edit the PIL/ImageShow.py, replaci

Re: Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Paul St George
Thank you. For the advice, and for the new word 'monkeypatch'. On 27/05/2018 23:58, Cameron Simpson wrote: On 27May2018 20:15, Paul St George wrote: This is very helpful indeed, thank you. Awe-inspiring. It occurred to me that I could edit the PIL/ImageShow.py, replacing ‘xv’ (in five place

Re: Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Paul St George
I tried this anyway. The error was:     non-keyword arg after keyword arg On 27/05/2018 21:51, Dennis Lee Bieber wrote: On Sun, 27 May 2018 19:59:41 +0200, Paul St George declaimed the following: So, on Unix I would use Image.show(title=None, nameofdisplayutilty), or Image.show(title=None

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-29 Thread Steven D'Aprano
On Tue, 29 May 2018 14:04:19 +0200, Peter J. Holzer wrote: > The OP has one file. We don't know that. All we know is that he had one file which he was unable to read. For all we know, he has a million files, and this was merely the first of many failures. > He wants to read it. The very fact

Re: Re: Re: Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Paul St George
Is there, somewhere, a list of viewers and their names (for the purposes of this script)? I am assuming that if I want to ImageMagick (for example), there would be some shorter name - such as 'magick' - and it would be lower case . On 29/05/2018 08:58, Peter Otten wrote: Paul St George wrot

[ANN] pluggable-info-monitor 0.2.1 released!

2018-05-29 Thread George Fischhof
Hi everyone, I’m very excited to announce the release of pluggable-info-monitor 0.2.1 First public release. You can download it form bitbucket: https://bitbucket.org/GeorgeFischhof/pluggable_info_monitor package index page: https://pypi.python.org/pypi/pluggable-info-monitor What is pluggable-

Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Steven D'Aprano
On Tue, 29 May 2018 20:02:22 +0200, Paul St George wrote: > Is there, somewhere, a list of viewers and their names (for the purposes > of this script)? Do you mean a list of programs capable of viewing graphics? Do you think there is some sort of central authority that registers the names of all

a Python bug report

2018-05-29 Thread Ruifeng Guo
Hello, We encountered a bug in Python recently, we checked the behavior for Python version 2.7.12, and 3.1.1, both version show the same behavior. Please see below the unexpected behavior in "red text". Thanks, Ruifeng Guo From: Brian Archer Sent: Tuesday, May 29, 2018 5:57 PM To: Ruifeng Guo

Re: Re: The PIL show() method looks for the default viewer. How do I change this to a different viewer (of my choice)?

2018-05-29 Thread Ian Kelly
On Sat, May 26, 2018 at 9:17 AM, Paul St George wrote: > Thank you. > You are very right. The show() method is intended for debugging purposes and > is useful for that, but what method should I be using and is PIL the best > imaging library for my purposes? I do not want to manipulate images, I on

Re: a Python bug report

2018-05-29 Thread José María Mateos
On Wed, May 30, 2018 at 01:07:38AM +, Ruifeng Guo wrote: > Hello, > We encountered a bug in Python recently, we checked the behavior for Python > version 2.7.12, and 3.1.1, both version show the same behavior. Please see > below the unexpected behavior in "red text". Have you tried the round

Re: a Python bug report

2018-05-29 Thread Ian Kelly
On Tue, May 29, 2018 at 7:07 PM, Ruifeng Guo wrote: > Hello, > We encountered a bug in Python recently, we checked the behavior for Python > version 2.7.12, and 3.1.1, both version show the same behavior. Please see > below the unexpected behavior in "red text". > > Thanks, > Ruifeng Guo > > Fro

Simple question: how do I print output from .get() method

2018-05-29 Thread MrMagoo2018
Hello folks, imagine I have the code below and I am getting the "error" message when attempting to print() the output of 'sw_report'. Can you suggest which method I should use to retrieve this? Is that a dictionary maybe? from arista import arista m = arista() m.authenticate ("user","password")

Re: cProfile, timed call tree

2018-05-29 Thread dieter
"Peter J. Holzer" writes: > On 2018-05-26 07:38:09 +0200, dieter wrote: >> But, in general, you are right: you cannot reconstruct complete >> call trees. The reason is quite simple: maintaining information >> for the complete caller ancestry (rather than just the immediate >> caller) is expensive

Re: Simple question: how do I print output from .get() method

2018-05-29 Thread Chris Angelico
On Wed, May 30, 2018 at 3:44 PM, MrMagoo2018 wrote: > Hello folks, imagine I have the code below and I am getting the "error" > message when attempting to print() the output of 'sw_report'. > Can you suggest which method I should use to retrieve this? Is that a > dictionary maybe? > > from arist