Re: Sending file to the user gives UnicodeEncodeError in Flask framework

2018-09-12 Thread dieter
> On Wed, 12 Sep 2018 06:57:36 -0700, Νίκος Βέργος wrote: >> I want to send the user a file when he clicks the appropriate button and >> I'm suing the following. >> >> # Prepare selected file for download... >> send_file( '/home/nikos/wsgi/static/files/' + filename ) >> >> But no matter

Re: Trying to use threading.local()

2018-09-12 Thread Peter Otten
Steven D'Aprano wrote: > I'm originally posted this on the Python-Ideas list, but this is probably > more appropriate. > > > import time > from threading import Thread, local > > def func(): > pass > > def attach(value): # no new local() here > func.__params__.value = value > >

Re: Trying to use threading.local()

2018-09-12 Thread MRAB
On 2018-09-12 17:16, Steven D'Aprano wrote: I'm originally posted this on the Python-Ideas list, but this is probably more appropriate. import time from threading import Thread, local def func(): pass def attach(value): func.__params__ = local() func.__params__.value = value

Re: GUI, Python2.7- how to build a loop with a button + textbox

2018-09-12 Thread Peter Pearson
On Tue, 11 Sep 2018 19:51:01 -0700 (PDT), alon.naj...@gmail.com wrote: > hi, > > on python 2.7 how do I build a loop with a button + textbox? > > for example: > > I want the user to enter is name and then press "ok" button, I want > his name to be printed 5 times. Tested on Python 3.5.3: import b

Re: getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Thomas Jollans
On 12/09/18 16:29, Florian Bergmann wrote: On the other hand I feel given the documentation, passing the `ip_address` would be the right thing to do, so I am wondering if I am missing something very obvious here (especially given that the code seems to be unchanged for 18 years). Whatever the do

Trying to use threading.local()

2018-09-12 Thread Steven D'Aprano
I'm originally posted this on the Python-Ideas list, but this is probably more appropriate. import time from threading import Thread, local def func(): pass def attach(value): func.__params__ = local() func.__params__.value = value def worker(i): print("called from thread %s"

Re: getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Rhodri James
On 12/09/18 15:29, Florian Bergmann wrote: Hello, While I was debugging some salt issues I dug into the python code and found a piece of code in the `socket.py` module that surprised my a bit: In the `getfqdn` function the `gethostbyaddr` name function is being called with a `hostname` instead

Re: Running a second wsgi script from within the first wsgi script

2018-09-12 Thread tienrua
Actualy only one wsgi script can run(mean apache handler redirector), your server got "superhost.gr" name but this outer namespace(on apache.conf virtual server *:80), you need call local name for internal accessing. Replace "http://superhost.gr/clientele"; to ["http://127.0.0.1/clientele";, o

getfqdn passes a hostname to gethostbyaddr instead of an ip address

2018-09-12 Thread Florian Bergmann
Hello, While I was debugging some salt issues I dug into the python code and found a piece of code in the `socket.py` module that surprised my a bit: In the `getfqdn` function the `gethostbyaddr` name function is being called with a `hostname` instead of an `ipaddress`: ```python def getfqdn(nam

Re: Sending file to the user gives UnicodeEncodeError in Flask framework

2018-09-12 Thread Alister via Python-list
On Wed, 12 Sep 2018 06:57:36 -0700, Νίκος Βέργος wrote: > I want to send the user a file when he clicks the appropriate button and > I'm suing the following. > > # Prepare selected file for download... > send_file( '/home/nikos/wsgi/static/files/' + filename ) > > But no matter what

Re: Enum with nested classes or with types as members

2018-09-12 Thread Ben Finney
Ethan Furman writes: > I'm asking because in doing some work on Enum it became apparent to me > that having nested classes was not a smooth, satisfying experience, > and I'm considering treating them the same way as methods (they will > no longer be converted into members). For reference (and to

Re: GUI, Python2.7- how to build a loop with a button + textbox

2018-09-12 Thread Thomas Jollans
On 12/09/18 04:51, alon.naj...@gmail.com wrote: hi, on python 2.7 Please use Python 3. how do I build a loop with a button + textbox? There are many GUI libraries. Tkinter is part of the standard library and appears to be well-documented. https://docs.python.org/3/library/tkinter.html A