Re: no more comparisons

2008-03-12 Thread Terry Reedy
"Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message news:[EMAIL PROTECTED] | "Terry Reedy" <[EMAIL PROTECTED]> writes: | > | I don't see what's so inefficient about it necessarily. | > | > The key function is called once per list item, for n calls total. The | > comparision function i

Re: copying all data(tags and values) after a particular XML tag

2008-03-12 Thread Chris
On Mar 13, 8:21 am, [EMAIL PROTECTED] wrote: > i've an XML file with the following structure > > > > > . > . > . > . > . > > > > what i want to do is copy all data(tags and all) between N and N+k > appearances of . I am a python newbie. How do I do it? > > Thanks. You can take a look at t

Re: a Roguelike in Python

2008-03-12 Thread andrei . avk
On Mar 12, 8:25 am, [EMAIL PROTECTED] wrote: > Seeing the 7DRL start up recently, i wanted to see what one was made > of. Python is the language i'm most familiar with so i searched for > some code to look at, but i couldn't find any. Can anyone direct me to > the right place? > > I did some search

copying all data(tags and values) after a particular XML tag

2008-03-12 Thread bijeshn
i've an XML file with the following structure . . . . . what i want to do is copy all data(tags and all) between N and N+k appearances of . I am a python newbie. How do I do it? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Dispatch("Excel.Application") failed

2008-03-12 Thread lialie
Hi, Maybe it 's quite simple, but I can't fix it. Do I make some mistakes in my env setting? My excel version is 2003. any suggestion? Thanks. Traceback (most recent call last): File "testexcel.py", line 3, in ? excel = Dispatch("Excel.Application") File "C:\Python24\Lib\site-packages\win32com\cli

Re: no more comparisons

2008-03-12 Thread Paul Rubin
"Terry Reedy" <[EMAIL PROTECTED]> writes: > | I don't see what's so inefficient about it necessarily. > > The key function is called once per list item, for n calls total. The > comparision function is called once per comparision. There are at least > n-1 such calls and typically something on

Re: How to port Python code into C++ code automatically?

2008-03-12 Thread Jeff Schwab
Bo wrote: > I want to port a Python project (about 10,000 line python code) to C+ > +. Is there any automatically tool to do this kind of things? e.g., That's not trivial. Python is very heavily oriented toward run-time processing, whereas C++ favors compile-time processing. > e.g., SWIG(http:/

Re: Creating a file with $SIZE

2008-03-12 Thread k.i.n.g.
On Mar 13, 8:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Mar 12, 7:37 am, "k.i.n.g." <[EMAIL PROTECTED]> wrote:> We use dd command > in Linux to create a file with of required size. > > If you just want to get your work done, you might consider the cygwin > dd command. > Learning t

Re: Generator woes

2008-03-12 Thread Erich
On Mar 13, 12:33 am, Erich <[EMAIL PROTECTED]> wrote: > Hi all, > > I am trying to get the following generator to work to these goals: > > 1. When it recieves an exception (via a throw()) it yeilds the value > of handler.remaining. Otherwise it yeilds None. > 2. Send adds data to the generator. > >

Generator woes

2008-03-12 Thread Erich
Hi all, I am trying to get the following generator to work to these goals: 1. When it recieves an exception (via a throw()) it yeilds the value of handler.remaining. Otherwise it yeilds None. 2. Send adds data to the generator. Goal 2 is working great. Goal 1 on the other hand, is not working. T

Re: How to port Python code into C++ code automatically?

2008-03-12 Thread Paddy
On Mar 13, 3:15 am, Bo <[EMAIL PROTECTED]> wrote: > I want to port a Python project (about 10,000 line python code) to C+ > +. Is there any automatically tool to do this kind of things? e.g., > SWIG(http://www.swig.org/)? > > Any comment is welcome! > > Thanks! There isn't a magic porting tool ava

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Paddy
On Mar 13, 1:37 am, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 12, 8:11 pm, Justus Schwabedal <[EMAIL PROTECTED]> > wrote: > > > What do you need it for anyway? I just read about it and I think it's > > useless > > in python. > > Perl, like Python, has a separate compilation and run times. One

Class Inheritance

2008-03-12 Thread "Andrew Rekdal"
I am trying to bring functions to a class by inheritance... for instance in layout_ext I have.. --- layout_ext.py- class Layout() def...some function that rely on css in Layout.py def... ---EOF-- in the main application file I have... Layout.py--- from layout_ext import Lay

Re: help please, splitter windows like in maya or 3ds max

2008-03-12 Thread "Andrew Rekdal"
This seems to work... split then split each side. then tandem the size. import wx class Layout(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title) sizer = wx.BoxSizer(wx.HORIZONTAL) panel = wx.Panel(self,-1) splitter = wx.SplitterWindow(panel)

Re: frequency count or number of occurences of a number in an array

2008-03-12 Thread Larry
Thanks to all those who replied to this post. I'm gonna try your suggestions. They are a great help. -- http://mail.python.org/mailman/listinfo/python-list

Socket Performance

2008-03-12 Thread sleddd
Can anyone explain why socket performance (throughput) varies depending on the amount of data send and recv are called with? For example: try creating a local client/server (running on the same computer) where the server sends the client a fixed amount of data. Using method A, recv(8192) and senda

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Jeff Schwab
Alex wrote: > The subject says pretty much all, i would very appreciate an answer. I > tried to search the various forums and groups, but didn't find any > specific answer... I'd like an answer to this, too. In Perl, I mostly used it for one-liners, when a variable needed to be initialized to s

Handling global variables (Newbie)

2008-03-12 Thread David S
Hi, I have an error occurring at self.build_root = os.path.abspath(os.path.split(__file__)[0]) The error states 'NameError: global name '__file__' is not defined' In Python 2.5 I ran my script as a module in IDLE gui. How does _file_ get defined? Yours, David -- http://mail.python.

Re: a Roguelike in Python

2008-03-12 Thread Patrick Mullen
On Wed, Mar 12, 2008 at 9:23 AM, Carl Banks <[EMAIL PROTECTED]> wrote: > Even though it's typically used for graphical games, PyGame would be a > good way to make a cross-platform "text-mode" game. It should be > pretty straightforward to simulate a text mode terminal using a grid > of sprites

help please, splitter windows like in maya or 3ds max

2008-03-12 Thread moonrie
hi, everyone there, I am doing a 3D modeling project. I like to do it with Python( am a newbie), but have no idea with the wxSplitterWindow to create the 4-view windows( top, front, side, perspective), like the mfc CSplitterWnd guy), anyone can give me some help with wxPython? thanks in advance.

How to port Python code into C++ code automatically?

2008-03-12 Thread Bo
I want to port a Python project (about 10,000 line python code) to C+ +. Is there any automatically tool to do this kind of things? e.g., SWIG(http://www.swig.org/)? Any comment is welcome! Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a file with $SIZE

2008-03-12 Thread [EMAIL PROTECTED]
On Mar 12, 7:37 am, "k.i.n.g." <[EMAIL PROTECTED]> wrote: > We use dd command in Linux to create a file with of required size. If you just want to get your work done, you might consider the cygwin dd command. Learning to write python is a worthwhile endeavour in any case. -- http://mail.python.or

Re: string / split method on ASCII code?

2008-03-12 Thread Steven D'Aprano
Sorry for breaking threading by replying to a reply, but I don't seem to have the original post. On Wed, 2008-03-12 at 15:29 -0500, Michael Wieher wrote: > Hey all, > > I have these annoying textilfes that are delimited by the ASCII char > for << (only its a single character) and >> (again a sin

Re: macro in python

2008-03-12 Thread Dan Stromberg
On Wed, 27 Feb 2008 16:24:02 +0530, bharath venkatesh wrote: > hi .. > how to create macro in python for set of instruction that is done > frequently but too less in number to ignore the overhead of function > call ... > hi ..    how to create macro in python for set of > instruction that is d

Re: app runs fine with interpreter, but not under py2exe

2008-03-12 Thread Doug Morse
Hi Harald and C.L.P., Precision.py is part of the Numeric package. AFAIKT, the problem is during the module initialization. The first lines of Precision.py are: from multiarray import zeros import string typecodes = {'Character':'c', 'Integer':'1sil', 'UnsignedInteger':'bwu', 'Float':'fd', 'Co

Re: no more comparisons

2008-03-12 Thread Dan Bishop
On Mar 12, 6:52 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > Paul Rubin wrote: > > The cmp option should not be removed. However, requiring > > it to be specified as a keyword parameter instead of just > > passed as an unlabelled arg is fine. > > Sure; I would have no problem with that. > > But tha

Re: Big file

2008-03-12 Thread Andrew Rekdal
Well, I can see how this could get real messy but within defining a GUI there are many elements and so the block of elements such as a wx.notebook for instance I would hope I could place all the code for this in another file and somehow include it into place. This way I can work on layered pane

Re: Big file

2008-03-12 Thread hdante
On Mar 12, 9:42 pm, "Andrew Rekdal" <[EMAIL PROTECTED]> wrote: > I am working in the class constructor defining elements of an application. > The problem is the file is getting unmanageble and I am wanting to extend the > contructor __init__ to another file. > > Is it possible to import directly

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Carl Banks
On Mar 12, 8:11 pm, Justus Schwabedal <[EMAIL PROTECTED]> wrote: > What do you need it for anyway? I just read about it and I think it's > useless > in python. Perl, like Python, has a separate compilation and run times. One day, someone who was trying to use Perl for something asked, "You know,

Re: Big file

2008-03-12 Thread Steven D'Aprano
On Wed, 12 Mar 2008 19:42:44 -0500, Andrew Rekdal wrote: > I am working in the class constructor defining elements of an > application. The problem is the file is getting unmanageble and I am > wanting to extend the contructor __init__ to another file. > > Is it possible to import directly into t

Re: escape string to store in a database?

2008-03-12 Thread Carsten Haese
On Wed, 2008-03-12 at 18:18 -0700, [EMAIL PROTECTED] wrote: > These pieces of text may have single and double quotes in > them, I tried escaping them using re module and string module and > either I did something wrong, or they escape either single quotes or > double quotes, not both of these. So t

escape string to store in a database?

2008-03-12 Thread andrei . avk
Hi, I'd like to store chunks of text, some of them may be very large, in a database, and have them searchable using 'LIKE %something%' construct. These pieces of text may have single and double quotes in them, I tried escaping them using re module and string module and either I did something wrong,

Re: no more comparisons

2008-03-12 Thread Terry Reedy
| > Hmm, wasn't aware they were taking it that far. You should almost | > always avoid using the cmp parameter because it's very inefficient; | | I don't see what's so inefficient about it necessarily. The key function is called once per list item, for n calls total. The comparision function is

Re: image matching algorithms

2008-03-12 Thread Daniel Fetchinson
> > The photos are just coming straight from my digital camera. Same > > format (JPEG), varying size (6-10 megapixel) and I would like to be > > able to pick one and then query the database for similar ones. For > > example: I pick a photo which is more or less a portrait of someone, > > the query

Re: Big file

2008-03-12 Thread Simon Forman
On Mar 12, 5:42 pm, "Andrew Rekdal" <[EMAIL PROTECTED]> wrote: > I am working in the class constructor defining elements of an application. > The problem is the file is getting unmanageble and I am wanting to extend the > contructor __init__ to another file. > > Is it possible to import directly

Re: image matching algorithms

2008-03-12 Thread Yu-Xi Lim
Daniel Fetchinson wrote: > The photos are just coming straight from my digital camera. Same > format (JPEG), varying size (6-10 megapixel) and I would like to be > able to pick one and then query the database for similar ones. For > example: I pick a photo which is more or less a portrait of someon

Big file

2008-03-12 Thread Andrew Rekdal
I am working in the class constructor defining elements of an application. The problem is the file is getting unmanageble and I am wanting to extend the contructor __init__ to another file. Is it possible to import directly into the contructor the contents of another module file? If so how wou

Re: Access function name from within a function

2008-03-12 Thread Steven D'Aprano
On Thu, 13 Mar 2008 00:16:13 +0100, Hellmut Weber wrote: > Hi, > i would liek to define an error routine which print amongs other things > the name of the function from which it has been called. You mean like Python exceptions already do? >>> def broken(): ... x = 100 + 'foo' ... retur

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Justus Schwabedal
What do you need it for anyway? I just read about it and I think it's useless in python. On Mar 13, 2008, at 1:03 AM, Steven D'Aprano wrote: > On Wed, 12 Mar 2008 11:19:05 -0700, Alex wrote: > >> Hi all, >> >> The subject says pretty much all > > Only to people who know what the Perl BEGIN{} bl

Re: Open a file with default handler app?

2008-03-12 Thread andrei . avk
On Mar 11, 11:50 pm, [EMAIL PROTECTED] wrote: > > Hey there, > I've had to do the same things for a program that I'm writing. The > following command should do the trick: > > os.startfile("yourfilehere") > > from the os module. Hope this helps! That's perfect, thanks a ton++! -- http://mail.pyth

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Steven D'Aprano
On Wed, 12 Mar 2008 11:19:05 -0700, Alex wrote: > Hi all, > > The subject says pretty much all Only to people who know what the Perl BEGIN{} block means. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Problem with exec

2008-03-12 Thread Justus Schwabedal
Dear python users! I try to setted up compile-free parallelism using the exec command. However I had some problems with namespaces which I find mysterious although I managed to work around. But the workaround is not nice, so I wonder if there are ways. I do the following, bash-3.2$ cat execB

Re: tcp client socket bind problem

2008-03-12 Thread Dan Stromberg
On Sun, 09 Mar 2008 22:21:59 -0700, natambu wrote: > I have a linux box with multiple ip addresses. I want to make my python > client connect from one of the ip addresses. Here is my code, no matter > what valid information I put in the bind it always comes from the > default ip address on the ser

Re: no more comparisons

2008-03-12 Thread Alan Isaac
Paul Rubin wrote: > The cmp option should not be removed. However, requiring > it to be specified as a keyword parameter instead of just > passed as an unlabelled arg is fine. Sure; I would have no problem with that. But that is not what is happening. As for Carl's suggestion to use ``k

Access function name from within a function

2008-03-12 Thread Hellmut Weber
Hi, i would liek to define an error routine which print amongs other things the name of the function from which it has been called. Having tried def foo(): print dir() and all other ideas which came to my (rather python newbie) mind. Googling too did not show me a possibility. IOW what I'm

Re: agg (effbot)

2008-03-12 Thread [EMAIL PROTECTED]
On Mar 12, 10:52 am, Gerhard Häring <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Downloaded to Knoppix 5.1: > > : > > aggdraw-1.2a3-20060212.tar.gz > > > Followed README.  Wouldn't compile. [...] > > Try shegabittling the frotz first. If that doesn't help, please post the > output of t

Re: List Combinations

2008-03-12 Thread Arnaud Delobelle
On Mar 12, 3:38 pm, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: [...] > Start here > > http://www.mail-archive.com/[EMAIL PROTECTED]/msg178356.html > and go through the thread.  There are several ways to solve the problem > and we evaluated the performance and 'pythonicity' of each.   I used a ki

Re: no more comparisons

2008-03-12 Thread Paul Rubin
Carl Banks <[EMAIL PROTECTED]> writes: > > For example:http://www.python.org/dev/peps/pep-3100/ > > list.sort() and builtin.sorted() methods: eliminate cmp parameter > > [27] [done] > > Hmm, wasn't aware they were taking it that far. You should almost > always avoid using the cmp paramet

Re: C extensions question

2008-03-12 Thread Miki
Hello, > Let's say I write a simple extension in c only for the windows version > of my script. Can I just put this compiled dll in the root directory > of my application along with the other py files and distribute it like > that without the need of an installation script? Yes (current directory

Re: How to make a Tkinter widget always visible?

2008-03-12 Thread Miki
Hello Kevin, > Please post the code you're using--it will be easier to help if we can > see exactly what you are trying. In a nutshell: --- import Tkinter as tk, tkFont from tkMessageBox import showinfo, showerror from os import popen def main(): root = tk.Tk()

Re: How to parse this timestamp?

2008-03-12 Thread Diez B. Roggisch
gnu.gcc.help schrieb: > I've got timestamps in a file that look like: > > [19-Aug-2007 07:38:43+216ms NZST] > > How can I parse them? I don't see any way to build a strftime() > format string that can handle the +216ms part. The best I can see is > tearing it all apart with a regex, but I'm tryi

Re: How to parse this timestamp?

2008-03-12 Thread Miki
Hello, > [19-Aug-2007 07:38:43+216ms NZST] > > How can I parse them?  I don't see any way to build a strftime() > format string that can handle the +216ms part. The best I can see is > tearing it all apart with a regex, but I'm trying to avoid that pain > if I can. > > (PS: I have no clue why goog

How to parse this timestamp?

2008-03-12 Thread gnu.gcc.help
I've got timestamps in a file that look like: [19-Aug-2007 07:38:43+216ms NZST] How can I parse them? I don't see any way to build a strftime() format string that can handle the +216ms part. The best I can see is tearing it all apart with a regex, but I'm trying to avoid that pain if I can. (PS

Re: string / split method on ASCII code?

2008-03-12 Thread castironpi
>    import re >    splitter_re = re.compile(chr(174) + '|' + chr(175)) >    for line in file(FILENAME): >      parts = splitter_re.split(line) >      do_something(parts) > > and then go find a large blunt object with which to bludgeon the > creator of the file... :) p>> creator= CreatorOfTheFile(

Re: no more comparisons

2008-03-12 Thread Carl Banks
On Mar 12, 4:51 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > I was surprised to see that > comparison is slated for death > in Python 3000. > > For example:http://www.python.org/dev/peps/pep-3100/ > list.sort() and builtin.sorted() methods: eliminate cmp parameter > [27] [done] Hmm, wasn'

Re: Different results when running script from IDLE versus Command Line

2008-03-12 Thread Chris
On Mar 12, 8:10 pm, Casey T <[EMAIL PROTECTED]> wrote: > Hi, > > I'm new to Python and I'm having some problems with getting different > results from my script when I run it from IDLE versus just double- > clicking the .py file and having it run through the command line. > Basically, my script read

Re: string / split method on ASCII code?

2008-03-12 Thread Tim Chase
> I have these annoying textilfes that are delimited by the ASCII char for << > (only its a single character) and >> (again a single character) > > Their codes are 174 and 175, respectively. > > My datafiles are in the moronic form > > X<>Z > > I need to split on those freaking characters. Any

no more comparisons

2008-03-12 Thread Alan Isaac
I was surprised to see that comparison is slated for death in Python 3000. For example: http://www.python.org/dev/peps/pep-3100/ list.sort() and builtin.sorted() methods: eliminate cmp parameter [27] [done] But there is a rumor of a PEP to restore comparisons. http://mail.python.org/pipe

Re: string / split method on ASCII code?

2008-03-12 Thread Carsten Haese
On Wed, 2008-03-12 at 15:29 -0500, Michael Wieher wrote: > Hey all, > > I have these annoying textilfes that are delimited by the ASCII char > for << (only its a single character) and >> (again a single character) > > Their codes are 174 and 175, respectively. > > My datafiles are in the moronic

Re: Time Zone application after strptime?

2008-03-12 Thread M.-A. Lemburg
Jim Carroll wrote: > M.-A. Lemburg egenix.com> writes: > >> On 2008-03-07 22:24, Jim Carroll wrote: >>> It's taken me a couple of hours to give up on strptime >>> with %Z for recognizing >>> time zones... but that still leaves me in the wrong zone: >>> >>> How can I use the "PST" (or any other t

string / split method on ASCII code?

2008-03-12 Thread Michael Wieher
Hey all, I have these annoying textilfes that are delimited by the ASCII char for << (only its a single character) and >> (again a single character) Their codes are 174 and 175, respectively. My datafiles are in the moronic form X<>Z I need to split on those freaking characters. Any tips on h

Re: Does __import__ require a module to have a .py suffix?

2008-03-12 Thread Jean-Paul Calderone
On Wed, 12 Mar 2008 12:58:33 -0700 (PDT), George Sakkis <[EMAIL PROTECTED]> wrote: >On Mar 12, 12:22 pm, mrstephengross <[EMAIL PROTECTED]> wrote: > >> Hi all. I've got a python file called 'foo' (no extension). I want to >> be able to load it as a module, like so: >> >> m = __import__('foo') >>

Re: Does __import__ require a module to have a .py suffix?

2008-03-12 Thread George Sakkis
On Mar 12, 12:22 pm, mrstephengross <[EMAIL PROTECTED]> wrote: > Hi all. I've got a python file called 'foo' (no extension). I want to > be able to load it as a module, like so: > > m = __import__('foo') > > However, the interpreter tells me "No module named foo". If I rename > it foo.py, I can

Re: Py2exe and Multi Treading problem.

2008-03-12 Thread Thin Myrna
Farsheed Ashouri wrote: > NO it dont work. If I remove threading part, it works like a charm. > Any Idea? Of course it does then. Try to join the thread or do something else to prevent the non-threading part to exit prematurely. HTH Thin -- http://mail.python.org/mailman/listinfo/python-list

Re: Does __import__ require a module to have a .py suffix?

2008-03-12 Thread John Krukoff
On Wed, 2008-03-12 at 09:22 -0700, mrstephengross wrote: > Hi all. I've got a python file called 'foo' (no extension). I want to > be able to load it as a module, like so: > > m = __import__('foo') > > However, the interpreter tells me "No module named foo". If I rename > it foo.py, I can indee

Re: for-else

2008-03-12 Thread castironpi
On Mar 11, 4:43 am, NickC <[EMAIL PROTECTED]> wrote: > On Mar 4, 11:27 pm, [EMAIL PROTECTED] wrote: > > > > > The meaning is explicit. While "else" seems to mean little there. > > So I may like something similar for Python 3.x (or the removal of the > > "else"). > > Consider a loop with the followi

Make Money Using Paypal Get Paid Instantly

2008-03-12 Thread ayt46g6b
Make Money Using Paypal Get Paid Instantly Make 1k-5k every week without leaving the comfort of your own home Click Here to Make Money Using Paypal and Get Paid Instantly http://freetrafficbuzz.com/recommends/cashdirectly -- http://mail.python.org/mailman/listinfo/python-list

Re: enums and PEP 3132

2008-03-12 Thread Tim Chase
>> Currently I'm just putting this at the top of the file: >> py=1 >> funcpre=2 >> funcpost=3 >> ... > > That can be done more compactly with > > py, funcpre, funcpost = range(3) I've harbored a hope that a combination of PEP 3132[1] ("Extended Iterable unpacking") and iter

Re: tcp client socket bind problem

2008-03-12 Thread castironpi
On Mar 11, 2:19 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > >On Mar 10, 9:40 am, Marc Christiansen <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >> > I have a linux box with multiple ip addresses. I want to make my > >> > python client connect from one of

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Tim Chase
> The subject says pretty much all, Given what I understand about the BEGIN block[1], this is how Python works automatically: bash$ cat a.py print 'a1' import b print 'a2' bash$ cat b.py print 'b' bash$ python a.py a1 b a2 However, the first import does win and

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Carl Banks
On Mar 12, 2:19 pm, Alex <[EMAIL PROTECTED]> wrote: > Hi all, > > The subject says pretty much all, i would very appreciate an answer. I > tried to search the various forums and groups, but didn't find any > specific answer... Python technically has no equivalent: you can't run code at compile tim

Re: Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Paddy
On Mar 12, 6:19 pm, Alex <[EMAIL PROTECTED]> wrote: > Hi all, > > The subject says pretty much all, i would very appreciate an answer. I > tried to search the various forums and groups, but didn't find any > specific answer... > > Thanks, > Alex. No not really. There are lots of other ways to str

Re: ValueError in pickle module during unpickling a infinite float (python 2.5.2)

2008-03-12 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Unpickling an infinite float caused a ValueError in the pickle module. > I need to pickle and load infinite floats in my project. Do you have > any suggestions how to solve the issue? You could try another protocol. Does >>> inf = 1e1000 >>> pickle.loads(pickle.dumps(i

Is there Python equivalent to Perl BEGIN{} block?

2008-03-12 Thread Alex
Hi all, The subject says pretty much all, i would very appreciate an answer. I tried to search the various forums and groups, but didn't find any specific answer... Thanks, Alex. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does __import__ require a module to have a .py suffix?

2008-03-12 Thread Rick Dooling
On Mar 12, 11:22 am, mrstephengross <[EMAIL PROTECTED]> wrote: > Hi all. I've got a python file called 'foo' (no extension). I want to > be able to load it as a module, like so: > > m = __import__('foo') > > However, the interpreter tells me "No module named foo". If I rename > it foo.py, I can i

Re: Python - CGI - XML - XSD

2008-03-12 Thread xkenneth
On Mar 12, 11:58 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > xkenneth wrote: > > On Mar 12, 6:32 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> xkenneth wrote: > >>> Hi All, > >>>    Quick question. I've got an XML schema file (XSD) that I've > >>> written, that works fine when my data i

Different results when running script from IDLE versus Command Line

2008-03-12 Thread Casey T
Hi, I'm new to Python and I'm having some problems with getting different results from my script when I run it from IDLE versus just double- clicking the .py file and having it run through the command line. Basically, my script reads some CSV files, assembles a text files, then uploads that test f

Re: best way to have enum-like identifiers?

2008-03-12 Thread Pete Forman
[EMAIL PROTECTED] writes: > Currently I'm just putting this at the top of the file: > > py=1 > funcpre=2 > funcpost=3 > ... That can be done more compactly with py, funcpre, funcpost = range(3) give or take 1. > but I'm curious if there's a better way of doing this,

Re: ValueError in pickle module during unpickling a infinite float (python 2.5.2)

2008-03-12 Thread Mark Dickinson
On Mar 12, 11:22 am, [EMAIL PROTECTED] wrote: > Unpickling an infinite float caused a ValueError in the pickle module. > I need to pickle and load infinite floats in my project. Do you have > any suggestions how to solve the issue? Have you tried this on the recent 2.6 alpha (Python2.6a1)? It's a

Re: Python - CGI - XML - XSD

2008-03-12 Thread Stefan Behnel
xkenneth wrote: > On Mar 12, 6:32 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> xkenneth wrote: >>> Hi All, >>>Quick question. I've got an XML schema file (XSD) that I've >>> written, that works fine when my data is present as an XML file. >>> (Served out by apache2.) Now when I call pyt

Problem with subprocess in threaded enviroment

2008-03-12 Thread Ningyu Shi
I'm trying to write a multi-task downloader to download files from a website using multi-threading. I have one thread to analyze the webpage, get the addresses of the files to be downloaded and put these in a Queue. Then the main thread will start some threads to get the address from the queue and

Re: Creating a file with $SIZE

2008-03-12 Thread Marco Mariani
Robert Bossy wrote: > Indeed! Maybe the best choice for chunksize would be the file's buffer > size... I won't search the doc how to get the file's buffer size because > I'm too cool to use that function and prefer the seek() option since > it's lighning fast regardless the size of the file and

Get cgi script to begin execution of another script...

2008-03-12 Thread sophie_newbie
I've posted something similar to this already, but now I'm more sure of what I'm asking. Basically I've a CGI script, that when executed by the user, I want to call another script that does a very long running task (10 hours +) and print a message on the screen saying that the user will be emailed

Re: merging intervals repeatedly

2008-03-12 Thread Magdoll
> Hi, > > The problem, as stated here, may have several solutions. For instance > the following set of intervals also satisfies the constraint: > (1,15), (20,40), (50,100) > > One question you should ask yourself is: do you want all solutions? or > just one? > If you want just one, there's another

Re: Py2exe and Multi Treading problem.

2008-03-12 Thread Farsheed Ashouri
NO it dont work. If I remove threading part, it works like a charm. Any Idea? -- http://mail.python.org/mailman/listinfo/python-list

Re: Does __import__ require a module to have a .py suffix?

2008-03-12 Thread Michael Wieher
2008/3/12, mrstephengross <[EMAIL PROTECTED]>: > > Hi all. I've got a python file called 'foo' (no extension). I want to > be able to load it as a module, like so: > > m = __import__('foo') > > However, the interpreter tells me "No module named foo". If I rename > it foo.py, I can indeed import i

Re: Python - CGI - XML - XSD

2008-03-12 Thread xkenneth
On Mar 12, 6:32 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > xkenneth wrote: > > Hi All, > > >    Quick question. I've got an XML schema file (XSD) that I've > > written, that works fine when my data is present as an XML file. > > (Served out by apache2.) Now when I call python as a cgi scri

Re: a Roguelike in Python

2008-03-12 Thread Carl Banks
On Mar 12, 9:25 am, [EMAIL PROTECTED] wrote: > Seeing the 7DRL start up recently, i wanted to see what one was made > of. Python is the language i'm most familiar with so i searched for > some code to look at, but i couldn't find any. Can anyone direct me to > the right place? > > I did some search

Does __import__ require a module to have a .py suffix?

2008-03-12 Thread mrstephengross
Hi all. I've got a python file called 'foo' (no extension). I want to be able to load it as a module, like so: m = __import__('foo') However, the interpreter tells me "No module named foo". If I rename it foo.py, I can indeed import it. Is the extension required? Is there any way to override th

Unable to handle File Open dialog (using Pamie)

2008-03-12 Thread Oltmans
Hi all, I'm new to Python and am automating few tasks using Pamie. Everything worked well until I had to handle the File Open Dialog. I mean I'm trying to automate the file upload process using Pamie. Basically I just want to automate the process of file upload. I want to automatically hit the Br

Re: Mutagen File Problem

2008-03-12 Thread Max Erickson
aiwarrior <[EMAIL PROTECTED]> wrote: > Hi i'm having a IO error saying a file does not exist even though > i perform a isFile() check. Can you help me out figuring what is > wrong? > > Thanks in advance > > from mutagen.easyid3 import EasyID3 > from mutagen.mp3 import MP3 > > for root, dirs, f

Re: How about adding rational fraction to Python?

2008-03-12 Thread Mark Dickinson
On Mar 12, 7:20 am, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > But if the answer is incorrect (in the float calculation) the error is > limited. IEEE 754 prescribes that the error should be at most 1 LSB, IIRC. > And then the number of errors is the proper measure. There are two operations here

Re: access to base class __init__

2008-03-12 Thread Sam
Dennis Lee Bieber wrote: > On Thu, 06 Mar 2008 22:35:18 -0500, Sam <[EMAIL PROTECTED]> declaimed > the following in comp.lang.python: > ['line 1', 'line 2', 'embedded', 'line', 'something'] sample="""line 1\rline 2\rembedded\nline\rsomething\r""" sample.splitlines() > ['line 1', 'line 2

RE: List Combinations

2008-03-12 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Shane Geiger > Sent: Wednesday, March 12, 2008 10:33 AM > To: Michael Wieher > Cc: python-list@python.org > Subject: Re: List Combinations > > > > > > def gen(lists): > out = '[' + ','.jo

C extensions question

2008-03-12 Thread vvangelovski
Let's say I write a simple extension in c only for the windows version of my script. Can I just put this compiled dll in the root directory of my application along with the other py files and distribute it like that without the need of an installation script? -- http://mail.python.org/mailman/list

Re: List Combinations

2008-03-12 Thread Mel
Gerdus van Zyl wrote: > I have a list that looks like this: > [['3'], ['9', '1'], ['5'], ['4'], ['2', '5', '8']] > > how can I get all the combinations thereof that looks like as follows: > 3,9,5,4,2 > 3,1,5,4,2 > 3,9,5,4,5 > 3,1,5,4,5 > etc. > > Thank You, > Gerdus What they said, or, if you wa

Re: Creating a file with $SIZE

2008-03-12 Thread cokofreedom
On Mar 12, 2:44 pm, Robert Bossy <[EMAIL PROTECTED]> wrote: > Matt Nordhoff wrote: > > Robert Bossy wrote: > > >> k.i.n.g. wrote: > > >>> I think I am not clear with my question, I am sorry. Here goes the > >>> exact requirement. > > >>> We use dd command in Linux to create a file with of required

Re: List Combinations

2008-03-12 Thread Mark Dickinson
On Mar 12, 10:18 am, Gerdus van Zyl <[EMAIL PROTECTED]> wrote: > I have a list that looks like this: > [['3'], ['9', '1'], ['5'], ['4'], ['2', '5', '8']] > > how can I get all the combinations thereof that looks like as follows: You could wait for Python 2.6, or download the current alpha: Python

ValueError in pickle module during unpickling a infinite float (python 2.5.2)

2008-03-12 Thread rehn
Unpickling an infinite float caused a ValueError in the pickle module. I need to pickle and load infinite floats in my project. Do you have any suggestions how to solve the issue? # code describing the issue: # define float constants with double-precision: # copied from fpconst module: http://w

RE: agg (effbot)

2008-03-12 Thread Robert Rawlins
Haha, Tim, that cracks me up! lol Bring forth the Holy Hand Grenade of Antioch Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Chase Sent: 12 March 2008 15:04 To: python-list@python.org Subject: Re: agg (effbot) Importance: Low Gerhard Häring wr

  1   2   >