Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Rustom Mody
On Thursday, February 2, 2017 at 5:44:51 AM UTC+5:30, Erik wrote: > On 01/02/17 23:20, Wildman via Python-list wrote: > > On Wed, 01 Feb 2017 21:29:00 +, Chris Green wrote: > > > >> Wildman wrote: > >>> On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote: > >> OK, no problem, but isn't it ver

Re: How coding in Python is bad for you

2017-02-01 Thread Erik
On 02/02/17 01:41, Chris Angelico wrote: On Thu, Feb 2, 2017 at 10:49 AM, Erik wrote: Well, _logically_ there is a flag (in as much as it could be thought of like that to make it easy to understand - and in C, that's pretty much what you have to actually do unless you really want to use 'goto')

Re: How coding in Python is bad for you

2017-02-01 Thread Erik
On 02/02/17 02:05, MRAB wrote: Both suggestions are a little long-winded. Couldn't we just abbreviate them to "else:"? :-) You are not wrong ;) E. -- https://mail.python.org/mailman/listinfo/python-list

Re: How coding in Python is bad for you

2017-02-01 Thread MRAB
On 2017-02-01 23:49, Erik wrote: On 30/01/17 02:14, Steve D'Aprano wrote: On Mon, 30 Jan 2017 10:52 am, Erik wrote: It would be even better if it was "else if not break:" to make the meaning clearer. break is not the only way to exit the for loop Fine - "else if not break or raise or return

Re: How coding in Python is bad for you

2017-02-01 Thread Chris Angelico
On Thu, Feb 2, 2017 at 10:49 AM, Erik wrote: > Well, _logically_ there is a flag (in as much as it could be thought of like > that to make it easy to understand - and in C, that's pretty much what you > have to actually do unless you really want to use 'goto'). The last time I wanted a for-else i

Re: Is shutil.get_terminal_size useless?

2017-02-01 Thread Chris Angelico
On Thu, Feb 2, 2017 at 12:24 PM, Steve D'Aprano wrote: etc, etc, etc, etc. It's not a proxy for "being piped" - it's that when your output isn't going to a terminal, asking "what is my terminal size" isn't particularly productive. >>> >>> Then explain why os.get_terminal_size()

Re: Is shutil.get_terminal_size useless?

2017-02-01 Thread Steve D'Aprano
On Sat, 28 Jan 2017 11:53 pm, Peter Otten wrote: [...] >> I see that as "Hey look, we can fool shutil into returning >> absolute garbage instead of the terminal size!" > > There are valid reasons for temporarily altering the number of columns, > like writing to a file or preparing a code sample.

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Michael Torrie
On 02/01/2017 02:29 PM, Chris Green wrote: > OK, thank you, what a strange way to do it. Why is it strange? Essentially, python bindings for any GObject-based library are now fully automatic via this gi module. No longer do we need custom bindings for each component of a glib-based library. Thi

Re: Is shutil.get_terminal_size useless?

2017-02-01 Thread Steve D'Aprano
On Sun, 29 Jan 2017 04:58 am, Chris Angelico wrote: > On Sun, Jan 29, 2017 at 3:15 AM, Steve D'Aprano > wrote: >> On Sat, 28 Jan 2017 10:50 pm, Chris Angelico wrote: >> >>> On Sat, Jan 28, 2017 at 9:49 PM, Steve D'Aprano >>> wrote: The terminal size doesn't change just because I'm piping ou

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Νίκος Βέργος
# Give user the file requested print('''http://superhost.gr/data/files/%s";>''' % realfile) authuser = os.environ.get( 'REMOTE_USER', 'Άγνωστος' ) print( authuser ) Trying this, feels liek i'm almost there except t

Re: Rename file without overwriting existing files

2017-02-01 Thread Steve D'Aprano
On Tue, 31 Jan 2017 02:56 am, Grant Edwards wrote: > On 2017-01-30, Terry Reedy wrote: >> On 1/30/2017 8:58 AM, Peter Otten wrote: >>> Jussi Piitulainen wrote: >> It doesn't seem to be documented. >>> >>> For functions with a C equivalent a look into the man page is usually >>> helpful. >> >

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Erik
On 01/02/17 23:20, Wildman via Python-list wrote: On Wed, 01 Feb 2017 21:29:00 +, Chris Green wrote: Wildman wrote: On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote: OK, no problem, but isn't it very non-portable? I don't see why not. It should work on any system that has Python3

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Νίκος Βέργος
Τη Πέμπτη, 2 Φεβρουαρίου 2017 - 1:51:52 π.μ. UTC+2, ο χρήστης Ian έγραψε: > On Wed, Feb 1, 2017 at 2:51 PM, Νίκος Βέργος wrote: > > Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 11:41:28 μ.μ. UTC+2, ο χρήστης Michael > > Torrie έγραψε: > >> On 02/01/2017 01:51 PM, Νίκος Βέργος wrote: > >> > as well as input()

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Ian Kelly
On Wed, Feb 1, 2017 at 2:51 PM, Νίκος Βέργος wrote: > Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 11:41:28 μ.μ. UTC+2, ο χρήστης Michael > Torrie έγραψε: >> On 02/01/2017 01:51 PM, Νίκος Βέργος wrote: >> > as well as input() for both user & pass combo but iam not getting in >> > chrome the basic pop-up HTT

Re: How coding in Python is bad for you

2017-02-01 Thread Erik
On 30/01/17 02:14, Steve D'Aprano wrote: On Mon, 30 Jan 2017 10:52 am, Erik wrote: It would be even better if it was "else if not break:" to make the meaning clearer. break is not the only way to exit the for loop Fine - "else if not break or raise or return:", then ;) [that is not a seriou

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Wildman via Python-list
On Wed, 01 Feb 2017 21:29:00 +, Chris Green wrote: > Wildman wrote: >> On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote: >> >> > Wildman wrote: >> >> On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: >> >> >> >> > I'm often hitting this problem, how does one find out what package

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Chris Green
Wildman wrote: > On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote: > > > Wildman wrote: > >> On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: > >> > >> > I'm often hitting this problem, how does one find out what package to > >> > install to provide what a give import needs? > >> >

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Νίκος Βέργος
Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 11:41:28 μ.μ. UTC+2, ο χρήστης Michael Torrie έγραψε: > On 02/01/2017 01:51 PM, Νίκος Βέργος wrote: > > as well as input() for both user & pass combo but iam not getting in chrome > > the basic pop-up HTTP auth window. > > > > Any idea why? > > What you're descr

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Michael Torrie
On 02/01/2017 01:03 PM, Wildman via Python-list wrote: > > It is the proper way. This page helps explain it. > > http://askubuntu.com/questions/784068/what-is-gi-repository-in-python > >> ... and doesn't it need an internet connection? > > No. However the gi module provides access to GTK+3, a

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Michael Torrie
On 02/01/2017 01:51 PM, Νίκος Βέργος wrote: > as well as input() for both user & pass combo but iam not getting in chrome > the basic pop-up HTTP auth window. > > Any idea why? What you're describing is not something you can do with an interactive Python script. HTTP-level authentication is req

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Νίκος Βέργος
Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 9:22:46 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > You should use the input() function (called raw_input() in Python 2) > for a user name, and the getpass module for the password: I have just tried === # Give user the file

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Νίκος Βέργος
Τη Τετάρτη, 1 Φεβρουαρίου 2017 - 9:22:46 μ.μ. UTC+2, ο χρήστης Chris > You should use the input() function (called raw_input() in Python 2) > for a user name, and the getpass module for the password: i have just tried: # Give user the file requested url = "http://superhost.gr/da

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread John Gordon
In Peter Pearson writes: > > How can i ASK the user for http auth data and store them isntead of > > giving them to the script? > Maybe like this? > user = raw_input("User: ") > password = raw_input("Password: ") If it doesn't need to be interactive, you could require that the user suppl

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Wildman via Python-list
On Wed, 01 Feb 2017 19:15:13 +, Chris Green wrote: > Wildman wrote: >> On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: >> >> > I'm often hitting this problem, how does one find out what package to >> > install to provide what a give import needs? >> > >> > Currently I'm modifying som

Why doesn't module finalization delete names as expected?

2017-02-01 Thread Philippe Proulx
I'm developing a C module with the help of SWIG. My library manages objects with reference counting, much like Python, except that it's deterministic: there's no GC. I'm using Python 3.5.2. I create two Python objects like this: bakery = Bakery() bread = bakery.create_bread() Behind the

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Chris Angelico
On Thu, Feb 2, 2017 at 2:10 AM, Νίκος Βέργος wrote: > # Give user the file requested > url = "http://superhost.gr/data/files/%s"; % realfile > > user, password = 'user', 'passwd' > > r = requests.get( url, auth = (user, password) ) # send auth unconditionally > r.raise_for_status() > =

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Chris Green
Wildman wrote: > On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: > > > I'm often hitting this problem, how does one find out what package to > > install to provide what a give import needs? > > > > Currently I'm modifying some code which has 'import gtk', I want to > > migrate from Python

Re: Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Peter Pearson
On Wed, 1 Feb 2017 07:10:39 -0800 (PST), Νίκος Βέργος wrote: > # Give user the file requested > url = "http://superhost.gr/data/files/%s"; % realfile > > user, password = 'user', 'passwd' > > r = requests.get( url, auth = (user, password) ) # send auth unconditionally > r.raise_for_status() >==

Re: How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Wildman via Python-list
On Wed, 01 Feb 2017 17:12:26 +, Chris Green wrote: > I'm often hitting this problem, how does one find out what package to > install to provide what a give import needs? > > Currently I'm modifying some code which has 'import gtk', I want to > migrate from Python 2 to Python 3 if I can but at

Re: Python doesn't catch exceptions ?

2017-02-01 Thread Ian Kelly
On Wed, Feb 1, 2017 at 8:11 AM, Ivo Bellin Salarin wrote: > This code generates instead the messages: > ``` > ERROR 47.135[bigquery.py.create_table:362] caught exception: HttpError, > defined in server/libs/googleapiclient/errors.pyc. we are in > /Users/nilleb/dev/gae-sample-project/app > ERROR 47

How to know what to install (Ubuntu/Debian) for a given import?

2017-02-01 Thread Chris Green
I'm often hitting this problem, how does one find out what package to install to provide what a give import needs? Currently I'm modifying some code which has 'import gtk', I want to migrate from Python 2 to Python 3 if I can but at the moment the import fails in Python 3. There are dozens of pac

Re: Python doesn't catch exceptions ?

2017-02-01 Thread Peter Otten
Ivo Bellin Salarin wrote: > Hi all, > > I have a curious problem with Python exceptions. > > The following code doesn't catch HttpError: > ``` > from server.libs.googleapiclient.errors import HttpError > [..] > try: > OAuth.backoffExec(request) > return True > except Http

Python doesn't catch exceptions ?

2017-02-01 Thread Ivo Bellin Salarin
Hi all, I have a curious problem with Python exceptions. The following code doesn't catch HttpError: ``` from server.libs.googleapiclient.errors import HttpError [..] try: OAuth.backoffExec(request) return True except HttpError as e: return e.resp.status == 404

Call for Volunteers at PythonFOSDEM 2017

2017-02-01 Thread Stephane Wirtel via Python-list
# Introduction The Python Community will be represented during FOSDEM 2017 with the Python Devrooms. This year, we will have two devrooms, the first one for 150 people on Saturday and the second one for 450 people on Sunday, it's really cool because we had accepted 24 talks instead of 16. Thi

Python3 using requests to grab HTTP Auth Data

2017-02-01 Thread Νίκος Βέργος
# Give user the file requested url = "http://superhost.gr/data/files/%s"; % realfile user, password = 'user', 'passwd' r = requests.get( url, auth = (user, password) ) # send auth unconditionally r.raise_for_status() == How can i ASK the user for http auth data and stor

The use of sys.exc_info for catching exceptions

2017-02-01 Thread Tiago M. Vieira
Hi, I've came to a problem where I want to keep backwards and forwards compatibility with an exception syntax. And I mean by backwards going further down to Python 2.5. I was pointed to this option from a stack overflow answer[1] that works forward and backwards, I rewrite the solution here: imp

Re: doubt loading pages

2017-02-01 Thread Peter Otten
José Manuel Suárez Sierra wrote: > El miércoles, 1 de febrero de 2017, 11:55:11 (UTC+1), José Manuel Suárez > Sierra escribió: >> hello everyone, >> Im trying to make a program that takes an archive from pdb (for instance >> this link http://www.rcsb.org/pdb/files/fasta.txt?structureIdList=5HXY >

Re: doubt loading pages

2017-02-01 Thread José Manuel Suárez Sierra
El miércoles, 1 de febrero de 2017, 11:55:11 (UTC+1), José Manuel Suárez Sierra escribió: > hello everyone, > Im trying to make a program that takes an archive from pdb (for instance this > link http://www.rcsb.org/pdb/files/fasta.txt?structureIdList=5HXY > > after reading it I want it to save

Re: Python3.6 tkinter bug?

2017-02-01 Thread Terry Reedy
On 2/1/2017 1:37 AM, Christian Gollwitzer wrote: Am 01.02.17 um 00:02 schrieb MRAB: On 2017-01-31 22:34, Christian Gollwitzer wrote: .!frame.!checkbutton .!frame.!checkbutton2 .!frame2.!checkbutton .!frame2.!checkbutton2 Perhaps someone who knows Tcl and tk can tell me, but I notice that in

Re: doubt loading pages

2017-02-01 Thread Peter Otten
José Manuel Suárez Sierra wrote: > hello everyone, > Im trying to make a program that takes an archive from pdb (for instance > this link http://www.rcsb.org/pdb/files/fasta.txt?structureIdList=5HXY > > after reading it I want it to save in a list only this part of the > archive: > > MGSSHHS

doubt loading pages

2017-02-01 Thread José Manuel Suárez Sierra
hello everyone, Im trying to make a program that takes an archive from pdb (for instance this link http://www.rcsb.org/pdb/files/fasta.txt?structureIdList=5HXY after reading it I want it to save in a list only this part of the archive: MGSSHHSSGLVPRGSHMASMTGGQQMGRGSMPAETNEYLSRFVEYMTGERKSRYTI