Python code and C code in the same module?

2004-11-29 Thread Steven Bethard
I'd like to merge a module written in C with a module written in Python so that the user can access objects from either module by importing the single, merged module. Specifically, I'm looking at the collections module, which is written in C, and my Bunch object, which is written in Python. I'

Re: asynchat and threading

2004-11-29 Thread Michele Simionato
"Eric S. Johansson" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > this points to an important issue that should be addressed at some point > which is the ability to quickly and easily, on the level of rpm or > apt-get, import external frameworks. Depending on your distribu

keyword argument for min/max

2004-11-29 Thread Steven Bethard
So I've been playing around with trying to add a keyword argument to min and max that works similarly to the one for sorted. It wasn't too hard actually, but it does raise a few questions about proper handling of keyword arguments. Currently, help(max) gives: max(...) max(sequence) -> val

Re: Random number generation from functions

2004-11-29 Thread CptPicard
drs wrote: Is there any way to generate random numbers based on arbitrary real valued functions? I am looking for something like random.gauss() but with natural log and exponential functions. thanks, -d I remember for having used it on a gaussian generator that you can do that very easily by your

Re: UML and OO design tool with Python support

2004-11-29 Thread Ville Vainio
> "Paul" == Paul McGuire <[EMAIL PROTECTED]> writes: Paul> I just found out that my favorite UML modeling tool, Paul> Enterprise Architect, has just released a new version, Paul> *with* Python code support. You can ... Somewhat tangentially, but still on-topic for the subject li

Re: Python GTK import error

2004-11-29 Thread Qianqian Fang
sorry keep bugging you guys, but this is somehow a wield problem that I am eager to solve. I checked the permission and it looks fine to me: lrwxrwxrwx 1 root root 26 Nov 28 04:06 /usr/lib/libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.400.13 -rwxr-xr-x 1 root root 2862900 Oct 15 14:23 /usr/lib/l

Re: how to drop all thread ??

2004-11-29 Thread Chris S.
Leon wrote: if class A( use threading,thread module ) to produce 100 thread,how to drop its (100 thread) when its running As Roggisch suggests, the cleanest way is if the thread kills itself once signaled by an exit condition. However, there is a non-orthodox way of pseudo-forcibly killing threa

Re: PIL 1.1.4 paste PNG's with transparency problem

2004-11-29 Thread Tom Hanks
"Caleb Hattingh" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > >>> iconBallImage.paste(iconShieldImage, (10,10)) >>> iconBallImage.paste(iconShieldImage, (10,10), iconShieldImage) ^^^

Re: threading, qt, and the freakout

2004-11-29 Thread Ken Godee
Ben Floyd wrote: Hey everyone, Why doesn't this work? The code speaks much more clearly than I do, so i shortened it and pasted it below. Running this and clicking on 'Break Me' will... freak out the window... You can not mix GUI threads and non GUI threads. Just changing text may seem to work, bu

threading, qt, and the freakout

2004-11-29 Thread Ben Floyd
Hey everyone, Why doesn't this work? The code speaks much more clearly than I do, so i shortened it and pasted it below. Running this and clicking on 'Break Me' will... freak out the window... But... only when the pushbutton_obj.setText("Updated") line is in the thread. If I comment out the thre

Re: date diff calc

2004-11-29 Thread Tim Peters
[Skip Montanaro] > ... > The datetime.date object already exposes a strftime method for > generating a formatted string output and will create date objects > from both time.time() output (fromtimestamp) and "proleptic > Gregorian ordinal"s (fromordinal). Looking at the datetime module > docs, it's

[MailServer Notification] To External Sender: a virus was found a nd action taken.

2004-11-29 Thread System Attendant
ScanMail for Microsoft Exchange took action on the message. The message details were: Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED]; Subject = Mail Delivery (failure [EMAIL PROTECTED]) Scanning time = 11/29/2004 20:21:06 Engine/Pattern = 7.000-1004/2.269.00 Action taken on message:

Re: Random number generation from functions

2004-11-29 Thread Colin J. Williams
drs wrote: Is there any way to generate random numbers based on arbitrary real valued functions? I am looking for something like random.gauss() but with natural log and exponential functions. thanks, -d numarray has a random package which provides a number of functions, including: normal( mean,

Re: tkinter shell problem

2004-11-29 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, "Philippe C. Martin" <[EMAIL PROTECTED]> wrote: >Hi, > >I have the following problem:... >If I trap (an exception), I do not get the stack dump that I which I would >show. >... >If I don"t trap it, then my clean up code...does not get called... > >Yet Idle manages

Re: subclassing extension type and assignment to __class__

2004-11-29 Thread David Bolen
gregory lielens <[EMAIL PROTECTED]> writes: (...) > Yes I was affraid this would be the conclusion: embedding instead of > inheritance...But this means that not only the method that need to be > modified need to be rewritten in python, all the other ones also just > to delegate to the embedded ins

Re: Number of colors in an image

2004-11-29 Thread David Bolen
Christos "TZOTZIOY" Georgiou <[EMAIL PROTECTED]> writes: > A set seems more appropriate in this case: > > color_count = len(set(izip(r, g, b))) # untested code Well, while potentially premature optimization, I was trying for performance in this case. In Python 2.3, the sets module is coded in P

Re: Python-list Digest, Vol 14, Issue 377

2004-11-29 Thread Jamie Saker
On Mon, 29 Nov 2004 16:05:14 -0500, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > If I could simply do: py-get twisted And I forgot to mention, the Gentoo 'emerge' tool is actually written in Python, so in a sense, your py-get is already there in Gentoo. From the header of /usr/bin/python:

Re: A lock that times out but doesn't poll

2004-11-29 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Jive <[EMAIL PROTECTED]> wrote: . . . >B) Writing bug-free code is quite possible when the job is well-defined and >"from scratch." . .

documentation for PyArg_ParseTupleAndKeywords

2004-11-29 Thread Steven Bethard
I'm just starting to play around with the Python source. (Specifically, I'm looking at adding a key argument to max/min like sorted has.) Can anyone direct me to the documentation on how PyArg_ParseTupleAndKeywords, etc. work? In particular, I can't figure out how the format arg to vgetargsk

Re: Random number generation from functions

2004-11-29 Thread Bengt Richter
On Mon, 29 Nov 2004 20:51:50 GMT, "drs" <[EMAIL PROTECTED]> wrote: >Is there any way to generate random numbers based on arbitrary real valued >functions? I am looking for something like random.gauss() but with natural >log and exponential functions. > >thanks, Don't know what you mean. This kind

Re: Python-list Digest, Vol 14, Issue 377

2004-11-29 Thread Jamie Saker
On Mon, 29 Nov 2004 16:05:14 -0500, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > If I could simply do: py-get twisted or how about 'emerge twisted' works fine for me! When twisted2 comes out, emerge world will catch it for me too. Check out Gentoo at http://www.gentoo.org for more info, or

Re: knowing a file's own name

2004-11-29 Thread Scott Frankel
Thanks for the responses! I'd forgotten about using the sys module: import sys filename = sys.argv[0] Using "__file__" also works. Thanks Scott On Nov 29, 2004, at 9:37 AM, Scott Frankel wrote: I'm looking for a way to identify a filename remotely. Put differently, is there a way

python API wrapper for C++ API

2004-11-29 Thread Mark Doberenz
I'm fairly new at Python, but I've got a project I really want to do.   I'm working with a real-time 3D program called Deep Creator, and it has a C++ API written for it.  I'm wondering what it would take to create a Python wrapper that would allow me to write Python programs that would call

Re: slicing, mapping types, ellipsis etc.

2004-11-29 Thread Bengt Richter
On 29 Nov 2004 16:45:52 -0500, Jerry Sievers <[EMAIL PROTECTED]> wrote: >"Caleb Hattingh" <[EMAIL PROTECTED]> writes: > >> I'm going to assume the following is self-explanatory - type the commands >> in yourself. > >[snip] > >Yes, it certainly is self-explanatory. And, I appreciate your >respon

pre-PEP generic objects

2004-11-29 Thread Steven Bethard
I promised I'd put together a PEP for a 'generic object' data type for Python 2.5 that allows one to replace __getitem__ style access with dotted-attribute style access (without declaring another class). Any comments would be appreciated! Thanks! Steve -

Re: Numeric: 'where' function conditions

2004-11-29 Thread Robert Kern
Jorl Shefner wrote: Could anyone tell me the efficient way to do this? Extracting values from an array for a single condition (say all values greater than 'x') using 'where' and 'compress' is simple enough. from Numeric import arange,where,compress data= arange(10) data= [0, 1, 2, 3, 4, 5,

Re: tkinter manual question

2004-11-29 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Sean McIlroy <[EMAIL PROTECTED]> wrote: >The 'Canvas Methods' section of the online Intro to Tkinter >(http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm) >refers (without explanation) to something called "bbox". What is this? >TIA "bounding bo

Numeric: 'where' function conditions

2004-11-29 Thread Jorl Shefner
Could anyone tell me the efficient way to do this? Extracting values from an array for a single condition (say all values greater than 'x') using 'where' and 'compress' is simple enough. >>> from Numeric import arange,where,compress >>> data= arange(10) >>> data= [0, 1, 2, 3, 4, 5, 6, 7, 8,

Re: using os

2004-11-29 Thread Jeremy Jones
Jerry Sievers wrote: Juliano Freitas <[EMAIL PROTECTED]> writes: how can i get just the directories in other directorie without a files using the os module in Python?? If there's a command for listing only dirs, I've not stumbled on it. Here's a one-liner using filter

Re: slicing, mapping types, ellipsis etc.

2004-11-29 Thread Scott David Daniels
Jerry Sievers wrote: I'd like to know; 1. what the Ellipsis object or ... syntax is used for Use the Numeric (or numarray) package to really see these in use. Otherwise, you mostly get to implement it yourself. > 2. what a slice [..., j:k:l] does Again, see numeric. Essentially, select parts of a

Question of Optionparse

2004-11-29 Thread Pekka Niiranen
Hi, How can I STOP Optionparse to process boolean value as parameter. See this: >>> parser = optparse.OptionParser() >>> parser.add_option("-x",dest='xxx', action="store_true",help="xxx") >>> parser.add_option("-r",dest='root',help="directory",type="string") >>> args = ["-r", "d:", "-x"] >>> parser

Re: slicing, mapping types, ellipsis etc.

2004-11-29 Thread Steven Bethard
Jerry Sievers wrote: 1. what the Ellipsis object or ... syntax is used for 2. what a slice [..., j:k:l] does My understanding is that the Ellipsis object is intended primarily for Numeric/numarray use. Take a look at: http://stsdas.stsci.edu/numarray/numarray-1.1.html/node26.html 3. how slices a

Re: tkinter manual question

2004-11-29 Thread Richard Townsend
On 29 Nov 2004 13:58:05 -0800, Sean McIlroy wrote: > The 'Canvas Methods' section of the online Intro to Tkinter > (http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm) > refers (without explanation) to something called "bbox". What is this? > TIA Do you mean this section ?

Re: unicode question

2004-11-29 Thread Bengt Richter
On Tue, 23 Nov 2004 20:37:04 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: >> Am I the only person who found it scary that Bengt could apparently >> casually drop on a polynomial the would decode to " Löwis"? Well, don't give me too much credit

Re: using os

2004-11-29 Thread Jerry Sievers
Juliano Freitas <[EMAIL PROTECTED]> writes: > how can i get just the directories in other directorie without a > files using the os module in Python?? If there's a command for listing only dirs, I've not stumbled on it. Here's a one-liner using filter and lambda; from os import listdir from os.

Anybody using Arch?

2004-11-29 Thread Gustavo Córdova Avila
Does anybody have an Arch archive with the current python source I could slurp it from? Thanks in advance :-) -- Gustavo Córdova Avila <[EMAIL PROTECTED]> *Tel:* +52 (81) 8130-1919 ext. 127 Integraciones del Norte, S.A. de C.V. Padua #6047, Colonia Satélite Acueducto M

Re: Help on creating a HTML by python

2004-11-29 Thread Jarek Zgoda
sepgy wrote: Can anyone help me to use a python to create an HTML photo gallery generator. When it's finished, it will be able find all the picture files (i.e. .jpg, .gif. .png files) in any given folder on the computer, automatically create smaller thumbnails for each image, and then generate a co

Re: asynchat and threading

2004-11-29 Thread Jp Calderone
On Mon, 29 Nov 2004 16:05:14 -0500, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > If I could simply do: py-get twisted > and have all of the dependencies resolved, it would be wonderful. as a > prototype, I would suggest wrapping apt-get with a python envelope which > automatically invokes

tkinter manual question

2004-11-29 Thread Sean McIlroy
The 'Canvas Methods' section of the online Intro to Tkinter (http://www.pythonware.com/library/tkinter/introduction/x2102-methods.htm) refers (without explanation) to something called "bbox". What is this? TIA -- http://mail.python.org/mailman/listinfo/python-list

Re: using os

2004-11-29 Thread Jean Brouwers
Check the os.walk() and os.path.walk() functions. More details and some examples are at resp. /Jean Brouwers In article <[EMAIL PROTECTED]>, Juliano Freitas <[EMAIL PROTECTED]> wrote: > how

Re: using os

2004-11-29 Thread Jeffrey Froman
Juliano Freitas wrote: > how can i get just the directories in other directorie without a files > using the os module in Python?? You can test using os.path.isdir, for example: >>> import os >>> [x for x in os.listdir('.') if os.path.isdir(x)] Jeffrey -- http://mail.python.org/ma

Re: slicing, mapping types, ellipsis etc.

2004-11-29 Thread Jerry Sievers
"Caleb Hattingh" <[EMAIL PROTECTED]> writes: > I'm going to assume the following is self-explanatory - type the commands > in yourself. [snip] Yes, it certainly is self-explanatory. And, I appreciate your response. However, my question pertains to advanced use of the slicing features which I

Re: The use of :

2004-11-29 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, bruno modulix wrote: > > In fact, from a purely technical POV, the ':' could have been omitted > from the Python syntax, since indentation does the whole job of defining > blocks. It's only here for readability AFAIK. > The ':' serves as a very good hint to "python awa

using os

2004-11-29 Thread Juliano Freitas
how can i get just the directories in other directorie without a files using the os module in Python?? Juliano -- http://mail.python.org/mailman/listinfo/python-list

Re: asynchat and threading

2004-11-29 Thread Caleb Hattingh
I heartily support something like this, but alas I have not the time to help out with it. I like the Enthought python distribution because it installs several packages in one shot. A pity there isn't a similar thing for python addons in Linux (or is there?). Something apt-get-like would be

Re: slicing, mapping types, ellipsis etc.

2004-11-29 Thread Caleb Hattingh
I'm going to assume the following is self-explanatory - type the commands in yourself. '>>> a = 'hello my name is caleb' '>>> b = a.split() '>>> b ['hello', 'my', 'name', 'is', 'caleb'] '>>> b[0] 'hello' '>>> b[1] 'my' '>>> b[0:1] ['hello'] '>>> b[0:2] ['hello', 'my'] '>>> b[-1] 'caleb' '>>> b[:

Re: Parallel Python on PowerMac?

2004-11-29 Thread Robert Kern
Alan Kennedy wrote: Although, iff your prospective machine supports System V IPC, you might want to check out PoSH. http://poshmodule.sourceforge.net It uses inline assembly, so that's a no-go on the PPC unless someone ports the assembly code. -- Robert Kern [EMAIL PROTECTED] "In the fields of

PIL 1.1.4 paste PNG's with transparency problem

2004-11-29 Thread Caleb Hattingh
Here's hoping effbot is around :) I have a really simple situation where I have 2 png images, and open them so: '>>> iconBallImage = Image.open('sampleTextures/iconBall.png').resize(DimensionSize) '>>> iconShieldImage = Image.open('sampleTextures/iconShield.png').resize(DimensionSize) The 2

Re: asynchat and threading

2004-11-29 Thread Eric S. Johansson
Anthony Baxter wrote: twisted is too large to go into the python core as is - in addition, there's a mismatch between Python's release cycle speed and twisted's release cycle speed (although the current delayed-until-who-knows-when Twisted 2.0 might be a harbinger of twisted slowing down to Python

Re: how to drop all thread ??

2004-11-29 Thread Michel Claveau - abstraction méta-galactique non triviale en fuite perpétuelle.
Hi ! The best method, it is the suicide (of the threads). -- http://mail.python.org/mailman/listinfo/python-list

Random number generation from functions

2004-11-29 Thread drs
Is there any way to generate random numbers based on arbitrary real valued functions? I am looking for something like random.gauss() but with natural log and exponential functions. thanks, -d -- http://mail.python.org/mailman/listinfo/python-list

slicing, mapping types, ellipsis etc.

2004-11-29 Thread Jerry Sievers
Fellow Pythonists; I am totally puzzled on the use of slicing on mapping types and especially unsure on use of the Ellipsis... and slicing syntax that has two or more groups seperated by comma. I am referring to (from the manual); Slice objects Slice objects are used to

Python UPS / FedEx Shipping Module

2004-11-29 Thread Gabriel Cooper
Is there an existing UPS and FedEx capable shipping (as in, price quotes) module out there? I have UPS working but now I need FedEx and was curious whether I'd be reinventing the wheel. ;) Web searches didn't reveal anything particularly interesting. Also, anyone know what happened to the "paym

POSH on PowerMac? (was: Parallel Python on PowerMac?)

2004-11-29 Thread Wolfgang Keller
>> Although, iff your prospective machine supports System V IPC, > > No clue whether MacOS X does so. [EMAIL PROTECTED]&! Read before you post. According to "Mac OS X for UNIX Users" there's a compatibility library included in Mac OS X that does so. Now who's got a the tools and the know-how to

Re: Building web graphics with Python

2004-11-29 Thread Larry Bates
ReportLab Graphics module can produce graphics and then save into many formats via Python Imaging Library (PIL). Larry Bates Steven Feil wrote: I am wondering if there is a light weight Python library for producing web graphics on-the-fly. There is a C-language library called gd that can be used i

Re: date diff calc

2004-11-29 Thread Rick Holbert
Here's how to do it as a one-liner: python -c "import datetime; import time; print 'Only %d days until Christmas' % (datetime.date(2004, 12, 25) - datetime.date.fromtimestamp(time.time())).days" Here's a slightly shorter way of doing it: python -c "import time; print 'Only %f more days until Ch

Re: Protecting Python source

2004-11-29 Thread Dave Reed
On Monday 29 November 2004 14:13, Grant Edwards wrote: > On 2004-11-29, Peter Maas <[EMAIL PROTECTED]> wrote: > > > If the "reverse engineering" argument boils down to "protecting source > > doesn't make sense" then why does Microsoft try so hard to protect > > its sources? > > To avoid embaras

Re: Operator Overloading

2004-11-29 Thread Bengt Richter
On 25 Nov 2004 06:35:23 -0800, [EMAIL PROTECTED] (Sebastien Boisgerault) wrote: >Peter Maas <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... >> Sebastien Boisgerault schrieb: >> > I wonder if the following quotation from the Python Reference Manual >> > (release 2.3.3) about opera

Re[2]: httplib question

2004-11-29 Thread Laszlo Zsolt Nagy
Hello Stuart, Monday, November 29, 2004, 8:59:57 PM, you wrote: > Laszlo, > The "request" method call expects a "body" parameter that defaults to None > as the 3rd method parameter. You will either need to pass in an empty > string as the body parameter, or assign the headers property by named

httplib question

2004-11-29 Thread Laszlo Zsolt Nagy
Hello, This is from the docs, from section 11.6.1 (HTTPConnection Objects) HTTPConnection instances have the following methods: request( method, url[, body[, headers]]) [.] The headers argument should be a mapping of extra HTTP headers to send with the request. AFAIK the only standard map

Re: Parallel Python on PowerMac?

2004-11-29 Thread Wolfgang Keller
Hello, and thanks for your reply. > But I would venture to say that, *in the general case*, the "most > efficient" way to benefit from a second cpu, both in terms of coding > time and execution efficiency, is to use either jython *cough* *choke* Err, no, sorry, not for me. > Although, iff yo

Re: A lock that times out but doesn't poll

2004-11-29 Thread Jive
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jive wrote: > > Oh, there will be no bugs. > > ?? What kind of a statement is that? Humorous? Imagine Carl Spackler in Caddy Shack saying, "Oh, there will be no money." > Seriously, why are you so confident about that

Re: Protecting Python source

2004-11-29 Thread Grant Edwards
On 2004-11-29, Peter Maas <[EMAIL PROTECTED]> wrote: > If the "reverse engineering" argument boils down to "protecting source > doesn't make sense" then why does Microsoft try so hard to protect > its sources? To avoid embarassment. -- Grant Edwards grante Yow! W

Re: Protecting Python source

2004-11-29 Thread Peter Maas
Craig Ringer schrieb: On Mon, 2004-11-29 at 18:04, Peter Maas wrote: I can think of 3 reasons to prevent tampering: [...] My understanding is that that's never guaranteed safe, no? Or are restrictions against reverse engineering now commonly enforcable? It's not guaranteed but if protection works

Re: date diff calc

2004-11-29 Thread Skip Montanaro
tertius> Is there a more pythonic way to write or do a date difference tertius> calculation? I have as input two date fields in the form tertius> '-MM-DD' How about: import datetime import time bd = "2004-11-25" ed = "2004-11-30" start = datetime.date.fromti

Re: Parallel Python on PowerMac?

2004-11-29 Thread Alan Kennedy
[Wolfgang Keller] > as I might get a dual-G5 PowerMac someday in the not to distant > future, I was wondering what options are available for making Python > benefit from the second CPU? Running two interpreters and using Pyro > would not be the most efficient (and easiest) way, I guess? Qualifier:

pdb with emacs

2004-11-29 Thread Yuri Shtil
Hi, I am trying to learn python and use the gud/pdb from emacs. The functionality that I am used to under gud/gdb and gud/perldb is missing, or I don't know how to make it work. Specifically: when I start pdb on a script file, the source does not show in an another window as it does with perldb an

Re: Question on sorting

2004-11-29 Thread wes weston
Lad wrote: Hi, I have a file of records of 4 fields each. Each field is separated by a semicolon. That is Filed1;Ffield2;Field3;Field4 But there may be also empty records such as (only semicolons). For sorting I used # lines = file('Config.txt').readlines()# a file I want to so

Re: date diff calc

2004-11-29 Thread tertius
Diez B. Roggisch wrote: > I can't imagine what could possibly be easier than subtracting two dates - in fact, most times one has to jump through much more hoops to achieve these results, e.g. in java. I'll try that. Thanks, T -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Re: SysLogHandler is drivin me nuts PEBCAC

2004-11-29 Thread Lloyd Zusman
Jan Dries <[EMAIL PROTECTED]> writes: > Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's > keyboard and not ceyboard? Your computer didn't come with a ceyboard? :) -- Lloyd Zusman [EMAIL PROTECTED] God bless you. -- http://mail.python.org/mailman/listinfo/python-li

Re: date diff calc

2004-11-29 Thread Diez B. Roggisch
> bdl = '2004-11-25'.split('-') > edl = '2004-11-30'.split('-') > bd = date(int(bdl[0]), int(bdl[1]), int(bdl[2])) > ed = date(int(edl[0]), int(edl[1]), int(edl[2])) using time.strptime and datetime.date.fromtimestamp is surely the better alternative, as it lets specify you the format by a str

Question on sorting

2004-11-29 Thread Lad
Hi, I have a file of records of 4 fields each. Each field is separated by a semicolon. That is Filed1;Ffield2;Field3;Field4 But there may be also empty records such as (only semicolons). For sorting I used # lines = file('Config.txt').readlines()# a file I want to sort lines

unicode in doctests

2004-11-29 Thread Bjorn Tillenius
I'm trying to combine documentation and testing, by using DocFileSuite from Python 2.4. But the problem is that I need to write non-ascii characters in the test, and I can't get it to work. I haven't found a way to specify which encoding the file is in, so it gets decoded to unicode. Anyone know i

Re: C API PyErr_Clear vs PyObject_HasAttrString

2004-11-29 Thread Andrew MacIntyre
On Sun, 28 Nov 2004, Robin Becker wrote: > > I had a look at the source (from a CVS checkout this morning), and the > > only thing that looks like a source of such trouble would be an extension > > class with a tp_getattr implementation. > > It is such a beast, but the exciting test case looks lik

Re: knowing a file's own name

2004-11-29 Thread Fredrik Lundh
Scott Frankel wrote: > I'm looking for a way to identify a filename remotely. Put differently, > is there a way a file can get its own name from its globals()? > > doit.py calls exec() on a second py script, tpairs.py, to obtain a dict of > the globals in > tpairs.py. How can I add the filenam

date diff calc

2004-11-29 Thread tertius
Hi, Is there a more pythonic way to write or do a date difference calculation? I have as input two date fields in the form '-MM-DD' TIA Terius from datetime import date bdl = '2004-11-25'.split('-') edl = '2004-11-30'.split('-') bd = date(int(bdl[0]), int(bdl[1]), int(bdl[2])) ed = date(in

Re: how to drop all thread ??

2004-11-29 Thread Andrew Koenig
This reply is off topic but I couldn't resist: The best way to get rid of thread is to adopt a kitten. In fact, one of my cats is named Snobol because she is such a good string manipulator. -- http://mail.python.org/mailman/listinfo/python-list

knowing a file's own name

2004-11-29 Thread Scott Frankel
I'm looking for a way to identify a filename remotely. Put differently, is there a way a file can get its own name from its globals()? doit.py calls exec() on a second py script, tpairs.py, to obtain a dict of the globals in tpairs.py. How can I add the filename, "tpairs.py," to the resulting d

Parallel Python on PowerMac?

2004-11-29 Thread Wolfgang Keller
Hello, as I might get a dual-G5 PowerMac someday in the not to distant future, I was wondering what options are available for making Python benefit from the second CPU? Running two interpreters and using Pyro would not be the most efficient (and easiest) way, I guess? TIA, Best regards Wolfgang

Re: Newbie MySQLdb / MySQL version problem, I think

2004-11-29 Thread Dave Merrill
Thanks Allastair, Leon, Tim, anyone else I missed. Bingo, that was it. I didn't even try looking at mysql.com, duh. In my defense (;-), I'd already spent a bunch of time in incompatible version hell with other things, so I was (too) ready to think it either wouldn't work period, or I'd borked it u

[OT] Re: SysLogHandler is drivin me nuts PEBCAC

2004-11-29 Thread Jan Dries
Slightly OT, but regarding the title, shouldn't it be PEBKAC, since it's keyboard and not ceyboard? Regards, Jan michael wrote: Vinay Sajip <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... michael wrote: Yep it was incomplete heres the complete config as it has to be [config file

Re: Closing files

2004-11-29 Thread Daniel Dittmar
Timo Virkkala wrote: Daniel Dittmar wrote: And then there are a lot of people who think that changing all the readlines one liner would be quite easy should the need of a Jython port arrive, so why bother about it now? The problem with this approach is, when the time for the Jython port arrives,

Re: PyQt on a Server

2004-11-29 Thread Jerry Sievers
Bob Parnes <[EMAIL PROTECTED]> writes: > I have an application importing qt on a linux server and am missing > something in trying to run it from a workstation via nfs. The > workstation has the server /usr directory mounted to its own /usr > directory, so it can access the necessary files. The

Re: how to drop all thread ??

2004-11-29 Thread Peter Hansen
Diez B. Roggisch wrote: Leon wrote: if class A( use threading,thread module ) to produce 100 thread,how to drop its (100 thread) when its running By exiting. There is no other way to stop a thread by force. Note that even trying to exit won't work, if the threads are not marked as "daemon" threa

Re: Protecting Python source

2004-11-29 Thread Craig Ringer
On Mon, 2004-11-29 at 18:04, Peter Maas wrote: > I can think of 3 reasons to prevent tampering: > > - You need money and want to sell your software on a "per seat" basis. If you mean that you therefore must add built-in copy-protection, then sure. Users will always get around it if they really w

Re: network programming without goto (refactoring)

2004-11-29 Thread Sibylle Koczian
Nick Coghlan schrieb: Roy Smith wrote: Jeff Shannon <[EMAIL PROTECTED]> wrote: In Python, exceptions use 'raise', not 'throw'... Doh! I guess it shows that I've been doing a lot of C++ lately :-) Heh. I'm working on a Python test harness that uses a C++ hardware interface module. I keep writing

Re: Closing files

2004-11-29 Thread Timo Virkkala
Daniel Dittmar wrote: And then there are a lot of people who think that changing all the readlines one liner would be quite easy should the need of a Jython port arrive, so why bother about it now? The problem with this approach is, when the time for the Jython port arrives, do you remember to d

Re: PyQt on a Server

2004-11-29 Thread Phil Thompson
This is likely to be a Qt/X setup problem - PyQt doesn't explicitly call Xrender. Does your workstation /etc/ld.so.conf contain a line for /usr/X11R6/lib? Phil > I have an application importing qt on a linux server and am missing > something in trying to run it from a workstation via nfs. The >

PyQt on a Server

2004-11-29 Thread Bob Parnes
I have an application importing qt on a linux server and am missing something in trying to run it from a workstation via nfs. The workstation has the server /usr directory mounted to its own /usr directory, so it can access the necessary files. The error I get is Traceback (most recent call las

Re: Closing files

2004-11-29 Thread Daniel Dittmar
Henrik Holm wrote: I have recently started playing around with Python. Some of the things I have done have involved reading files. The way I do this is along the lines of f = file('file.txt') lines = f.readlines() f.close() I have noticed that it is possible to do this in one line: lines

Re: wxPython: how to update a panel content/layout according to a variable content

2004-11-29 Thread Lo?c Mah?
Thanks for the answer. I will try the method you talked about. For the moment, I am creating a new sizer and new panel and call the SetSizer(...) and SetAutoLayout(...) but this is not satisfying me. Loïc "F. GEIGER" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > wxWindow h

Re: wxStyledTextCtrl problem ?

2004-11-29 Thread Paul Robson
On Mon, 29 Nov 2004 08:10:18 +, Jean Brouwers wrote: > If you are running GTK+ try using > > self.Editor.SetSTCFocus(True) > > in addition to or instead of SetFocus(). Plus maybe > > wx.CallAfter(self.Editor.EnsureCaretVisible) > > It solved the 'dissapearing caret' proble

Re: wxStyledTextCtrl problem ?

2004-11-29 Thread Paul Robson
On Sun, 28 Nov 2004 23:43:32 -0800, Josiah Carlson wrote: > I don't know why the problem you are having happens, but I would just > make a call to self.Editor.SetFocus() on an EVT_ACTIVATE event. Tried that, it doesn't work :( Or to be precise, it works every other time :) -- http://mail.pytho

Re: Newbie MySQLdb / MySQL version problem, I think

2004-11-29 Thread Tim Williams
"Dave Merrill" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > Sorry for the newbness... Win2K, Python 2.3.3, MySQL 4.1.7. Downloaded and > extracted MySQL-python-1.0.0.win32-py2.3.zip. Put the whole extracted > directory into C:\Program Files\Python23\Lib\site-packages\ and rena

Load module on IRIX 6

2004-11-29 Thread Roland Van Praag
Dear All, I try to prepare a new module named using python 1.5 on IRIX6. The shared library created is named igg.so and contains the initializarion routine initigg. I call in this routine Py_InitModule giving as first argument "igg". Whe I try to import this module, I always have the message : Sy

Re: protocols, inheritance and polymorphism

2004-11-29 Thread Dirk Thierbach
Dirk Thierbach <[EMAIL PROTECTED]> wrote: > Donn Cave <[EMAIL PROTECTED]> wrote: >> Quoth Jacek Generowicz <[EMAIL PROTECTED]>: >>> Specifically, dynamic polymorphism is impossible without dynamic >>> typing. > I haven't heard the term "dynamic typing" in this context, Sorry, that should have b

error import _bsddb module

2004-11-29 Thread Falko Zurell
Hi Newsgroup, I installed a python 2.3.4 on my linux box and some Berkeley DB version (4.2.21 and 4.1.25). Then I installed also the BSDDB3 package for python linked against the given older version of DB. The I tried to run a program (Current Servers cadmin) which makes oviously use of bsddb but

Re: how to drop all thread ??

2004-11-29 Thread Diez B. Roggisch
Leon wrote: > if class A( > use threading,thread module > ) to produce 100 thread,how to drop its (100 thread) when its running By exiting. There is no other way to stop a thread by force. Of course you can write a run()-method like this: def run(self): while self.running_condition:

Re: Help on creating a HTML by python

2004-11-29 Thread M.E.Farmer
[EMAIL PROTECTED] (sepgy) wrote in message > Can anyone help me to use a python to create an HTML photo gallery > generator. When it's finished, it will be able find all the picture > files (i.e. .jpg, .gif. .png files) in any given folder on the > computer, automatically create smaller thumbnails

Python Design Patterns

2004-11-29 Thread Tony Ha
Hello I am learning Python for in the pass ten months, and have brought a few books about Python. Most of them are good books by its only right, and all of them only teach you how to write Python programs using Python syntax and Python ways, but no one single Python book explicitly teaches you

  1   2   >