Re: Broken pipe

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 11:11 PM, Ron Eggler wrote: > On May 6, 2010 10:37:14 pm Chris Rebert wrote: >> On Thu, May 6, 2010 at 10:27 PM, cerr wrote: >> > Hi There, >> > >> > I'm very new to Python and i wanna write a script that sends a certain >> > string to a server. The code I came up with look

Re: Broken pipe

2010-05-06 Thread Ron Eggler
On May 6, 2010 10:37:14 pm Chris Rebert wrote: > On Thu, May 6, 2010 at 10:27 PM, cerr wrote: > > Hi There, > > > > I'm very new to Python and i wanna write a script that sends a certain > > string to a server. The code I came up with looks like this: > > #!/usr/bin/python > > > > import sys > >

Re: Broken pipe

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 10:27 PM, cerr wrote: > Hi There, > > I'm very new to Python and i wanna write a script that sends a certain > string to a server. The code I came up with looks like this: > #!/usr/bin/python > > import sys > import string > > from socket import * > usage="USAGE: "+sys.argv[

Re: [Python-ideas] division oddness

2010-05-06 Thread Xavier Ho
On Fri, May 7, 2010 at 12:14 PM, Chris Rebert wrote: > Personally, I find the following the most unintuitive: > divmod(-11, 3) == (-4, 1) > > So, we overshoot -11 and then add 1 to go back to the right place? > That violates my intuitive thought that abs((n//d)*d) <= abs(n) ought to > hold. > Ha

Broken pipe

2010-05-06 Thread cerr
Hi There, I'm very new to Python and i wanna write a script that sends a certain string to a server. The code I came up with looks like this: #!/usr/bin/python import sys import string from socket import * usage="USAGE: "+sys.argv[0]+" "; if len(sys.argv) != 3: print usage;

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Tim Roberts
Richard Lamboj wrote: > >Thank you for the nice sample, but what is with multiple inheritance in your >sample? I mean the super call. Why not _MyClass.blah(self, arg). Because then I have to remember to change the name if I should happen to change the base class, or copy this code into another c

Re: idiomatic way to collect and report multiple exceptions?

2010-05-06 Thread Terry Reedy
On 5/6/2010 11:50 PM, Ben Cohen wrote: Is there a pythonic way to collect and display multiple exceptions at the same time? For example let's say you're trying to validate the elements of a list and you'd like to validate as many of the elements as possible in one run and still report exception'

Re: [Python-ideas] division oddness

2010-05-06 Thread Terry Reedy
On Thu, May 6, 2010 at 5:43 PM, Mathias Panzenböck Shouldn't by mathematical definition -x // y be the same as -(x// y)? Tradeoffs, tradeoffs. Most everyone agrees on this rule for the relation between // and %: x == y*(x//y) + x%y If // is defined as above, then, for instance, x%2 has 3

Re: idiomatic way to collect and report multiple exceptions?

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 8:50 PM, Ben Cohen wrote: > Is there a pythonic way to collect and display multiple exceptions at the > same time? > > For example let's say you're trying to validate the elements of a list and > you'd like to validate as many of the elements as possible in one run and >

idiomatic way to collect and report multiple exceptions?

2010-05-06 Thread Ben Cohen
Is there a pythonic way to collect and display multiple exceptions at the same time? For example let's say you're trying to validate the elements of a list and you'd like to validate as many of the elements as possible in one run and still report exception's raised while validating a failed ele

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma wrote: > james_027 writes: > > I was working with regex on a very large text, really large but I have > > time constrained. Does python has any other regex library or string > > manipulation library that works really fast? > > Hard to answer without seeing your rege

Re: Picking a license

2010-05-06 Thread Stephen Hansen
On Thu, May 6, 2010 at 4:56 PM, Ben Finney > wrote: > a...@pythoncraft.com (Aahz) writes: > > > In article <4be05d75.7030...@msn.com>, > > Rouslan Korneychuk wrote: > > > > > >The only question I have now is what about licensing? Is that > > >something I need to worry about? Should I go with LG

Re: Django as exemplary design

2010-05-06 Thread TomF
On 2010-05-06 18:20:02 -0700, Trent Nelson said: I'm interested in improving my python design by studying a large, well-designed codebase. I'll tell you one of the best ways to improve your Python code: attend one of Raymond Hettinger's Code Clinic workshops at a Python conference and put some

Re: fast regex

2010-05-06 Thread Tim Chase
On 05/06/2010 09:11 PM, james_027 wrote: for key, value in words_list.items(): compile = re.compile(r"""\b%s\b""" % key, re.IGNORECASE) search = compile.sub(value, content) where the content is a large text about 500,000 characters and the word list is about 5,000 You don't specify w

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma wrote: > james_027 writes: > > I was working with regex on a very large text, really large but I have > > time constrained. Does python has any other regex library or string > > manipulation library that works really fast? > > Hard to answer without seeing your rege

Re: fast regex

2010-05-06 Thread james_027
On May 6, 11:33 pm, John Bokma wrote: > james_027 writes: > > I was working with regex on a very large text, really large but I have > > time constrained. Does python has any other regex library or string > > manipulation library that works really fast? > > Hard to answer without seeing your rege

Re: [Python-ideas] division oddness

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 6:33 PM, Xavier Ho wrote: > On Fri, May 7, 2010 at 11:13 AM, Chris Rebert wrote: >> On Thu, May 6, 2010 at 5:43 PM, Mathias Panzenböck >> wrote: >> > Shouldn't by mathematical definition -x // y be the same as -(x // y)? >> > I think this rather odd. Is there any deeper re

Re: does this exception mean something else?

2010-05-06 Thread Alex Hall
Changing the order so the function is first did it. Thanks. That is what I get for working with Java all semester... On 5/6/10, MRAB wrote: > Alex Hall wrote: >> Hi all, >> I have a file, pasted below for what good it will do, which makes a >> couple conditional calls to a function called writeDe

Re: does this exception mean something else?

2010-05-06 Thread Terry Reedy
On 5/6/2010 8:33 PM, Alex Hall wrote: Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a function called writeDefaults. However, when I manually trigger a condition that causes the function to be called, Python gives me a name error and says

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Terry Reedy
On 5/6/2010 3:34 PM, Artur Siekielski wrote: Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] [f() for f in funs] [4, 4, 4, 4, 4] You succumbed to lambda hypnosis, a common malady ;-). The above will not work in 3.x, whi

Re: [Python-ideas] division oddness

2010-05-06 Thread Xavier Ho
On Fri, May 7, 2010 at 11:13 AM, Chris Rebert wrote: > On Thu, May 6, 2010 at 5:43 PM, Mathias Panzenböck > wrote: > > Shouldn't by mathematical definition -x // y be the same as -(x // y)? > > I think this rather odd. Is there any deeper reason to this behaviour? I > > guess changing this will

RE: Django as exemplary design

2010-05-06 Thread Trent Nelson
> I'm interested in improving my python design by studying a large, > well-designed codebase. I'll tell you one of the best ways to improve your Python code: attend one of Raymond Hettinger's Code Clinic workshops at a Python conference and put some up of your work up on the projector for 20+ deve

Extract a bordered, skewed rectangle from an image

2010-05-06 Thread Paul Hemans
We have a scanned document on which a label has been attached. The label has been designed to have a border that makes it easy to determine the correct orientation and area of the label. The label portion of the scanned image needs to be extracted and deskewed as an image. The contents of the la

Re: does this exception mean something else?

2010-05-06 Thread MRAB
Alex Hall wrote: Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a function called writeDefaults. However, when I manually trigger a condition that causes the function to be called, Python gives me a name error and says that my writeDefaults

Re: does this exception mean something else?

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 5:33 PM, Alex Hall wrote: > Hi all, > I have a file, pasted below for what good it will do, which makes a > couple conditional calls to a function called writeDefaults. However, > when I manually trigger a condition that causes the function to be > called, Python gives me a

Re: Django as exemplary design

2010-05-06 Thread MRAB
Albert Hopkins wrote: On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote: I don't know how this applies to reading other peoples' code, but recent research shows we learn more from success than failure That's good to learn, because for years I have been intentionally failing in order to

does this exception mean something else?

2010-05-06 Thread Alex Hall
Hi all, I have a file, pasted below for what good it will do, which makes a couple conditional calls to a function called writeDefaults. However, when I manually trigger a condition that causes the function to be called, Python gives me a name error and says that my writeDefaults does not exist. I

Re: Django as exemplary design

2010-05-06 Thread Albert Hopkins
On Thu, 2010-05-06 at 16:38 -0700, Patrick Maupin wrote: > I don't know how this applies to reading other peoples' code, but > recent research shows we learn more from success than failure That's good to learn, because for years I have been intentionally failing in order to learn from it and beco

Re: 2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Martin v. Loewis
> The default replacement should be really providing a new execfile that > gets the encoding in the first 2 lines and opens it with the proper > encoding set (and properly closes the stream). No. The default replacement should really open the file in binary mode. Regards, Martin -- http://mail.p

Re: Picking a license

2010-05-06 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: > In article <4be05d75.7030...@msn.com>, > Rouslan Korneychuk wrote: > > > >The only question I have now is what about licensing? Is that > >something I need to worry about? Should I go with LGPL, MIT, or > >something else? > > Which license you use depends pa

Re: Django as exemplary design

2010-05-06 Thread Patrick Maupin
On May 4, 5:34 pm, TomF wrote: > On 2010-05-04 07:11:08 -0700, alex23 said: > > (I also think there's value to be gained in studying _bad_ code, > > too...) > > True, although whether that's time well spent is another question. I don't know how this applies to reading other peoples' code, but rec

Re: py3 tkinter acceps bytes. why?

2010-05-06 Thread Martin v. Loewis
> If I don't want bytes to get passed to tkinter > I just have to raise an exception in AsObj, no? > Or is it even sufficient to just remove the bytes case? But why would you want that? There are commands which legitimately return bytes, e.g. the file and network io libraries of Tcl (not that you

Pydev 1.5.7 Released

2010-05-06 Thread Fabio Zadrozny
Hi All, Pydev 1.5.7 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * **Uniquely identifying editors:** * Names are never duplicated * Special treatment for __init__ * Spe

Re: Picking a license (was Re: new extension generator for C++)

2010-05-06 Thread Rouslan Korneychuk
On 05/06/2010 04:22 PM, Aahz wrote: In article<4be05d75.7030...@msn.com>, Rouslan Korneychuk wrote: The only question I have now is what about licensing? Is that something I need to worry about? Should I go with LGPL, MIT, or something else? Which license you use depends partly on your polit

Re: Where is python31.dll?

2010-05-06 Thread Pietro Campesato
Dave Angel wrote: > "visually"? Lots of possibilities there. And if you're not sure, you > need to get familiar with Windows quirks. > > IF you're using Explorer, there are a few ways you could miss a single > file out of thousands. > > Simplest is that the listing is not necessarily completely

2to3 as a unittest

2010-05-06 Thread Vincent Davis
I have used 2to3 from the command line. is there a way to run it as a unittest. Actually I guess my question is; is there a built in utility for running py3 compatibility on source code as a unittest? *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog | Lin

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Raymond Hettinger
On May 6, 9:34 pm, Artur Siekielski wrote: > Hello. > I found this strange behaviour of lambdas, closures and list > comprehensions: > > >>> funs = [lambda: x for x in range(5)] > >>> [f() for f in funs] > > [4, 4, 4, 4, 4] > > Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Benjamin Peterson
Artur Siekielski gmail.com> writes: > > Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The > 'x' was bound to the final value of 'range(5)' expression for ALL > defined functions. Can you explain this? Is this only counterintuitive > example or an error in CPython? The former.

2to3 issues with execfile on python 3.0 on files with encoding

2010-05-06 Thread Fabio Zadrozny
Right now, it seems that the default implementation of execfile in 2to3 is something as: exec(compile(open(file).read()+"\n", file, 'exec'), globals, locals) But it seems it won't deal with encodings properly... and also, in CPython just making an open without a close is OK, because of the refere

Re: List comprehension + lambdas - strange behaviour

2010-05-06 Thread Emile van Sebille
On 5/6/2010 12:34 PM Artur Siekielski said... Hello. I found this strange behaviour of lambdas, closures and list comprehensions: funs = [lambda: x for x in range(5)] funs is now a list of lambda functions that return 'x' (whatever it currently is from whereever it's accessible when invoked)

Picking a license (was Re: new extension generator for C++)

2010-05-06 Thread Aahz
In article <4be05d75.7030...@msn.com>, Rouslan Korneychuk wrote: > >The only question I have now is what about licensing? Is that something >I need to worry about? Should I go with LGPL, MIT, or something else? Which license you use depends partly on your political philosophy. Unless you have

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-06 Thread Thomas Heller
Paul Moore schrieb: >>From a quick experiment, it seems that select.select with a timeout > doesn't react to a keyboard interrupt until the timeout expires. > Specifically, if I do > > s = socket.socket() > select.select([s], [], [], 30) > > and then press Ctrl-C, Python waits for the 30 seconds

Re: Django as exemplary design

2010-05-06 Thread Aahz
In article <4be132f1$0$20639$426a7...@news.free.fr>, Bruno Desthuilliers wrote: > >The more bad code (mine or not) I have to maintain (or even just read >and understand), the more I pay attention to my own design and code >quality. Sometimes you only understand why something is bad, why it is

List comprehension + lambdas - strange behaviour

2010-05-06 Thread Artur Siekielski
Hello. I found this strange behaviour of lambdas, closures and list comprehensions: >>> funs = [lambda: x for x in range(5)] >>> [f() for f in funs] [4, 4, 4, 4, 4] Of course I was expecting the list [0, 1, 2, 3, 4] as the result. The 'x' was bound to the final value of 'range(5)' expression for

Python-URL! - weekly Python news and links (May 5)

2010-05-06 Thread Cameron Laird
[Authored by Gabriel Genellina.] QOTW: "Even on alt.haruspicy they cannot do much without a liver now and then..." - Peter Otten http://groups.google.com/group/comp.lang.python/msg/7852938d0b92bd7b Mixing bytes and unicode when writing data in Python 3.x: http://groups.google.com.a

Re: new extension generator for C++

2010-05-06 Thread Rouslan Korneychuk
I have the code up at http://github.com/Rouslan/PyExpose now. Any comments are welcome. -- http://mail.python.org/mailman/listinfo/python-list

how to make a piece of code lowercase, except strings / comment ?

2010-05-06 Thread Stef Mientki
hello, I use Python with some simplifications and a few extensions, as a scripting language for non-programmers. One of the simplifications is that the language should be case-insensitive. This is done by making the code lowercase. But now the strings in the code are also converted to lowercase.

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread coldpizza
Cool! Thanks to both Iliya and Peter! On May 6, 7:34 pm, Peter Otten <__pete...@web.de> wrote: > coldpizza wrote: > > Hello, > > > I need to convert accented unicode chars in some audio files to > > similarly-looking ascii chars. Looks like the following code seems to > > work on windows: > > > im

Re: ActiveState using different MS runtime files than official Python release? (was Re: Movable Python or ActivePython)

2010-05-06 Thread python
Hi Trent, > That is probably a bug in the ZIP package (the MSI is by far the primary > package for Windows so gets more attention). > > I've started a bug for this: > http://bugs.activestate.com/show_bug.cgi?id=86794 Thank you, Malcolm - Original message - From: "Trent Mick" To: pyt

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread Peter Otten
coldpizza wrote: > Hello, > > I need to convert accented unicode chars in some audio files to > similarly-looking ascii chars. Looks like the following code seems to > work on windows: > > import os > import sys > import glob > > EXT = '*.*' > > lst_uni = glob.glob(unicode(EXT)) > > os.system

Re: ActiveState using different MS runtime files than official Python release? (was Re: Movable Python or ActivePython)

2010-05-06 Thread Trent Mick
On 10-05-05 5:30 PM, pyt...@bdurham.com wrote: Hi Trent, On 10-05-05 12:04 PM, pyt...@bdurham.com wrote: I just took a look at the ActiveStatre 2.6.5.12 release (zip file version) and noticed that this file does not include the MSVCR90.DLL run time file - it includes MFC*.DLL files instead (and

Re: matching strings in a large set of strings

2010-05-06 Thread M.-A. Lemburg
Dennis Lee Bieber wrote: > On Thu, 29 Apr 2010 11:38:28 +0200, "Karin Lagesen" > declaimed the following in comp.lang.python: > >> Hello. >> >> I have approx 83 million strings, all 14 characters long. I need to be >> able to take another string and find out whether this one is present >> within

Re: convert Unicode filenames to good-looking ASCII

2010-05-06 Thread Iliya
Try smth like this: import unicodedata def remove_accents(str): nkfd_form = unicodedata.normalize('NFKD', unicode(str)) return u''.join([c for c in nkfd_form if not unicodedata.combining(c)]) -- http://mail.python.org/mailman/listinfo/python-list

Windows - select.select, timeout and KeyboardInterrupt

2010-05-06 Thread Paul Moore
>From a quick experiment, it seems that select.select with a timeout doesn't react to a keyboard interrupt until the timeout expires. Specifically, if I do s = socket.socket() select.select([s], [], [], 30) and then press Ctrl-C, Python waits for the 30 seconds before raising KeyboardInterrupt.

convert Unicode filenames to good-looking ASCII

2010-05-06 Thread coldpizza
Hello, I need to convert accented unicode chars in some audio files to similarly-looking ascii chars. Looks like the following code seems to work on windows: import os import sys import glob EXT = '*.*' lst_uni = glob.glob(unicode(EXT)) os.system('chcp 437') lst_asci = glob.glob(EXT) print sys

Re: fast regex

2010-05-06 Thread John Bokma
james_027 writes: > I was working with regex on a very large text, really large but I have > time constrained. Does python has any other regex library or string > manipulation library that works really fast? Hard to answer without seeing your regex and requirements first. Your question is like:

Re: fast regex

2010-05-06 Thread Javier Collado
Hello, 2010/5/6 james_027 : > I was working with regex on a very large text, really large but I have > time constrained. Does python has any other regex library or string > manipulation library that works really fast? re2 (http://code.google.com/p/re2/) is suppossed to be faster than the standard

fast regex

2010-05-06 Thread james_027
hi, I was working with regex on a very large text, really large but I have time constrained. Does python has any other regex library or string manipulation library that works really fast? Thanks, James -- http://mail.python.org/mailman/listinfo/python-list

Re: column selection

2010-05-06 Thread Dave Angel
mannu jha wrote: I tried with this: for line in open('1.txt'): columns = line.split() print columns[0], columns[1] if not line: continue but it is showing error: nmru...@caf:~> python split.py 24 ALA Traceback (most recent call last): File "split.py", line 3, in pri

Re: Python debuggers with sys.settrace()

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 5:59 AM, Sarah Mount wrote: > On 5 May 2010 10:17, Carl Banks wrote: >> On May 2, 11:06 am, Sarah Mount wrote: >>> This is a bit of an odd question, but is there any way for a Python >>> debugger to suppress I/O generated by the program which is being >>> debugged? I guess

Re: Python debuggers with sys.settrace()

2010-05-06 Thread Sarah Mount
On 5 May 2010 10:17, Carl Banks wrote: > On May 2, 11:06 am, Sarah Mount wrote: >> This is a bit of an odd question, but is there any way for a Python >> debugger to suppress I/O generated by the program which is being >> debugged? I guess an "obvious" thing to do would be to replace core >> part

Re: running .py files on Linux

2010-05-06 Thread Laszlo Nagy
Tingting HAN írta: Dear Officer, I want to run two .py files to generate .h5 files. hantingt...@tityro:~$ python2.5 Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. When

Re: Re: column selection

2010-05-06 Thread mannu jha
I tried with this: for line in open('1.txt'): columns = line.split() print columns[0], columns[1] if not line: continue but it is showing error: nmru...@caf:~> python split.py 24 ALA Traceback (most recent call last): File "split.py", line 3, in print columns[0], col

crash in Py_EnterRecursiveCall

2010-05-06 Thread René J . V . Bertin
Hello, I have embedded Python into and extended it with functionality from a graphical tool I use. One of the things it allows me to do is to export Python objects to a simple scripting language ("ascanf"), and call them as if they were native functions. I have the following situation in which I

Re: Compression module APIs

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 4:41 AM, Florian Weimer wrote: > * Chris Rebert: >> On Thu, May 6, 2010 at 4:09 AM, Florian Weimer wrote: >>> As far as I can see, the compression-related APIs (gzip, zlib, bzip2) >>> in Python 2.5 have three distinct APIs.  Is there really no unified >>> interface, or am I

Re: Compression module APIs

2010-05-06 Thread Florian Weimer
* Chris Rebert: > On Thu, May 6, 2010 at 4:09 AM, Florian Weimer wrote: >> As far as I can see, the compression-related APIs (gzip, zlib, bzip2) >> in Python 2.5 have three distinct APIs.  Is there really no unified >> interface, or am I missing something? > > bz2.BZ2File and gzip.GzipFile both o

Re: Compression module APIs

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 4:09 AM, Florian Weimer wrote: > As far as I can see, the compression-related APIs (gzip, zlib, bzip2) > in Python 2.5 have three distinct APIs.  Is there really no unified > interface, or am I missing something? bz2.BZ2File and gzip.GzipFile both offer a file-like interfac

Compression module APIs

2010-05-06 Thread Florian Weimer
As far as I can see, the compression-related APIs (gzip, zlib, bzip2) in Python 2.5 have three distinct APIs. Is there really no unified interface, or am I missing something? -- http://mail.python.org/mailman/listinfo/python-list

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Richard Lamboj
Am Thursday 06 May 2010 12:02:47 schrieb Steven D'Aprano: > On Thu, 06 May 2010 11:24:49 +0200, Richard Lamboj wrote: > > Hello, > > > > what should i take: > > - nested functions: > > class MyClass(object) > > def blah(self): > > def blub(var1, var2): > > do something... > > blub

Re: pysms

2010-05-06 Thread jon vs. python
Hi Luca, I've never used pysms, but I just downloaded the source code and it seems that SMS related functionallity is performed using standard GSM AT commands. So if you're accessing the gsm module through a serial port you shouldn't worry at all. Hope it helps, Jon. On Thu, May 6, 2010 at 9:40 AM

RE: ctypes:Multiple library access problem

2010-05-06 Thread Stefan Schukat
Massi wrote: > > Hi everyone, > > > > in my script I need to execute multiple separated loading of the same > > dll library, in order to handle the internal variables with different > > threads. > > Consider the followin piece of code: > > > > lib1 = cdll.LoadLibrary("MyLib.dll")) > > lib2 = cdll.L

Re: Classes: nested functions vs. private methodes

2010-05-06 Thread Steven D'Aprano
On Thu, 06 May 2010 11:24:49 +0200, Richard Lamboj wrote: > Hello, > > what should i take: > - nested functions: > class MyClass(object) > def blah(self): > def blub(var1, var2): > do something... > blub(1, 5) The disadvantage of nested functions is that it is harder to test th

running .py files on Linux

2010-05-06 Thread Tingting HAN
Dear Officer, I want to run two .py files to generate .h5 files. hantingt...@tityro:~$ python2.5 Python 2.5.4 (r254:67916, Jan 20 2010, 21:43:02) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. When ruuning gentest_sphere.py, the problem is as following

Re: long int computations

2010-05-06 Thread Duncan Booth
Peter Otten <__pete...@web.de> wrote: > Victor Eijkhout wrote: > >> I have two long ints, both too long to convert to float, but their ratio >> is something reasonable. How can I compute that? The obvious "(1.*x)/y" >> does not work. > import fractions x = 12345 * 10**1000 y = 765

Re: column selection

2010-05-06 Thread Dave Angel
mannu jha wrote: Hi, I have few files like this: 24 ALA helix (helix_alpha, helix2) 27 ALA helix (helix_alpha, helix2) 51 ALA helix (helix_alpha, helix4) 58 ALA helix (helix_alpha, helix5) 63 ALA helix (helix_alpha, helix5) now with this program: for line in open('1.txt'):

Classes: nested functions vs. private methodes

2010-05-06 Thread Richard Lamboj
Hello, what should i take: - nested functions: class MyClass(object) def blah(self): def blub(var1, var2): do something... blub(1, 5) or class MyClass(object) def blah(self): def _blub(var1, var2): do something... _blub(1, 5) - "private" functions: class MyCl

Re: ctypes:Multiple library access problem

2010-05-06 Thread Dave Angel
Massi wrote: Hi everyone, in my script I need to execute multiple separated loading of the same dll library, in order to handle the internal variables with different threads. Consider the followin piece of code: lib1 = cdll.LoadLibrary("MyLib.dll")) lib2 = cdll.LoadLibrary("MyLib.dll")) lib1.v

Re: Python - MySQL fetching values

2010-05-06 Thread Chris Rebert
On Thu, May 6, 2010 at 1:47 AM, Kurian Thayil wrote: > the expected output is 05:35:05. > > Now, here is code snippet, > >     cursor1=getconnect1.cursor() >     getrows=cursor1.execute("""SELECT > TIME(DATE_ADD(info_last_calltime, INTERVAL %s MINUTE)) FROM rem_call_info >

Re: Windows7 run python script / sub process with elevated privileges

2010-05-06 Thread Tim Golden
On 01/05/2010 15:44, News123 wrote: Hi, I have a small python script, which has been started as normal non privileged user. At a later point in time it would like to start another python script with elevated privileges. How can I write my code such, that I will get the privilege elevation prom

Re: Where is python31.dll?

2010-05-06 Thread Dave Angel
Pietro Campesato wrote: Your windows search command? Which is how I verified the above. I looked at the folder visually. Simply using os.listdir shows there is in fact a python31.dll there: somehow it was an invisible file. This is strange since I've never touched any system folder. Thanks

Re: column selection

2010-05-06 Thread Xavier Ho
You need to ignore empty lines. for line in open('1.txt'): if len(line.strip()) == 0: continue columns = line.split() print columns[0], columns[2] Cheers, Xav On Thu, May 6, 2010 at 6:22 PM, mannu jha wrote: > Hi, > > I have few files like this: > > 24 ALA helix (helix_alph

Python - MySQL fetching values

2010-05-06 Thread Kurian Thayil
Hi All, I am pretty new to python, and I have an issue with fetching values in python using MySQLdb module. The query executed is *SELECT TIME(DATE_ADD(info_last_calltime, INTERVAL %s MINUTE)) FROM rem_call_info WHERE info_ctrlid=%s""", (retryinterval,controlid1,)* where retryinterval=30 and cont

column selection

2010-05-06 Thread mannu jha
Hi, I have few files like this: 24 ALA helix (helix_alpha, helix2) 27 ALA helix (helix_alpha, helix2) 51 ALA helix (helix_alpha, helix4) 58 ALA helix (helix_alpha, helix5) 63 ALA helix (helix_alpha, helix5) now with this program: for line in open('1.txt'): columns = line.spl

ctypes:Multiple library access problem

2010-05-06 Thread Massi
Hi everyone, in my script I need to execute multiple separated loading of the same dll library, in order to handle the internal variables with different threads. Consider the followin piece of code: lib1 = cdll.LoadLibrary("MyLib.dll")) lib2 = cdll.LoadLibrary("MyLib.dll")) lib1.var1 = 0 lib2.va

Re: long int computations

2010-05-06 Thread Mark Dickinson
On May 3, 9:49 pm, s...@sig.for.address (Victor Eijkhout) wrote: > Jerry Hill wrote: > > >>> from __future__ import division > > >>> long1/long2 > > 0.5 > > Beautiful. Thanks so much guys. And if for some reason you don't want to use the 'from __future__' import, then you can do long1.__truediv__

Re: py3 tkinter acceps bytes. why?

2010-05-06 Thread Matthias Kievernagel
>>Me: >> I asked what kinds of bytes are accepted as tkinter parameters. >> I still wonder why they are accepted at all. >> Does anyone know a reason for this >> or has a link to some relevant discussion? >Terry Reedy: > I do not remember any particular public discussion of tkinter on the dev > l

Re: Parser

2010-05-06 Thread Andreas Löscher
Am Sonntag, den 02.05.2010, 21:54 +0200 schrieb Andreas Löscher: > Hi, > I am looking for an easy to use parser. I am want to get an overview > over parsing and want to try to get some information out of a C-Header > file. Which parser would you recommend? > > Best, > Andreas > Thanks for your an

pysms

2010-05-06 Thread luca72
Hello Has anyone used pysms can you tell me with wich gsm module it works? Thanks Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: ooolib, reading writing a spread sheet and keep formatting

2010-05-06 Thread News123
Hi Chris, Chris Withers wrote: > News123 wrote: >> Hi Chris, >> >> >> Chris Withers wrote: >>> News123 wrote: from xlrd import open_workbook from xlutils.copy import copy rb = open_workbook('doc1.xls') >>> open_workbook('doc1.xls',formatting_info=True) >> >> I'll try, but the

Re: modifying open office spreadsheet (with OO installed)

2010-05-06 Thread News123
Hi CHris, Chris Withers wrote: > Jim Byrnes wrote: >> News123 wrote: >>> Mumbling to myself, perhaps somebody else is interested. >> >> Yes I am. >> >>> News123 wrote: Hi, I wanted to know who can recommend a good module/library, that allows to modify an Open Office

Re: condition and True or False

2010-05-06 Thread Lawrence D'Oliveiro
In message <685761fe-b052-4d89-92d3-17d1f2a39...@p2g2000yqh.googlegroups.com>, Paul McGuire wrote: > While sifting through some code looking for old "x and y or z" code > that might better be coded using "y if x else z", I came across this > puzzler: > > x = and True or False I suspect the

Re: Sharing a program I wrote

2010-05-06 Thread Paul Rubin
Scott writes: > I've seen pypi. It seems to index code that is posted on all sorts of > sites - including pypi itself? And what is a "package" anyway? I've > seen sourceforge. It looks like a good home for big applications or > multi-developer projects. Freshmeat? Google code? My own website? Your

Re: long int computations

2010-05-06 Thread Paul Rubin
s...@sig.for.address (Victor Eijkhout) writes: > I have two long ints, both too long to convert to float, but their ratio > is something reasonable. How can I compute that? The obvious "(1.*x)/y" > does not work. The math.log function has a special hack for long ints, that might help: Python