Downloading and Sending the file to the client's browser

2017-02-02 Thread Νίκος Βέργος
== # Give user the file requested url = "http://superhost.gr/data/files/%s"; % realfile response = requests.get( url, stream=True ) with open( realfile, 'wb' ) as f: f.write( response.content ) == The above code will

PyDictObject to NSDictionary

2017-02-02 Thread Charles Heizer
Hello, I'm embedding python in to my Objective-C app and I need to know how do I convert a PyDictObject (PyObject) to a NSDictionary? Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: What is meant by "Duty Cycle" when referring to laser printers?

2017-02-02 Thread Chris Green
MRAB wrote: > On 2017-02-02 19:30, Chris Green wrote: > > Where is GDK_BUTTON_PRESS defined in gtk2, i.e. how can I use it when > > testing for button presses? > > > > I have tried gtk.GDK_BUTTON_PRESS and gtk.gdk.GDK_BUTTON_PRESS but > > both result in "object has no attribute 'GDK_BUTTON_PRESS'"

Re: ANN: psutil 5.1.0 with hardware sensors released

2017-02-02 Thread Hans-Peter Jansen
On Mittwoch, 1. Februar 2017 21:54:06 Giampaolo Rodola' wrote: > Hello all, > I'm glad to announce the release of psutil 5.1.1: ^ Guess, you meant to say 5.1.0 here, or probably your time machine broke ;) Cheers, Pete -- https://mail.python.org/ma

Re: Python3 using requests to grab HTTP Auth Data

2017-02-02 Thread Νίκος Βέργος
Τη Πέμπτη, 2 Φεβρουαρίου 2017 - 9:38:47 μ.μ. UTC+2, ο χρήστης Ian έγραψε: > If you want the user to authenticate to your script and not just > whatever file you're redirecting them to, then you need to configure > the server to require authorization for the script and not just the > redirect targe

Re: What is meant by "Duty Cycle" when referring to laser printers?

2017-02-02 Thread MRAB
On 2017-02-02 19:30, Chris Green wrote: Where is GDK_BUTTON_PRESS defined in gtk2, i.e. how can I use it when testing for button presses? I have tried gtk.GDK_BUTTON_PRESS and gtk.gdk.GDK_BUTTON_PRESS but both result in "object has no attribute 'GDK_BUTTON_PRESS'" errors. Does this help? http

Re: Is requests[security] required for python 3.5+ ?

2017-02-02 Thread Chris Warrick
On 2 February 2017 at 20:41, Thomas Nyberg wrote: > Hello, > > I'm trying to understand whether requests[security] or just plain requests > should be installed for python 3.5. I.e. do the following packages need to > be installed: pyOpenSSL, cryptography,idna. > > The reason I'm asking is beca

Re: Python3 using requests to grab HTTP Auth Data

2017-02-02 Thread Ian Kelly
On Wed, Feb 1, 2017 at 5:22 PM, Νίκος Βέργος wrote: > > # Give user the file requested > > print(''' content="5;url=http://superhost.gr/data/files/%s";>''' % realfile) > > authuser = os.environ.get( 'REMOTE_USER', 'Άγνωστος' ) > print( authuser ) >

Is requests[security] required for python 3.5+ ?

2017-02-02 Thread Thomas Nyberg
Hello, I'm trying to understand whether requests[security] or just plain requests should be installed for python 3.5. I.e. do the following packages need to be installed: pyOpenSSL, cryptography, idna. The reason I'm asking is because I'm moving an application to python 3 and I am testing ou

Re: What is meant by "Duty Cycle" when referring to laser printers?

2017-02-02 Thread Chris Green
Where is GDK_BUTTON_PRESS defined in gtk2, i.e. how can I use it when testing for button presses? I have tried gtk.GDK_BUTTON_PRESS and gtk.gdk.GDK_BUTTON_PRESS but both result in "object has no attribute 'GDK_BUTTON_PRESS'" errors. -- Chris Green · -- https://mail.python.org/mailman/listinfo/p

user+sys time bigger than real time (with threads)

2017-02-02 Thread Marco Buttu
Let's have the following example: $ cat foo.py from threading import Thread, Lock result = 0 lock = Lock() def task(): global result for i in range(10**6): lock.acquire() result += 1 lock.release() if __name__ == '__main__': t1, t2 = Thread(target=task), Thr

how i can write command to run...........This is code to convert .json file to .csv......Input file name is sample.json

2017-02-02 Thread muetced124
import sys import json import csv ## # Convert to string keeping encoding in mind... ## def to_string(s): try: return str(s) except: #Change the encoding type if needed return s.encode('utf-8') ## # This function converts an item like # { # "item_1":"value_11",

Re: How to add months to a date (datetime object)?

2017-02-02 Thread bajimicbiga
for start of month to the beginning of next month from datetime import timedelta from dateutil.relativedelta import relativedelta end_date = start_date + relativedelta(months=delta_period) + timedelta(days=-delta_period) -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't module finalization delete names as expected?

2017-02-02 Thread dieter
Philippe Proulx writes: > ... > It feels like `bread` is never deleted in the module initialization > situation, but I don't know why: the only reference to the Bread Python > object is this `bread` name in the module... what could prevent this > object's __del__() method to be called? It works wh

Re: Is there a lint tool that can spot unused classes/methods/attributes/functions/etc?

2017-02-02 Thread Peter Otten
Mark Summerfield wrote: > Suppose I have a project with an application .py file and various module > .py files all in the same directory, and after lots of refactoring and > other changes the modules contain lots of unused stuff. Is there a lint > tool that will spot the unused things so that I ca

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

2017-02-02 Thread Chris Green
Michael Torrie wrote: > 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. > > Howe

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

2017-02-02 Thread Chris Green
Michael Torrie wrote: > 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 Which is thus different from every

Is there a lint tool that can spot unused classes/methods/attributes/functions/etc?

2017-02-02 Thread Mark Summerfield
Suppose I have a project with an application .py file and various module .py files all in the same directory, and after lots of refactoring and other changes the modules contain lots of unused stuff. Is there a lint tool that will spot the unused things so that I can get rid of them? I've tried

Re: command line micro wiki written in Python

2017-02-02 Thread paul . wolf
On Tuesday, 31 January 2017 23:39:41 UTC, Ben Finney wrote: > The Python community has a stronger (?) preference for reStructuredText > format. Can that be the default? > > That is, I want my text files to be named ‘foo’ (no suffix) or ‘foo.txt’ > (because they're primarily text), and have the d