Python packet capture utility

2010-02-01 Thread VYAS ASHISH M-NTB837
Dear All I want to capture tcp packets in python. I need to do this on both Windows and Linux on python3.1 I came across the following: http://sourceforge.net/projects/pycap/ http://sourceforge.net/projects/pylibpcap/ http://code.google.com/p/pypcap/ http://oss.coresecurity.com/projects/pcapy.h

Re: converting XML to hash/dict/CustomTreeCtrl

2010-02-01 Thread Stefan Behnel
Astan Chee, 01.02.2010 23:34: > I have xml files that I want to convert to a hash/dict and then further > placed in a wx CustomTreeCtrl based on the structure. The problem I am > having now is that the XML file is very unusual and there aren't any > unique identifiers to be put in a dict and becaus

Logging oddity: handlers mandatory in every single logger?

2010-02-01 Thread Masklinn
When trying to load the following config file, I get an error ``ConfigParser.NoOptionError: No option 'handlers' in section: 'logger_0'`` (in both Python 2.6.4 and Python 3.1.1 on OSX, obviously ConfigParser is spelled configparser in 3.1): [loggers] keys=root,0 [handlers] keys

search engine for python source code

2010-02-01 Thread purui
I developed a source code search engine for python (http:// nullege.com). It helps you find samples from open source projects. Unlike other code search engines, it really understands python syntax and generates more relative results. I'm working on expend the source code collection now. Give it a t

How to use python-mms to send mms

2010-02-01 Thread guptha
Hi group, After hours of googling i found out that we can use python-mms to send mms from our PC connected with GSM cell phone/Modem. I could appreciate if some one guide me with a example of sending an mms using python-mms. I am using Ubuntu9.10 .I am trying to send a ring tone via MMS. Thanks G

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Steve Holden
Oltmans wrote: > On Feb 2, 2:14 am, Steve Holden wrote: >> Should not tee be subclassing test, not unittest.TestCase? >> > > Thank you, Steve. This worked, but I've not clue why? Can you please > enlighten me why sub-classing 'test' made it happen? Please. Thanks > again. unittest.TestCase doesn

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Oltmans
On Feb 2, 2:14 am, Steve Holden wrote: > > Should not tee be subclassing test, not unittest.TestCase? > Thank you, Steve. This worked, but I've not clue why? Can you please enlighten me why sub-classing 'test' made it happen? Please. Thanks again. > regards >  Steve > -- > Steve Holden          

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Michele Simionato
Wanting the same methods to be attached to different classes often is a code smell (perhaps it is not your case and then use setattr as others said). Perhaps you can just leave such methods outside any class. I would suggest you to use a testing framework not based on inheritance (i.e. use nose or

Re: Problems embedding python 2.6 in C++

2010-02-01 Thread Paul
Thanks Gabriel, I've managed to get it working and so far stable... What wasn't working reliably: mycppclass mycppclass::mycppclass() m_mypymodule = PyImport_Import(pModuleName) mycppclass::~ mycppclass() Py_XDECREF(m_mypymodule) mycppclass::callpy(funcname, args...)

Re: HTML Parser which allows low-keyed local changes (upon serialization)

2010-02-01 Thread Tim Arnold
"Robert" wrote in message news:hk729b$na...@news.albasani.net... > Stefan Behnel wrote: >> Robert, 01.02.2010 14:36: >>> Stefan Behnel wrote: Robert, 31.01.2010 20:57: > I tried lxml, but after walking and making changes in the element > tree, > I'm forced to do a full serializ

Re: Modules failing to add runtime library path info at link time

2010-02-01 Thread cjblaine
On Feb 1, 11:04 pm, cjblaine wrote: > On Feb 1, 8:00 pm, Christian Heimes wrote: > > > > > cjblaine wrote: > > > Where/how can I configure the appropriate portion of our Python > > > install to do 100% the right thing instead of just 50% (-L)? > > > Python's distutils doesn't alter the library se

Re: How to guard against bugs like this one?

2010-02-01 Thread Carl Banks
On Feb 1, 7:33 pm, Tim Chase wrote: > Stephen Hansen wrote: > > First, I don't shadow built in modules. Its really not very hard to avoid. > > Given the comprehensive nature of the batteries-included in > Python, it's not as hard to accidentally shadow a built-in, > unknown to you, but yet that is

Re: Modules failing to add runtime library path info at link time

2010-02-01 Thread cjblaine
On Feb 1, 8:00 pm, Christian Heimes wrote: > cjblaine wrote: > > Where/how can I configure the appropriate portion of our Python > > install to do 100% the right thing instead of just 50% (-L)? > > Python's distutils doesn't alter the library search path unless you tell > it explicitly. > > > A sp

Re: How to guard against bugs like this one?

2010-02-01 Thread Carl Banks
On Feb 1, 6:34 pm, kj wrote: > Both scripts live in a directory filled with *hundreds* little > one-off scripts like the two of them.  I'll call this directory > myscripts in what follows. [snip] > How can the average Python programmer guard against this sort of > time-devouring bug in the futur

Re: How to guard against bugs like this one?

2010-02-01 Thread Stephen Hansen
On Mon, Feb 1, 2010 at 7:33 PM, Tim Chase wrote: > Stephen Hansen wrote: > >> First, I don't shadow built in modules. Its really not very hard to avoid. >> > > Given the comprehensive nature of the batteries-included in Python, it's > not as hard to accidentally shadow a built-in, unknown to you,

Re: Optimized bytecode in exec statement

2010-02-01 Thread Steven D'Aprano
On Mon, 01 Feb 2010 22:19:43 -0300, Gabriel Genellina wrote: > En Mon, 01 Feb 2010 20:05:16 -0300, Hermann Lauer > escribió: > >> while trying to optimize some unpack operations with self compiling >> code I wondered howto invoke the optimization in the exec statement. >> Even starting with -O o

Re: How to guard against bugs like this one?

2010-02-01 Thread Tim Chase
Stephen Hansen wrote: First, I don't shadow built in modules. Its really not very hard to avoid. Given the comprehensive nature of the batteries-included in Python, it's not as hard to accidentally shadow a built-in, unknown to you, but yet that is imported by a module you are using. The cl

Re: How to guard against bugs like this one?

2010-02-01 Thread Steven D'Aprano
On Tue, 02 Feb 2010 02:34:07 +, kj wrote: > I just spent about 1-1/2 hours tracking down a bug. > > An innocuous little script, let's call it buggy.py, only 10 lines long, > and whose output should have been, at most two lines, was quickly > dumping tens of megabytes of non-printable characte

Re: How to guard against bugs like this one?

2010-02-01 Thread Roy Smith
In article , kj wrote: > Through a *lot* of trial an error I finally discovered that the > root cause of the problem was the fact that, in the same directory > as buggy.py, there is *another* innocuous little script, totally > unrelated, whose name happens to be numbers.py. > [...] > It turns ou

Re: HTML Parser which allows low-keyed local changes?

2010-02-01 Thread Nobody
On Sun, 31 Jan 2010 20:57:31 +0100, Robert wrote: > I tried lxml, but after walking and making changes in the element > tree, I'm forced to do a full serialization of the whole document > (etree.tostring(tree)) - which destroys the "human edited" format > of the original HTML code. > makes it r

Re: Python and Ruby

2010-02-01 Thread John Bokma
Nobody writes: > On Mon, 01 Feb 2010 14:35:57 -0800, Jonathan Gardner wrote: > >>> If it was common-place to use Curried functions and partial application in >>> Python, you'd probably prefer "f a b c" to "f(a)(b)(c)" as well. >> >> That's just the point. It isn't common to play with curried fun

Re: How to guard against bugs like this one?

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 6:34 PM, kj wrote: > I just spent about 1-1/2 hours tracking down a bug. > Through a *lot* of trial an error I finally discovered that the > root cause of the problem was the fact that, in the same directory > as buggy.py, there is *another* innocuous little script, totally

Re: Python and Ruby

2010-02-01 Thread Nobody
On Mon, 01 Feb 2010 14:13:38 -0800, Jonathan Gardner wrote: > I judge a language's simplicity by how long it takes to explain the > complete language. That is, what minimal set of documentation do you > need to describe all of the language? That's not a particularly good metric, IMHO. A simple "

Re: How to guard against bugs like this one?

2010-02-01 Thread Chris Colbert
This is kinda akin to creating your own libc.so in a folder where your compiling and executing c programs and then wondering why your program bugs out On Mon, Feb 1, 2010 at 9:34 PM, kj wrote: > > > I just spent about 1-1/2 hours tracking down a bug. > > An innocuous little script, let's cal

Re: How to guard against bugs like this one?

2010-02-01 Thread Stephen Hansen
> > (This is no mere Python "wart"; this is a suppurating chancre, and > the fact that it remains unfixed is a neverending source of puzzlement > for me.) > > How can the average Python programmer guard against this sort of > time-devouring bug in the future (while remaining a Python programmer)? >

Re: Python and Ruby

2010-02-01 Thread John Bokma
Jonathan Gardner writes: > One of the bad things with languages like perl FYI: the language is called Perl, the program that executes a Perl program is called perl. > without parentheses is that getting a function ref is not obvious. You > need even more syntax to do so. In perl: > > foo();

How to guard against bugs like this one?

2010-02-01 Thread kj
I just spent about 1-1/2 hours tracking down a bug. An innocuous little script, let's call it buggy.py, only 10 lines long, and whose output should have been, at most two lines, was quickly dumping tens of megabytes of non-printable characters to my screen (aka gobbledygook), and in the process

Re: Python and Ruby

2010-02-01 Thread Nobody
On Mon, 01 Feb 2010 14:35:57 -0800, Jonathan Gardner wrote: >> If it was common-place to use Curried functions and partial application in >> Python, you'd probably prefer "f a b c" to "f(a)(b)(c)" as well. > > That's just the point. It isn't common to play with curried functions > or monads or an

Re: Python and Ruby

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 6:14 PM, MRAB wrote: > Nobody wrote: >> On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use:  f 2 3 If you want the func

Re: Python and Ruby

2010-02-01 Thread MRAB
Nobody wrote: On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use: f 2 3 If you want the function itself you use: f How do you call a function of no arguments?

Re: Python and Ruby

2010-02-01 Thread Nobody
On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: >> for example, in if you have a function 'f' which takes two parameters to >> call the function and get the result you use: >> >> f 2 3 >> >> If you want the function itself you use: >> >>f > > How do you call a function of no ar

Re: Optimized bytecode in exec statement

2010-02-01 Thread Gabriel Genellina
En Mon, 01 Feb 2010 20:05:16 -0300, Hermann Lauer escribió: while trying to optimize some unpack operations with self compiling code I wondered howto invoke the optimization in the exec statement. Even starting with -O or -OO yields in Python 2.5.2 the same dis.dis code, which is appended

Re: Optimized bytecode in exec statement

2010-02-01 Thread Christian Heimes
Terry Reedy wrote: > Currently, as far as I know, -0 just removes asserts. -O (not -0) also sets __debug__ to False. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: For loop searching takes too long!

2010-02-01 Thread Steven D'Aprano
On Mon, 01 Feb 2010 14:04:01 -0800, Jonathan Gardner wrote: > Having worked with datasets that are truly enormous, whenever I see a > list that is unbounded (as this appears to be), I freak out because > unbounded can be a really, really big number. Might as well write > software that works for th

Re: Optimized bytecode in exec statement

2010-02-01 Thread Terry Reedy
On 2/1/2010 6:05 PM, Hermann Lauer wrote: Dear All, while trying to optimize some unpack operations with self compiling code I wondered howto invoke the optimization in the exec statement. Even starting with -O or -OO yields in Python 2.5.2 the same dis.dis code, which is appended below. Curre

Re: Modules failing to add runtime library path info at link time

2010-02-01 Thread Christian Heimes
cjblaine wrote: > Where/how can I configure the appropriate portion of our Python > install to do 100% the right thing instead of just 50% (-L)? Python's distutils doesn't alter the library search path unless you tell it explicitly. > A specific example -- note the -L and lack of -R (Solaris buil

Re: PEP 3147 - new .pyc format

2010-02-01 Thread Steven D'Aprano
On Mon, 01 Feb 2010 21:19:52 +0100, Daniel Fetchinson wrote: >> Personally, I think it is a terribly idea to keep the source file and >> byte code file in such radically different places. They should be kept >> together. What you call "clutter" I call having the files that belong >> together kept

Re: recv_into(bytearray) complains about a "pinned buffer"

2010-02-01 Thread Andrew Dalke
On Feb 2, 12:12 am, Martin v. Loewis wrote: > My recommendation would be to not use recv_into in 2.x, but only in 3.x. > I don't think that's the full solution. The array module should also > implement the new buffer API, so that it would also fail with the old > recv_into. Okay. But recv_into wa

Optimized bytecode in exec statement

2010-02-01 Thread Hermann Lauer
Dear All, while trying to optimize some unpack operations with self compiling code I wondered howto invoke the optimization in the exec statement. Even starting with -O or -OO yields in Python 2.5.2 the same dis.dis code, which is appended below. My interest would be to reduce the LOAD_FAST ops

Re: interaction of mode 'r+', file.write(), and file.tell(): a bug or undefined behavior?

2010-02-01 Thread Aahz
In article <4b617f4...@dnews.tpgi.com.au>, Lie Ryan wrote: > >f = open('input.txt', 'r+') >for line in f: >s = line.replace('python', 'PYTHON') ># f.tell() >f.write(s) > >When f.tell() is commented, 'input.txt' does not change; but when >uncommented, the f.write() succeeded writing in

Re: Python and Ruby

2010-02-01 Thread Paul Rubin
Jonathan Gardner writes: > I judge a language's simplicity by how long it takes to explain the > complete language. That is, what minimal set of documentation do you > need to describe all of the language? With a handful of statements, > and a very short list of operators, Python beats out every l

Re: recv_into(bytearray) complains about a "pinned buffer"

2010-02-01 Thread Martin v. Loewis
Antoine Pitrou wrote: > Le Mon, 01 Feb 2010 03:30:56 +0100, Martin v. Loewis a écrit : >>> Is this a bug in Python 2.6 or a deliberate choice regarding >>> implementation concerns I don't know about? >> It's actually a bug also that you pass an array; doing so *should* give >> the very same error.

Re: myths about python 3

2010-02-01 Thread Anssi Saari
Blog writes: > Where did you come up with that information? Almost all of the major > distros ship with 2.6.x - CentOS, OpenSuSe, Ubuntu, Fedora. (Debian > does ship with 2.5, but the next major release "sid' is due out in Q2) I don't see Python 2.6 in my CentOS 5.4 installation. All I see is 2.

Re: Python and Ruby

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 2:28 PM, Jonathan Gardner wrote: > On Jan 31, 3:01 am, rantingrick wrote: >> On Jan 30, 10:43 am, Nobody wrote: >> > That's also true for most functional languages, e.g. Haskell and ML, as >> > well as e.g. Tcl and most shells. Why require "f(x)" or "(f x)" if "f x" >> > w

Re: Iterating over a function call

2010-02-01 Thread Terry Reedy
On 2/1/2010 3:05 PM, Arnaud Delobelle wrote: You have itertools.consume which is close to what you want: consume(imap(func, iterable)) # 2.x consume(map(func, iterable)) # 3.x Consume is not in itertools. It is one of many recipes in the doc (9.7.2). For exhausting an iterator, co

Re: Problems embedding python 2.6 in C++

2010-02-01 Thread Gabriel Genellina
En Mon, 01 Feb 2010 18:21:56 -0300, Paul escribió: I'm extending some old Visual Studio 6 code to add embedded python scripting. It works fine most of the time but some python function calls do not work as expected. The C++ code is a multithreaded MFC application. I was assuming that it w

Re: Iterating over a function call

2010-02-01 Thread Terry Reedy
On 2/1/2010 11:50 AM, Gerald Britton wrote: Hi -- I have many sections of code like this: for value in value_iterator: value_function(value) I noticed that this does two things I don't like: 1. looks up "value_function" and "value" for each iteration, but "value_function" doesn'

Modules failing to add runtime library path info at link time

2010-02-01 Thread cjblaine
Hey everyone, this has been driving me crazy for long enough now that I'm motivated to post and find an answer. Before I pose my question, let me state that using LD_LIBRARY_PATH is not the answer :) We have things installed in odd places, such as very specific versions of libraries to link again

converting XML to hash/dict/CustomTreeCtrl

2010-02-01 Thread Astan Chee
Hi, I have xml files that I want to convert to a hash/dict and then further placed in a wx CustomTreeCtrl based on the structure. The problem I am having now is that the XML file is very unusual and there aren't any unique identifiers to be put in a dict and because there are no unique variabl

Re: Python and Ruby

2010-02-01 Thread Jonathan Gardner
On Jan 31, 12:43 pm, Nobody wrote: > > If it was common-place to use Curried functions and partial application in > Python, you'd probably prefer "f a b c" to "f(a)(b)(c)" as well. > That's just the point. It isn't common to play with curried functions or monads or anything like that in computer

Re: Iterating over a function call

2010-02-01 Thread Vlastimil Brom
2010/2/1 Gerald Britton : > Hi -- I have many sections of code like this: > >    for value in value_iterator: >         value_function(value) > > I noticed that this does two things I don't like: >... > -- > Gerald Britton > -- > http://mail.python.org/mailman/listinfo/python-list > Hi, just to ad

Re: ftp.storlines error

2010-02-01 Thread Gabriel Genellina
En Sun, 31 Jan 2010 19:07:44 -0300, Mik0b0 escribió: Good day/night/etc. I am rather a newb in Python (learning Python 3). I am trying to create a small script for FTP file uploads on my home network. The script looks like this: from ftplib import FTP ftp=FTP('10.0.0.1') ftp.login('mike','***

Re: Python and Ruby

2010-02-01 Thread Jonathan Gardner
On Jan 31, 3:01 am, rantingrick wrote: > On Jan 30, 10:43 am, Nobody wrote: > > > That's also true for most functional languages, e.g. Haskell and ML, as > > well as e.g. Tcl and most shells. Why require "f(x)" or "(f x)" if "f x" > > will suffice? > > yuck! wrapping the arg list with parenthesis

Re: whassup? builtins? python3000? Naah can't be right?

2010-02-01 Thread Gabriel Genellina
En Sun, 31 Jan 2010 18:17:04 -0300, _wolf escribió: dear pythoneers, i would be very gladly accept any commentaries about what this sentence, gleaned from http://celabs.com/python-3.1/reference/executionmodel.html, is meant to mean, or why gods have decided this is the way to go. i antici

Re: Python and Ruby

2010-02-01 Thread Jonathan Gardner
On Jan 30, 8:43 am, Nobody wrote: > On Wed, 27 Jan 2010 15:29:05 -0800, Jonathan Gardner wrote: > > Python is much, much cleaner. I don't know how anyone can honestly say > > Ruby is cleaner than Python. > > I'm not familiar with Ruby, but most languages are cleaner than Python > once you get beyo

Re: OT: Instant Messenger Clients

2010-02-01 Thread Gabriel Genellina
En Sun, 31 Jan 2010 18:15:34 -0300, Victor Subervi escribió: I need to record my IM conversations. I'm using Gmal's IM client and I can't figure out how to do it, nor do I find any help googling it. Hard to believe... -- Gabriel Genellina --

Re: Processing XML File

2010-02-01 Thread jakecjacobson
On Jan 29, 2:41 pm, Stefan Behnel wrote: > Sells, Fred, 29.01.2010 20:31: > > > Google is your friend.  Elementtree is one of the better documented > > IMHO, but there are many modules to do this. > > Unless the OP provides some more information, "do this" is rather > underdefined. And sending som

Re: Function name unchanged in error message

2010-02-01 Thread Gabriel Genellina
En Sat, 30 Jan 2010 06:28:19 -0300, Peter Otten <__pete...@web.de> escribió: Gabriel Genellina wrote: En Fri, 29 Jan 2010 13:09:40 -0300, Michele Simionato escribió: On Jan 29, 2:30 pm, andrew cooke wrote: Is there any way to change the name of the function in an error message? In the ex

Problems embedding python 2.6 in C++

2010-02-01 Thread Paul
Hi, I'm extending some old Visual Studio 6 code to add embedded python scripting. It works fine most of the time but some python function calls do not work as expected. The C++ code is a multithreaded MFC application. I was assuming that it was GIL issues but I have tried using the manual locking

Re: starting a thread in a nother thread

2010-02-01 Thread Aahz
In article <4b60a661$0$1598$742ec...@news.sonic.net>, John Nagle wrote: > >If a C package called from Python crashes, the package is defective. >Nothing you can do from Python should be able to cause a segmentation >fault. ...unless you use ctypes. -- Aahz (a...@pythoncraft.com) <*>

CheddarGetter module for Python - easy recurring billing

2010-02-01 Thread Jason
We just released pychedder, an open source module for integrating CheddarGetter with Python (and Django): http://www.feedmagnet.com/blog/cheddargetter-for-python-and-django/ Anyone who's built commercial web app knows that payment processing can be one of the toughest pieces to put in place - and

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Steve Holden
Oltmans wrote: > Thank you for your help, Chris. Looks like I can now attach methods to > class 'tee'. However, after attaching methods to 'tee' when I try to > run them using suite.run() I don't see any of the methods running, I'm > sorry but I've no clue what's failing this. Any insights will be

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Oltmans
Thank you for your help, Chris. Looks like I can now attach methods to class 'tee'. However, after attaching methods to 'tee' when I try to run them using suite.run() I don't see any of the methods running, I'm sorry but I've no clue what's failing this. Any insights will be highly appreciated. Her

Re: libpcap and python

2010-02-01 Thread Terry Reedy
On 2/1/2010 7:47 AM, Mag Gam wrote: Hello All, I used tcpdump to capture data on my network. I would like to analyze the data using python -- currently using ethereal and wireshark. I would like to get certain type of packets (I can get the hex code for them), what is the best way to do this? L

Re: get error install MySQLdb on Mac OS X

2010-02-01 Thread Ned Deily
In article <2be17362-8a54-4a04-9671-0a0ff7266...@k2g2000pro.googlegroups.com>, "PS.OHM" wrote: > On Jan 29, 5:02 am, Sean DiZazzo wrote: > > On Jan 28, 12:53 pm, "PS.OHM" wrote: > > > I havegetsomeerrorwhen i install MySQLdb on Mac OS X > > > > > after i key command $python setup.py build The

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Gerald Britton
Or you could just do a mixin: tee.__class__.__bases__ = (test,) + tee.__class__.__bases__ On Mon, Feb 1, 2010 at 3:25 PM, Chris Rebert wrote: > On Mon, Feb 1, 2010 at 12:06 PM, Oltmans wrote: >> Hello Python gurus, >> >> I'm quite new when it comes to Python so I will appreciate any help. >>

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Carl Banks
On Feb 1, 12:06 pm, Oltmans wrote: > Hello Python gurus, > > I'm quite new when it comes to Python so I will appreciate any help. > Here is what I'm trying to do. I've two classes like below > > import new > import unittest > > class test(unittest.TestCase): >     def test_first(self): >         p

Re: Iterating over a function call

2010-02-01 Thread Gerald Britton
[snip[ > You have itertools.consume which is close to what you want: > >    consume(imap(func, iterable)) # 2.x > >    consume(map(func, iterable)) # 3.x > > HTH It does! Though in my case this is simpler: deque(imap(func, iterable), 0) since the recipe for consume just calls deque anyway w

Re: Adding methods from one class to another, dynamically

2010-02-01 Thread Chris Rebert
On Mon, Feb 1, 2010 at 12:06 PM, Oltmans wrote: > Hello Python gurus, > > I'm quite new when it comes to Python so I will appreciate any help. > Here is what I'm trying to do. I've two classes like below > > import new > import unittest > > class test(unittest.TestCase): >    def test_first(self):

Re: PEP 3147 - new .pyc format

2010-02-01 Thread Daniel Fetchinson
>> I also think the PEP is a great idea and proposes a solution to a real >> problem. But I also hear the 'directory clutter' argument and I'm really >> concerned too, having all these extra directories around (and quite a >> large number of them indeed!). > > Keep in mind that if you don't explici

Adding methods from one class to another, dynamically

2010-02-01 Thread Oltmans
Hello Python gurus, I'm quite new when it comes to Python so I will appreciate any help. Here is what I'm trying to do. I've two classes like below import new import unittest class test(unittest.TestCase): def test_first(self): print 'first test' def test_second(self): pr

Re: Iterating over a function call

2010-02-01 Thread Arnaud Delobelle
Gerald Britton writes: > Hi -- I have many sections of code like this: > > for value in value_iterator: > value_function(value) > > I noticed that this does two things I don't like: > > 1. looks up "value_function" and "value" for each iteration, but > "value_function" doesn't change

Re: Iterating over a function call

2010-02-01 Thread Diez B. Roggisch
So.I'm wondering if there is any interest in an apply() built-in function that would work like map() does in 2.x (calls the function with each value returned by the iterator) but return nothing. Maybe "apply" isn't the best name; it's just the first one that occurred to me. Or is this just s

Re: Python-list Digest, Vol 77, Issue 7 *

2010-02-01 Thread Gabriel Genellina
En Mon, 01 Feb 2010 07:26:13 -0300, Rohit Roger$ escribió: Help for datetime module Source code is : from datetime import datetime d = datetime(datetime.now().year, datetime.now().month, datetime.now().day, 11, 59, 0 ) print d And your problem is...? This is what I get: py> print d 2010

Re: create a string of variable lenght

2010-02-01 Thread Benjamin Kaplan
On Mon, Feb 1, 2010 at 12:00 PM, Tracubik wrote: > Il Sun, 31 Jan 2010 19:54:17 -0500, Benjamin Kaplan ha scritto: > >> First of all, if you haven't read this before, please do. It will make >> this much clearer. >> http://www.joelonsoftware.com/articles/Unicode.html > > i'm reading it right now,

Re: how to decode rtf characterset ?

2010-02-01 Thread M.-A. Lemburg
Stef Mientki wrote: > hello, > > I want to translate rtf files to unicode strings. > I succeeded in remove all the tags, > but now I'm stucked to the special accent characters, > like : > > "Vóór" > > the character "ó" is represented by the string r"\'f3", > or in bytes: 92, 39,102, 51 > so I t

Re: HTML Parser which allows low-keyed local changes (upon serialization)

2010-02-01 Thread M.-A. Lemburg
Robert wrote: > I think you confused the logical level of what I meant with "file > position": > Of course its not about (necessarily) writing back to the same open file > (OS-level), but regarding the whole serializiation string (wherever it > is finally written to - I typically write the auto-con

Re: [Edu-sig] odd drawing problem with turtle.py

2010-02-01 Thread kirby urner
On Mon, Feb 1, 2010 at 3:27 AM, Brian Blais wro > > I don't see where you've defined a Turtle class to instantiate sir. > > > Turtle is given in turtle.py. I should have subclassed it, but I was being > lazy. :) > > thanks for the fast replies! > > > > bb > > > No obvious need to subclass.

Re: HTML Parser which allows low-keyed local changes (upon serialization)

2010-02-01 Thread Robert
Stefan Behnel wrote: Robert, 01.02.2010 14:36: Stefan Behnel wrote: Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the "human edited" format of

Re: how to decode rtf characterset ?

2010-02-01 Thread MRAB
Stef Mientki wrote: hello, I want to translate rtf files to unicode strings. I succeeded in remove all the tags, but now I'm stucked to the special accent characters, like : "Vóór" the character "ó" is represented by the string r"\'f3", or in bytes: 92, 39,102, 51 so I think I need a way to t

Re: Python distutils build problems with MinGW

2010-02-01 Thread Andrej Mitrovic
Well, in any case this seems to be working ok for me now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python distutils build problems with MinGW

2010-02-01 Thread Andrej Mitrovic
On Feb 1, 5:44 pm, casevh wrote: > On Feb 1, 8:31 am, Andrej Mitrovic wrote: > > > > > On Feb 1, 4:03 am, Andrej Mitrovic wrote: > > > > On Feb 1, 2:59 am, Andrej Mitrovic wrote: > > > > > Hi, > > > > > I've made a similar post on the Cython mailing list, however I think > > > > this is more py

Re: create a string of variable lenght

2010-02-01 Thread Tracubik
Il Sun, 31 Jan 2010 19:54:17 -0500, Benjamin Kaplan ha scritto: > First of all, if you haven't read this before, please do. It will make > this much clearer. > http://www.joelonsoftware.com/articles/Unicode.html i'm reading it right now, thanks :-) [cut] > Solution to your problem: in addition

Re: Python distutils build problems with MinGW

2010-02-01 Thread Andrej Mitrovic
I've found the problem: For the windows Python 3.1.1 x86 installation, the file \Python31\Lib \Distutils\command\build_ext.py, has this: Line 313: self.compiler = new_compiler(compiler=None, But Python 2.6 has this line: Line 306: self.compiler = new_compiler(compiler=self.com

Re: how long a Str can be used in this python code segment?

2010-02-01 Thread Antoine Pitrou
Le Mon, 01 Feb 2010 01:33:09 -0800, Stephen.Wu a écrit : > > actually, I just use file.read(length) way, i just want to know what > exactly para of length I should set, I'm afraid length doesn't equal to > the amount of physical memory after trials... There's no exact length you "should" set, jus

Iterating over a function call

2010-02-01 Thread Gerald Britton
Hi -- I have many sections of code like this: for value in value_iterator: value_function(value) I noticed that this does two things I don't like: 1. looks up "value_function" and "value" for each iteration, but "value_function" doesn't change. 2. side effect of (maybe) leaking the

Re: Python distutils build problems with MinGW

2010-02-01 Thread casevh
On Feb 1, 8:31 am, Andrej Mitrovic wrote: > On Feb 1, 4:03 am, Andrej Mitrovic wrote: > > > > > > > On Feb 1, 2:59 am, Andrej Mitrovic wrote: > > > > Hi, > > > > I've made a similar post on the Cython mailing list, however I think > > > this is more python-specific. I'm having trouble setting up

Re: Python distutils build problems with MinGW

2010-02-01 Thread Andrej Mitrovic
On Feb 1, 4:03 am, Andrej Mitrovic wrote: > On Feb 1, 2:59 am, Andrej Mitrovic wrote: > > > > > Hi, > > > I've made a similar post on the Cython mailing list, however I think > > this is more python-specific. I'm having trouble setting up distutils > > to use MinGW instead of Visual Studio when b

ANN: Wing IDE 3.2.4 released

2010-02-01 Thread Stephan Deibel
Hi, Wingware has released version 3.2.4 of Wing IDE, our integrated development environment for the Python programming language. Wing IDE can be used on Windows, Linux, and OS X to develop Python code for web, GUI, and embedded scripting applications. Wing IDE provides auto-completion, call tip

Re: how long a Str can be used in this python code segment?

2010-02-01 Thread MRAB
Chris Rebert wrote: On Mon, Feb 1, 2010 at 1:17 AM, Stephen.Wu <54wut...@gmail.com> wrote: tmp=file.read() (very huge file) if targetStr in tmp: print "find it" else: print "not find" file.close() I checked if file.read() is huge to some extend, it doesn't work, but could any give me some

Re: Unable to install numpy

2010-02-01 Thread Robert Kern
On 2010-01-31 08:03 AM, vsoler wrote: On Jan 18, 9:08 pm, Robert Kern wrote: On 2010-01-18 14:02 PM, vsoler wrote: Hi all, I just download Numpy, and tried to install it using "numpy-1.4.0- win32-superpack-python2.6.exe" I get an error: "Python version 2.6 required, which was not found

Re: PEP 3147 - new .pyc format

2010-02-01 Thread Steven D'Aprano
On Mon, 01 Feb 2010 11:14:42 +0100, Daniel Fetchinson wrote: > I also think the PEP is a great idea and proposes a solution to a real > problem. But I also hear the 'directory clutter' argument and I'm really > concerned too, having all these extra directories around (and quite a > large number of

Re: libpcap and python

2010-02-01 Thread Grant Edwards
On 2010-02-01, Mag Gam wrote: > Hello All, > > I used tcpdump to capture data on my network. I would like to analyze > the data using python -- currently using ethereal and wireshark. > > I would like to get certain type of packets (I can get the hex code > for them), what is the best way to do th

Re: HTML Parser which allows low-keyed local changes (upon serialization)

2010-02-01 Thread Stefan Behnel
Robert, 01.02.2010 14:36: > Stefan Behnel wrote: >> Robert, 31.01.2010 20:57: >>> I tried lxml, but after walking and making changes in the element tree, >>> I'm forced to do a full serialization of the whole document >>> (etree.tostring(tree)) - which destroys the "human edited" format of the >>>

Re: HTML Parser which allows low-keyed local changes (upon serialization)

2010-02-01 Thread Robert
Robert wrote: Stefan Behnel wrote: Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the "human edited" format of the original HTML code. makes it

Re: [Edu-sig] odd drawing problem with turtle.py

2010-02-01 Thread Vern Ceder
Brian Blais wrote: On Jan 31, 2010, at 23:05 , John Posner wrote: Try commenting out this statement: self.turtle.tracer(False) That helps on Python 2.6.4. interesting. It seems as if the tracer property is a global one: Actually, the tracer method that does the work is part of the T

Re: HTML Parser which allows low-keyed local changes (upon serialization)

2010-02-01 Thread Robert
Stefan Behnel wrote: Robert, 31.01.2010 20:57: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the "human edited" format of the original HTML code. makes it rather unreadab

Re: Python and Ruby

2010-02-01 Thread Steve Holden
Terry Reedy wrote: > On 1/31/2010 7:25 PM, Steven D'Aprano wrote: >> On Sun, 31 Jan 2010 15:40:36 -0800, Chris Rebert wrote: >> >>> On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano >>> wrote: On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote: > In most functional languages you just name

Re: User-defined exceptions from 2.6

2010-02-01 Thread Joan Miller
On 1 feb, 12:45, Steven D'Aprano wrote: > On Mon, 01 Feb 2010 02:19:39 -0800, Joan Miller wrote: > > Which is the best way to create user-defined exceptions since that > > *BaseException.message* is deprecated in Python 2.6 ? > > Inherit from an existing exception. > > >>> class MyValueException(V

Re: Python and Ruby

2010-02-01 Thread Steve Holden
Steven D'Aprano wrote: > On Sun, 31 Jan 2010 22:43:56 -0800, alex23 wrote: > >> Steven D'Aprano wrote: >>> You're using that term wrong. It looks to me that you don't actually >>> know what a straw man argument is. A straw man argument is when >>> somebody responds to a deliberately weakened or i

  1   2   >