urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Даниил Рыжков
Hello, everyone! How can I get headers with urlretrieve? I want to send request and get headers with necessary information before I execute urlretrieve(). Or are there any alternatives for urlretrieve()? -- Regards, Daniil -- http://mail.python.org/mailman/listinfo/python-list

Re: how to call a function for evry 10 secs

2011-07-01 Thread Ulrich Eckhardt
Ulrich Eckhardt wrote: > I'll take this to the developers mailinglist and see if they > consider the behaviour a bug. Filed as bug #12459. Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to chain processes together on a pipeline

2011-07-01 Thread Peter Otten
Andrew Berg wrote: > Okay, so I've refactored those except WindowsError blocks into calls to > a function and fixed the os.devnull bug, but I still can't get the > triple chain working. I added calls to ffmpeg_proc.stdout.close() and > sox_proc.stdout.close(), but I really am not sure where to put

Re: urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Chris Rebert
On Fri, Jul 1, 2011 at 12:03 AM, Даниил Рыжков wrote: > Hello, everyone! > > How can I get headers with urlretrieve? I want to send request and get > headers with necessary information before I execute urlretrieve(). Or > are there any alternatives for urlretrieve()? You can use regular urlopen()

Re: urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Peter Otten
Даниил Рыжков wrote: > How can I get headers with urlretrieve? I want to send request and get > headers with necessary information before I execute urlretrieve(). Or > are there any alternatives for urlretrieve()? It's easy to do it manually: >>> import urllib2 Connect to website and inspect h

Re: Trying to chain processes together on a pipeline

2011-07-01 Thread Andrew Berg
On 2011.07.01 02:26 AM, Peter Otten wrote: > I can't reproduce your setup, but I'd try using communicate() instead of > wait() and close(). I don't really know what communicate() does. The docs don't give much info or any examples (that explain communicate() anyway), and don't say when communicate

Re: Trying to chain processes together on a pipeline

2011-07-01 Thread Chris Rebert
On Fri, Jul 1, 2011 at 1:02 AM, Andrew Berg wrote: > On 2011.07.01 02:26 AM, Peter Otten wrote: >> I can't reproduce your setup, but I'd try using communicate() instead of >> wait() and close(). > I don't really know what communicate() does. "Read data from stdout and stderr, until end-of-file is

Re: urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Даниил Рыжков
Thanks, everyone! Problem solved. -- Regards, Daniil -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Даниил Рыжков
Hello again! Another question: urlopen() reads full file's content, but how can I get page by small parts? Regards, Daniil -- http://mail.python.org/mailman/listinfo/python-list

FOX Toolkit

2011-07-01 Thread Gisle Vanem
In http://docs.python.org/faq/gui.html I came across FOX Toolkit and the binding FXPy. The latter, it seems is no longer officially supported (hasn't for the last 7-8 years). So my question. Has anybody to your knowledge tweaked FOX and FXPy to work with Python 2.7? --gv -- http://mail.python

Re: Using decorators with argument in Python

2011-07-01 Thread John Posner
On 2:59 PM, Ethan Furman wrote: > def __call__(self, func=None): > if func is None: > return self._call() > self.func = func > return self > def _call(self): > print("\n" + self.char * 50) > self.func() > print(self.char * 50 +

Re: how to call a function for evry 10 secs

2011-07-01 Thread Rune Strand
from threading import Timer def Func_to_call: do_stuff() my_timer = Timer(10, Func_to_call) my_timer.start() -- http://mail.python.org/mailman/listinfo/python-list

An ODBC interface for Python 3?

2011-07-01 Thread kozmikyak
Does anyone here have a Python 3 environment that can access MSSQL using SQLAlchemy, running on a Windows 7 box? If so, I would like some assistance making it happen. The last post on this was mid-2010. It was mentioned that pyodbc had a Python 3 branch. I've been unable to get it compiled and

Re: urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Kushal Kumaran
On Fri, Jul 1, 2011 at 2:23 PM, Даниил Рыжков wrote: > Hello again! > Another question: urlopen() reads full file's content, but how can I > get page by small parts? > Set the Range header for HTTP requests. The format is specified here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec

Re: urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Chris Rebert
On Fri, Jul 1, 2011 at 1:53 AM, Даниил Рыжков wrote: > Hello again! > Another question: urlopen() reads full file's content, but how can I > get page by small parts? I don't think that's true. Just pass .read() the number of bytes you want to read, just as you would with an actual file object. C

Re: ANN: pyparsing 1.5.6 released!

2011-07-01 Thread Waldek M.
Dnia Thu, 30 Jun 2011 23:09:18 -0700 (PDT), Paul McGuire napisał(a): > After about 10 months, there is a new release of pyparsing, version > 1.5.6. This release contains some small enhancements, some bugfixes, > and some new examples. Thanks! That is great news. I'm not using pyparsing right now

Re: Enhanced dir() function

2011-07-01 Thread Tim Chase
On 06/30/2011 11:29 PM, Steven D'Aprano wrote: The dir() function is designed for interactive use, inspecting objects for the names of attributes and methods. Here is an enhanced version that allows you to pass a glob to filter the names you see: Comments and improvements welcome. Having not

Re: Enhanced dir() function

2011-07-01 Thread Ethan Furman
Tim Chase wrote: If it came in as an effortless (i.e. O(1) where I do it once and never again; not an O(n) where n=the number of times I invoke Python) default replacement for dir(), I'd reach for it a lot more readily. I seem to recall there's some environment-var or magic file-name that gets

Re: Enhanced dir() function

2011-07-01 Thread Steven D'Aprano
Tim Chase wrote: > On 06/30/2011 11:29 PM, Steven D'Aprano wrote: >> The dir() function is designed for interactive use, inspecting objects >> for the names of attributes and methods. >> >> Here is an enhanced version that allows you to pass a glob to filter the >> names you see: >> >> Comments an

Nested/Sub Extensions in Python

2011-07-01 Thread H Linux
Dear all, I am currently fighting with a problem writing a set of Python extensions in C. I want to structure the whole package (here called smt for sub-module test) into different sub-modules, e.g. according to this layout: smt.foo.func() I can only build a module >import foo >print foo.func(1,

How to get a dateiled process information on windows?

2011-07-01 Thread Leandro Ferreira
I need to write an application that monitors the memory consumption of a process, there is some library that facilitates this work? I searched on google found nothing more interesting. Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a dateiled process information on windows?

2011-07-01 Thread Tim Golden
On 01/07/2011 21:06, Leandro Ferreira wrote: I need to write an application that monitors the memory consumption of a process, there is some library that facilitates this work? I searched on google found nothing more interesting. Have a look at WMI TJG -- http://mail.python.org/mailman/listinf

Does anyone know of a python tapi module

2011-07-01 Thread Alister Ware
The subject probably say is all but to elaborate. I am looking for a way to communicate with a tapi driver for a PBX so I can experiment with creating some CTI (Computer Telephony Integration) software. -- -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get a dateiled process information on windows?

2011-07-01 Thread Christian Heimes
Am 01.07.2011 22:06, schrieb Leandro Ferreira: > I need to write an application that monitors the memory consumption of > a process, there is some library that facilitates this work? > I searched on google found nothing more interesting. Have a look at psutil http://code.google.com/p/psutil/ . It

Re: Nested/Sub Extensions in Python

2011-07-01 Thread Carl Banks
On Friday, July 1, 2011 1:02:15 PM UTC-7, H Linux wrote: > Once I try to nest this, I cannot get the module to load anymore: > >import smt.bar > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named bar [snip] > PyMODINIT_FUNC > initbar(void) > { > Py_In

Re: urllib, urlretrieve method, how to get headers?

2011-07-01 Thread Даниил Рыжков
Thanks, everyone! Problem solved. -- Regards, Daniil -- http://mail.python.org/mailman/listinfo/python-list

Re: Nested/Sub Extensions in Python

2011-07-01 Thread Corey Richardson
Excerpts from H Linux's message of Fri Jul 01 16:02:15 -0400 2011: > Dear all, > > I am currently fighting with a problem writing a set of Python > extensions in C. If you haven't seen it yet, Cython is a *very* nice tool for writing C extensions. http://cython.org/ -- Corey Richardson "Those

subtle error slows code by 10x (builtin sum()) - replace builtin sum without using import?

2011-07-01 Thread bdb112
First a trap for new players, then a question to developers Code accelerated by numpy can be slowed down by a large factor is you neglect to import numpy.sum . from timeit import Timer frag = 'x=sum(linspace(0,1,1000))' Timer(frag ,setup='from numpy import linspace').timeit(1000) # 0.6 sec Timer(

Re: subtle error slows code by 10x (builtin sum()) - replace builtin sum without using import?

2011-07-01 Thread Albert Hopkins
On Friday, July 1 at 19:17 (-0700), bdb112 said: > Question: > Can I replace the builtin sum function globally for test purposes so > that my large set of codes uses the replacement? > > The replacement would simply issue warnings.warn() if it detected an > ndarray argument, then call the origi

Re: Is the Usenet to mailing list gateway borked?

2011-07-01 Thread TP
On Thu, Jun 30, 2011 at 11:41 AM, Thomas 'PointedEars' Lahn wrote: > Thomas Guettler wrote: > >> On 30.06.2011 03:24, Thomas 'PointedEars' Lahn wrote: >>> Andrew Berg wrote: […] >>> >>> As for your question in the Subject, I do not know since I am reading the >>> newsgroup. >>> >>> Therefore,

Re: Is the Usenet to mailing list gateway borked?

2011-07-01 Thread Chris Angelico
On Fri, Jul 1, 2011 at 8:33 PM, TP wrote: > Not sure if this is relevant. I use mail.google.com to follow mailing > lists and a large proportion of python-list traffic ends up in my > gmail spam folder for some reason? Set a filter (you can "Filter messages like this") that says "Never spam". Tha

Re: subtle error slows code by 10x (builtin sum()) - replace builtin sum without using import?

2011-07-01 Thread Chris Torek
In article bdb112 wrote: >First a trap for new players, then a question to developers > >Code accelerated by numpy can be slowed down by a large factor is you >neglect to import numpy.sum . > >from timeit import Timer >frag = 'x=sum(linspace(0,1,1000))' >Timer(frag ,setup='from numpy import lins

Re: how to call a function for evry 10 secs

2011-07-01 Thread Rune
>Dennis Lee Bieber: > Timer() is a one-shot; per the OPs requirements even it would need > to be placed within a loop to invoke multiple calls -- so there isn't > much gain in terms of lines of code... And worse, since it calls the > function asynchronously and not sequentially, a delay time