Re: Problems installing Python Imaging Library

2008-03-12 Thread zutesmog
On Mar 10, 3:06 am, Nick Day <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to install PIL from source on my CentOS 4.5 server. The > build summary reports that I have everything installed... > > > PIL 1.1.6 BUILD SUMMARY > -

Re: wxPython/wxWidgets ok for production use ? (was Re: Quality assurance in Python projects containing C modules)

2008-03-12 Thread Gilles Ganault
On Tue, 11 Mar 2008 11:43:45 +0100, Stef Mientki <[EMAIL PROTECTED]> wrote: >Funny, compared to Delphi-7, >I found the grid in wxPython much richer ;-) You haven't tried the better alternatives I had in mind: http://www.x-files.pl http://www.bergsoft.net http://www.tmssoftware.com http://www.scal

Re: unable to install gdal

2008-03-12 Thread luis
On 10 mar, 09:49, luis <[EMAIL PROTECTED]> wrote: > On 9 mar, 16:37, luis <[EMAIL PROTECTED]> wrote: > > > > > Hi > > > On Windows xp sp2 and python 2.4 > > > Yesterday I running old versions of gdal, and I try to upgrade > > > I download gdalwin32exe150.zip and gdal-python-13.win32-py2.4.exe > > I

Re: merging intervals repeatedly

2008-03-12 Thread Robert Bossy
Magdoll wrote: > Hi, > > I have to read through a file that will give me a bunch of intervals. > My ultimate goal is to produce a final set of intervals such that not > two intervals overlap by more than N, where N is a predetermined > length. > > For example, I could read through this input: > (1,

Re: Exctract GIF comment from image

2008-03-12 Thread wingi
On 11 Mrz., 18:39, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > 2008/3/11, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > Hi, > > > simple question: ThePILdoes not support reading the optional > > description in GIF Images. > > > I did a quick thing here, try it and check if it solves the problem

Re: best way to have enum-like identifiers?

2008-03-12 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I currently have a 2-dim hash, indexed by two strings: > > template['py']['funcpre'] > template['py']['funcpost'] > ... > > but I would prefer to have these indexed by constants of > some kind, since this seems a bit more natural: > > template[py][func

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

2008-03-12 Thread Larry
Dear all, I'm new to Python. I have a file (an image file actually) that I need to read pixel by pixel. It's an 8-bit integer type. I need to get the statistics like mean, standard deviation, etc., which I know a little bit already from reading numpy module. What I want to know is how to get the n

Re: Py2exe and Multi Treading problem.

2008-03-12 Thread GHUM
Farsheed Ashouri , > Here is my script > #** > #** > import threading > import socket > def openSocket(portNum): > mySocket = socket.socket ( socket.AF_INET,

Re: Creating a file with $SIZE

2008-03-12 Thread Chris
On Mar 12, 12:32 pm, "k.i.n.g." <[EMAIL PROTECTED]> wrote: > Hi All, > > I would like create files of different size, taking size as user > input. I need to check the data transfer rates from one network to > another . In order to do this I will have to create files of diff size > and work out. I a

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

2008-03-12 Thread GHUM
Doug, > File "VisionTrainer.py", line 49, in > File "SessionController.pyc", line 53, in > File "VisionEgg\__init__.pyc", line 42, in > File "VisionEgg\ParameterTypes.pyc", line 28, in > File "Numeric.pyc", line 93, in > File "Precision.pyc", line 26, in > File "Precision.pyc",

Creating a file with $SIZE

2008-03-12 Thread k.i.n.g.
Hi All, I would like create files of different size, taking size as user input. I need to check the data transfer rates from one network to another . In order to do this I will have to create files of diff size and work out. I am new to Python Thanks in advance. KK -- http://mail.python.org/mai

sys.stdout assign to- bug

2008-03-12 Thread castironpi
I'm actually intimidated enough by a few tries I make to say something on Python-Ideas, that I thought I'd run this by youguys first. import sys class ThreadedOut: def __init__( self, old ): self._old= old def write( self, s ): self._old.write( s ) s

Re: Creating a file with $SIZE

2008-03-12 Thread Chris
On Mar 12, 12:52 pm, Chris <[EMAIL PROTECTED]> wrote: > On Mar 12, 12:32 pm, "k.i.n.g." <[EMAIL PROTECTED]> wrote: > > > Hi All, > > > I would like create files of different size, taking size as user > > input. I need to check the data transfer rates from one network to > > another . In order to do

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

2008-03-12 Thread Paul Hankin
On Mar 12, 10:26 am, Larry <[EMAIL PROTECTED]> wrote: > I'm new to Python. I have a file (an image file actually) that I need > to read pixel by pixel. It's an 8-bit integer type. I need to get the > statistics like mean, standard deviation, etc., which I know a little > bit already from reading nu

Re: How about adding rational fraction to Python?

2008-03-12 Thread Piet van Oostrum
> "Gabriel Genellina" <[EMAIL PROTECTED]> (GG) wrote: >GG> En Tue, 04 Mar 2008 11:46:48 -0200, NickC <[EMAIL PROTECTED]> escribió: >>> A mildly interesting Py3k experiment: >>> >>> Python 3.0a3+ (py3k:61229, Mar 4 2008, 21:38:15) >>> [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)]

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

2008-03-12 Thread Bernard
Hey Larry, that one is fairly easy: >>> from array import array >>> array('i', [1, 2, 3, 4, 5, 1, 2]) >>> def count(x, arr): cpt = 0 # declare a counter variable for el in arr: # for each element in the array if el == x: # when it is equal to the 'x' value

Re: Max File Size

2008-03-12 Thread Diez B. Roggisch
xkenneth wrote: > Is the max file size a relevant issue in python anymore? I know OS X > has a max file size of 8 exabytes and I'm not sure about the latest > version of Ubuntu. Does python have an independent file size limit, or > is it dependent upon the OS it was compiled on? The latter should

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

2008-03-12 Thread John Machin
On Mar 12, 10:29 pm, Bernard <[EMAIL PROTECTED]> wrote: > Hey Larry, > > that one is fairly easy: > > >>> from array import array > >>> array('i', [1, 2, 3, 4, 5, 1, 2]) > >>> def count(x, arr): > > cpt = 0 # declare a counter variable > for el in arr: # for each element in the arra

Re: Python - CGI - XML - XSD

2008-03-12 Thread Diez B. Roggisch
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 script, and > tell it print out all of the same XML, also served up by apache2

Re: Creating a file with $SIZE

2008-03-12 Thread k.i.n.g.
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 size. In similar way, on windows I would like to use python to take the size of the file( 50MB, 1GB ) as input from user and create a uncompressed fil

Is it possible to reload a module from a different file?

2008-03-12 Thread ilochab
I mean ... The main module makes this import: import moduleX later other modules make different import to an other module named moduleX like this: from pack.subdir import moduleX What I want is that the second import of moduleX in some way must be redirected onto the first one. Is ther

Re: Creating a file with $SIZE

2008-03-12 Thread Robert Bossy
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 size. In > similar way, on windows I would like to use python to take the size of > the file( 50MB, 1GB ) as input from user and

Re: catching object

2008-03-12 Thread Stargaming
On Wed, 12 Mar 2008 01:05:06 +0100, Igor V. Rafienko wrote: > Hi, > > > I was wondering if someone could help me explain this situation: > > h[1] >>> import inspect > h[1] >>> inspect.getmro(ValueError) > (, , > , , 'object'>) > h[2] >>> try: > raise ValueError("argh") > except object: >

Re: Creating a file with $SIZE

2008-03-12 Thread Matt Nordhoff
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 size. In >> similar way, on windows I would like to use python to take the size of >> the file( 50MB,

computer shows

2008-03-12 Thread t3chn0n3rd
are there any computer trade shows in your area? -- http://mail.python.org/mailman/listinfo/python-list

a Roguelike in Python

2008-03-12 Thread Mdonle
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 searching on what it would take to write a roguelike in python

Re: Why no string return?

2008-03-12 Thread Piet van Oostrum
> gargonx <[EMAIL PROTECTED]> (g) wrote: >g> Still no return of string. The null testing is not really the deal. >g> that could be replaced with anything EG: >g> def ReturnMethod(request, x): >g> if request is 'random': You shouldn't test with `is' but with `=='. >g> return

Re: Creating a file with $SIZE

2008-03-12 Thread Robert Bossy
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 size. In >>> similar way, on windows I would like to use pyth

problem with Python 2.5.2 and gcc 4.3

2008-03-12 Thread David P. Riedel
Hi I tried building Python 2.5.2 using gcc 4.3.0. The build completes with no problems but when I run 'make test', I get a segfault part way through the test run. here is the last part of the output from make test test_softspace test_sort test_sqlite test_sqlite skipped -- no sqlite availab

List Combinations

2008-03-12 Thread Gerdus van Zyl
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 -- http://mail.python.org/mailman/listinfo/python-list

Re: image matching algorithms

2008-03-12 Thread Daniel Fetchinson
> > Thanks for the info! SIFT really looks like a heavy weight solution, > > but do you think the whole concept can be simplified if all I needed > > was: given a photo, find similar ones? I mean SIFT first detects > > objects on the image and find similarities, but I don't need the > > detection p

Re: a Roguelike in Python

2008-03-12 Thread Gustavo DiPietro
[EMAIL PROTECTED] ha scritto: > 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 searching on what it

Re: List Combinations

2008-03-12 Thread Michael Wieher
2008/3/12, Gerdus van Zyl <[EMAIL PROTECTED]>: > > 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 > > -

agg (effbot)

2008-03-12 Thread [EMAIL PROTECTED]
Downloaded to Knoppix 5.1: : aggdraw-1.2a3-20060212.tar.gz Followed README. Wouldn't compile. Couldn't find way of contacting Effbot directly. PIL stuff comes with Knoppix, but specs on agg seem better. vtk is on Knoppix too, but has a steep learning curve. TIA for help. -- http://mail.python

Re: List Combinations

2008-03-12 Thread Shane Geiger
Michael Wieher wrote: > > > 2008/3/12, Gerdus van Zyl <[EMAIL PROTECTED] > >: > > 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

Mutagen File Problem

2008-03-12 Thread aiwarrior
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, files in os.walk('''C:\\Documents and Settings\\pneves\ \Mus

Re: List Combinations

2008-03-12 Thread George Sakkis
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: > 3,9,5,4,2 > 3,1,5,4,2 > 3,9,5,4,5 > 3,1,5,4,5 > etc. > > Thank You,

Re: agg (effbot)

2008-03-12 Thread Gerhard Häring
[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 the compile command that threw the error. -- Gerhard -- http://mail.python.

RE: MySQL DB-Api

2008-03-12 Thread Robert Rawlins
Hello guys, sorry for dragging this to the top of the list again but I really am intrigued to get your feedback. I'm looking for a clean and efficient way to implement the DB-API into my application without having to create database connections for every instance of objects which require it.

Re: agg (effbot)

2008-03-12 Thread Tim Chase
Gerhard Häring wrote: > [EMAIL PROTECTED] wrote: >> aggdraw-1.2a3-20060212.tar.gz > > Try shegabittling the frotz first. If that doesn't help, please post the > output of the compile command that threw the error. Maynard: He who is valiant and pure of spirit may find the compiling instructions

RE: Obtaining the PyObject * of a class

2008-03-12 Thread Bronner, Gregory
The short answer is that you don't need to: Anything that has a 'handle' attribute that is an int should be fine to pass into the function, and your typemap will be fine (with some additional checking) If you really insist on absolute type safety, however, you'll need an instance of the Pin c

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

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: 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

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 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

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 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

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: 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: 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

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

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

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

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: 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: 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: 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: 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

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

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: 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

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: 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,

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: 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

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

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: 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

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: 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 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: 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: 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

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: 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

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: 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 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: 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') >>

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: 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

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

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 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

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: 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: 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(

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: 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

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 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: 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: 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: 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: 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

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: 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

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

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

  1   2   >