Chicago Python Users Group, April 14

2005-04-12 Thread Ian Bicking
The Chicago Python User Group, ChiPy, will have its next meeting on
Thursday, April 14th, starting at 7pm.  For more information on ChiPy
see http://chipy.org
Michael Tobis, who is organizing this meeting, needs to give the
building a list of names.  If you think it's possible you will come,
send email to [EMAIL PROTECTED] so he can put you on the list, and
bring an ID.
Presentation

Topic: Subversion and Making Apples from Applesauce
The goal of the Subversion project is to build a version control
system that is a compelling replacement for CVS in the open source
community.
Brian Fitzpatrick will tell us about how to use Subversion, the Python
bindings, and about cvs2svn, which he was one of the leads on-- Fitz
says that 'cvs2svn is the most difficult piece of code I've ever
written--I'm going to write a paper for CodeCon next year about it
called Making Apples from Applesauce. '
There will also be time to chat, and many opportunities to ask
questions.  We encourage people at all levels to attend.
Location

This month we will be meeting again at the historic Monadnock Building
in Downtown Chicago, at 53 W Jackson St. (in the loop at Jackson 
Dearborn).  It is convenient to all CTA lines.  Parking lots are
available nearby, but expect to pay about $9.
About ChiPy
---
ChiPy meets once a month, on the second Thursday of the month.  If you
can't come this month, please join our mailing list:
http://lonelylion.com/mailman/listinfo/chipy
--
http://mail.python.org/mailman/listinfo/python-announce-list
   Support the Python Software Foundation:
   http://www.python.org/psf/donations.html


NetworkX first public release (NX-0.2)

2005-04-12 Thread Aric Hagberg
NetworkX is a Python package for the creation, manipulation, and study
of the structure, dynamics, and functions of complex networks. The
potential audience includes mathematicians, physicists, biologists,
computer scientists, and social scientists.

http://networkx.sourceforge.net

Aric Hagberg
Pieter Swart
Dan Schult
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


SoCal Python Interest Group, April 19

2005-04-12 Thread Grig Gheorghiu
If you live in the Los Angeles/Orange County area and would like to
meet fellow Pythonistas, please consider attending the SoCal Piggies
meeting on Tuesday April 19 at 7:30 PM, at the Kerckhoff Marine Lab in
Newport Beach. Details are available at
http://agile.unisonis.com/socalpiggies . There's also a mailing list
you can join at http://lists.idyll.org/listinfo/socal-piggies .

Hope to see you there!

Grig

-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Do Re Mi chel La Si Do
And, also, with  dotNET-framework



-- 
http://mail.python.org/mailman/listinfo/python-list


Module for handling Nested Tables in HTML

2005-04-12 Thread Gurpreet Sachdeva
Hi guys,

Can anyone suggest some good tool for handling nested
tables in a HTML page... BeautifulSoup is somehow not working with
Nested Tables.

Thanks and Regards,
Garry
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best editor?

2005-04-12 Thread Fredrik Lundh
Mike Meyer wrote:

 Yup, that's why emacs stands for Eighty Megabytes And Constantly
 Swapping.  ;-)

 Gee, it's changed from eight to eighty. Probably because eight is a
 small app by todays standards. Then again, it's not like 80 is large
 these days.

my emacs starts in no time at all, and consumes just under 6 megs with python-
mode and a couple of moderately-sized python modules in memory.  that's just
over 1% of the available memory on this stock hardware.

guess my emacs is broken.

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


HTTPSConnection script fails, but only on some servers (long)

2005-04-12 Thread Paul Winkler
This is driving me up the wall... any help would be MUCH appreciated.
I have a module that I've whittled down into a 65-line script in
an attempt to isolate the cause of the problem.

(Real domain names have been removed in everything below.)

SYNOPSIS:

I have 2 target servers, at https://A.com and https://B.com.
I have 2 clients, wget and my python script.
Both clients are sending GET requests with exactly the
same urls, parameters, and auth info.

wget works fine with both servers.
The python script works with server A, but NOT with server B.
On Server B, it provoked a Bad Gateway error from Apache.
In other words, the problem seems to depend on both the client
and the server. Joy.

Logs on server B show malformed URLs ONLY when the client
is my python script, which suggests the script is broken...
but logs on server A show no such problem, which suggests
the problem is elsewhere.

DETAILS

Note, the module was originally written for the express
purpose of working with B.com;  A.com was added as a point of reference
to convince myself that the script was not totally insane.
Likewise, wget was tried when I wanted to see if it might be
a client problem.

Note the servers are running different software and return different
headers. wget -S shows this when it (successfully) hits url A:

 1 HTTP/1.1 200 OK
 2 Date: Tue, 12 Apr 2005 05:23:54 GMT
 3 Server: Zope/(unreleased version, python 2.3.3, linux2) ZServer/1.1
 4 Content-Length: 37471
 5 Etag:
 6 Content-Type: text/html;charset=iso-8859-1
 7 X-Cache: MISS from XXX.com
 8 Keep-Alive: timeout=15, max=100
 9 Connection: Keep-Alive

... and this when it (successfully) hits url B:

 1 HTTP/1.1 200 OK
 2 Date: Tue, 12 Apr 2005 04:51:30 GMT
 3 Server: Jetty/4.2.9 (Linux/2.4.26-g2-r5-cti i386 java/1.4.2_03)
 4 Via: 1.0 XXX.com
 5 Content-Length: 0
 6 Connection: close
 7 Content-Type: text/plain

Only things notable to me, apart from the servers are the Via: and
Connection: headers. Also the Content-Length: 0 from B is odd, but
that doesn't seem to be a problem when the client is wget.

Sadly I don't grok HTTP well enough to spot anything really
suspicious.

The apache ssl request log on server B is very interesting.
When my script hits it, the request logged is like:

A.com - - [01/Apr/2005:17:04:46 -0500] GET
https://A.com/SkinServlet/zopeskin?action=updateSkinIdfacilityId=1466skinId=406
HTTP/1.1 502 351

... which apart from the 502, I thought reasonable until I realized
there's
not supposed to be a protocol or domain in there at all.  So this is
clearly
wrong. When the client is wget, the log shows something more sensible
like:

A.com - - [01/Apr/2005:17:11:04 -0500] GET
/SkinServlet/zopeskin?action=updateSkinIdfacilityId=1466skinId=406
HTTP/1.0 200 -

... which looks identical except for not including the spurious
protocol and domain, and the response looks as expected (200 with size
0).

So, that log appears to be strong evidence that the problem is in my
client
script, right?  The failing request is coming in with some bad crap in
the path, which Jboss can't handle so it barfs and Apache responds with

Bad Gateway.  Right?

So why does the same exact client code work when hitting server B??
No extra gunk in the logs there. AFAICT there is nothing in the script
that could lead to such an odd request only on server A.


THE SCRIPT

#!/usr/bin/python2.3

from httplib import HTTPSConnection
from urllib import urlencode
import re
import base64

url_re = re.compile(r'^([a-z]+)://([A-Za-z0-9._-]+)(:[0-9]+)?')

target_urls = {
'B': 'https://B/SkinServlet/zopeskin',
'A': 'https://A/zope/manage_main',
}

auth_info= {'B':('userXXX', 'passXXX'),
'A':('userXXX', 'passXXX'),
}

def doRequest(target, **kw):
Provide a trivial interface for doing remote calls.
Keyword args are passed as query parameters.

url = target_urls[target]
user, passwd = auth_info[target]
proto,host,port=url_re.match(url).groups()
if port:
port = int(port[1:])   # remove the ':' ...
else:
port = 443
creds = base64.encodestring(%s:%s % (user, passwd))
headers = {Authorization: Basic %s % creds }
params = urlencode(kw).strip()
if params:
url = '%s?%s' % (url, params)
body = None # only needed for POST
args =('GET', url, body, headers)
print ARGS: %s % str(args)
conn = HTTPSConnection(host)
conn.request(*args)
response = conn.getresponse()
data = response.read()
if response.status = 300:
print
msg = '%i ERROR reported by remote system %s\n' %
(response.status,
   url)
msg += data
raise IOError, msg
print OK!
return data

if __name__ == '__main__':
print attempting to connect...
result1 = doRequest('A', skey='id', rkey='id')
result2 = doRequest('B', action='updateSkinId',
skinId='406',  facilityId='1466')
print done!


# EOF


Problem with downloading from www

2005-04-12 Thread NewFilmFan
I use Python 2.3 on Windows XP.
I wrote this program:

import httplib
conn = httplib.HTTPConnection(www.x.net)
conn.request(GET, /x/y.jpg)
r1 = conn.getresponse()
print r1.status, r1.reason
data = r1.read()
datei = open('test.jpg','w')
datei.write(data)
datei.close()

It is almost a copy of the manual. Now I can establish the connection and
receive the data. (The first response from the server is 200, OK.) The jpg
file is 198 K. But it is not a valid jpeg file. When I download with my
browser, the file has the length 197K and it is valid, of course. Is this
a problem of writing text or binary data to a file? Can anybody help me?

TIA,

nff


== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ 
Newsgroups
= East and West-Coast Server Farms - Total Privacy via Encryption =
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Module for handling Nested Tables in HTML

2005-04-12 Thread Fredrik Lundh
Gurpreet Sachdeva wrote:

Can anyone suggest some good tool for handling nested
 tables in a HTML page... BeautifulSoup is somehow not working with
 Nested Tables.

sounds strange.  have you tested the latest release? (2.0)

http://www.crummy.com/software/BeautifulSoup/

if you cannot get BS to work, and the author cannot help you, you might consider
using an HTML-XML converter, and using your favourite XML tool to pull apart
the result.  some alternatives:

http://utidylib.berlios.de/
http://effbot.org/zone/element-tidylib.htm

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


some sort of permutations...

2005-04-12 Thread Bernard A.
hello,

i'm looking for a way to have all possible length fixed n-uples from a
list, i think generators can help, but was not able to do it myself,
maybe some one could point me out to an idea to do it ?

for example, from :
l = [0, 1, 2, 3, 4]

and searching for n-uples of 3, i should produce :
(
(0, 1, 2),
(0, 1, 3),
(0, 1, 4),
(0, 2, 3),
(0, 2, 4),
(0, 3, 4),
(1, 2, 3),
(1, 2, 4),
(1, 3, 4),
(2, 3, 4),
)

does the set module or itertools can help in such cases ? i still have
missed the black magic behind itertools...

best regards
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with downloading from www

2005-04-12 Thread Fredrik Lundh
NewFilmFan [EMAIL PROTECTED] wrote:

 I wrote this program:

 import httplib
 conn = httplib.HTTPConnection(www.x.net)
 conn.request(GET, /x/y.jpg)
 r1 = conn.getresponse()
 print r1.status, r1.reason
 data = r1.read()
 datei = open('test.jpg','w')
 datei.write(data)
 datei.close()

if all you want to do is to download files from the web, urllib is a lot more
convenient:

urllib.urlretrieve(http://www.x.net/x.y.jpg;, test.jpg)

 It is almost a copy of the manual. Now I can establish the connection and
 receive the data. (The first response from the server is 200, OK.) The jpg
 file is 198 K. But it is not a valid jpeg file. When I download with my
 browser, the file has the length 197K and it is valid, of course. Is this
 a problem of writing text or binary data to a file?

changing the open() call to

datei = open('test.jpg','wb')

should fix this.

see the library documentation for details.

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolons

2005-04-12 Thread Andrei
Mage mage at mage.hu writes:

 I amafraid of I will stop using semicolons in other languages after one
 or two months of python. However I see that python simply ignores the
 semicolons atd the end of the lines.

I notice that when switching between Python and Delphi I'll sometimes type if
... then ... constructs in Python or if ... : in Delphi, or define classes
the wrong way, but I get used to the different syntax extremely quickly (I might
make a mistake once or twice, that's it). Same goes for semicolons. 

So I wouldn't worry about it, just write Python in Python, PHP in PHP, C in C,
etc. The semicolons are only a very small part of the differences between
languages and their absence is detected by the compiler when you forget them.

Yours,

Andrei




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: some sort of permutations...

2005-04-12 Thread Fredrik Lundh
Bernard A. wrote:

 i'm looking for a way to have all possible length fixed n-uples from a
 list, i think generators can help, but was not able to do it myself,
 maybe some one could point me out to an idea to do it ?

did you try googling for python permutations ?

here's the first hit:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NSInstaller Vs. Inno Setup

2005-04-12 Thread Miki Tebeka
Hello dcrespo,

 Any comments?
I'm happy with Inno.

Bye.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys


pgpdEFt0Cm0o9.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: I've broken PythonWin2.4 - Dialogs don't pop up!

2005-04-12 Thread Neil Hodgson
Michael Murdock:

 Rebooting does not help. I uninstalled and removed everything from
 c:\python2.4 and then downloaded and installed the latest version.
 Right after installing it, everything worked fine. But when I rebooted,
 the problem came back. 

   Do you have a copy of win32ui.pyd on the system path?

   Neil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Uwe Mayer
Tuesday 12 April 2005 06:36 am Steven Bethard wrote:
 Uwe Mayer wrote:
 I've been looking into ways of creating singleton objects.
 
 It strikes me that I've never wanted or needed a singleton object.
 Would you mind sharing your use case?  I'm just curious.

I am using a class to manage configuration settings in an application. This
object should only existe once so that when the user
changes a setting through a configuration dialog the change imminent in all
locations where access to config settings are needed.

I was using a factory function bevore, but since I am starting to use Python
2.4 and I remembered having read about a singleton-decorator I went to look
deeper into the possibilities.

Ciao
Uwe 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: web authoring tools

2005-04-12 Thread Steve Holden
Brandon J. Van Every wrote:
=?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?= [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 


Ideally, I would like an open source website + html design tool
implemented in Python
didn't you just say that ideally, you wanted a tool written in lisp
or scheme?
I honestly got a little tired of the tone of the answers I was
getting from that crowd, about what an idiot I am.  My query there is
still 
You mean you are interested in a web application programming
framework in  
the spirit of Seaside, or in a HTML/CSS editor in the spirit of  
Dreamweaver ?

I believe Dreamweaver-esque.  I see myself writing articles and eventually 
doing snazzy eye candy layouts.  I do not see myself engaging in elaborate 
flow control or anything terribly programmatic.  I want to concentrate on 
the content, not the mechanism.


I've stayed out of this one so far because of a natural disinclination 
to join religious discussions, but sine we are now talking good common 
sense I'd like to ask whether a *batch-oriented* system for folding 
database content into a static web site with common look-and-feel would 
be of interest.

Now PyCon is over I've been able to blog about the techniques used to 
generate the web site at http://www.holdenweb.com/, and most recently 
about using reStructured Text in the database to ease authorship 
problems for the less-taxing content. See

http://www.holdenweb.com/blogs/2005/04/versioned-reviews-implemented-post.html
to determine whether the overall approach would work for you.
regards
 Steve
--
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: HTTPSConnection script fails, but only on some servers (long)

2005-04-12 Thread Steve Holden
Paul Winkler wrote:
This is driving me up the wall... any help would be MUCH appreciated.
I have a module that I've whittled down into a 65-line script in
an attempt to isolate the cause of the problem.
(Real domain names have been removed in everything below.)
SYNOPSIS:
I have 2 target servers, at https://A.com and https://B.com.
I have 2 clients, wget and my python script.
Both clients are sending GET requests with exactly the
same urls, parameters, and auth info.
wget works fine with both servers.
The python script works with server A, but NOT with server B.
On Server B, it provoked a Bad Gateway error from Apache.
In other words, the problem seems to depend on both the client
and the server. Joy.
Logs on server B show malformed URLs ONLY when the client
is my python script, which suggests the script is broken...
but logs on server A show no such problem, which suggests
the problem is elsewhere.
DETAILS
Note, the module was originally written for the express
purpose of working with B.com;  A.com was added as a point of reference
to convince myself that the script was not totally insane.
Likewise, wget was tried when I wanted to see if it might be
a client problem.
Note the servers are running different software and return different
headers. wget -S shows this when it (successfully) hits url A:
 1 HTTP/1.1 200 OK
 2 Date: Tue, 12 Apr 2005 05:23:54 GMT
 3 Server: Zope/(unreleased version, python 2.3.3, linux2) ZServer/1.1
 4 Content-Length: 37471
 5 Etag:
 6 Content-Type: text/html;charset=iso-8859-1
 7 X-Cache: MISS from XXX.com
 8 Keep-Alive: timeout=15, max=100
 9 Connection: Keep-Alive
... and this when it (successfully) hits url B:
 1 HTTP/1.1 200 OK
 2 Date: Tue, 12 Apr 2005 04:51:30 GMT
 3 Server: Jetty/4.2.9 (Linux/2.4.26-g2-r5-cti i386 java/1.4.2_03)
 4 Via: 1.0 XXX.com
 5 Content-Length: 0
 6 Connection: close
 7 Content-Type: text/plain
Only things notable to me, apart from the servers are the Via: and
Connection: headers. Also the Content-Length: 0 from B is odd, but
that doesn't seem to be a problem when the client is wget.
Sadly I don't grok HTTP well enough to spot anything really
suspicious.
The apache ssl request log on server B is very interesting.
When my script hits it, the request logged is like:
A.com - - [01/Apr/2005:17:04:46 -0500] GET
https://A.com/SkinServlet/zopeskin?action=updateSkinIdfacilityId=1466skinId=406
HTTP/1.1 502 351
... which apart from the 502, I thought reasonable until I realized
there's
not supposed to be a protocol or domain in there at all.  So this is
clearly
wrong. When the client is wget, the log shows something more sensible
like:
A.com - - [01/Apr/2005:17:11:04 -0500] GET
/SkinServlet/zopeskin?action=updateSkinIdfacilityId=1466skinId=406
HTTP/1.0 200 -
... which looks identical except for not including the spurious
protocol and domain, and the response looks as expected (200 with size
0).
So, that log appears to be strong evidence that the problem is in my
client
script, right?  The failing request is coming in with some bad crap in
the path, which Jboss can't handle so it barfs and Apache responds with
Bad Gateway.  Right?
So why does the same exact client code work when hitting server B??
No extra gunk in the logs there. AFAICT there is nothing in the script
that could lead to such an odd request only on server A.
THE SCRIPT
#!/usr/bin/python2.3
from httplib import HTTPSConnection
from urllib import urlencode
import re
import base64
url_re = re.compile(r'^([a-z]+)://([A-Za-z0-9._-]+)(:[0-9]+)?')
target_urls = {
'B': 'https://B/SkinServlet/zopeskin',
'A': 'https://A/zope/manage_main',
}
auth_info= {'B':('userXXX', 'passXXX'),
'A':('userXXX', 'passXXX'),
}
def doRequest(target, **kw):
Provide a trivial interface for doing remote calls.
Keyword args are passed as query parameters.

url = target_urls[target]
user, passwd = auth_info[target]
proto,host,port=url_re.match(url).groups()
if port:
port = int(port[1:])   # remove the ':' ...
else:
port = 443
creds = base64.encodestring(%s:%s % (user, passwd))
headers = {Authorization: Basic %s % creds }
params = urlencode(kw).strip()
if params:
url = '%s?%s' % (url, params)
body = None # only needed for POST
args =('GET', url, body, headers)
print ARGS: %s % str(args)
conn = HTTPSConnection(host)
conn.request(*args)
response = conn.getresponse()
data = response.read()
if response.status = 300:
print
msg = '%i ERROR reported by remote system %s\n' %
(response.status,
   url)
msg += data
raise IOError, msg
print OK!
return data
if __name__ == '__main__':
print attempting to connect...
result1 = doRequest('A', skey='id', rkey='id')
result2 = doRequest('B', action='updateSkinId',
skinId='406',  facilityId='1466')
print done!
# EOF
So... what 

How to minimize the window

2005-04-12 Thread Austin
I wrote a GUI program with wxPython.
In the window, there are 3 attributes on left top.
_ could let the program to minimize to tool bar.
I want to let the program minimized to the system tray.
Is there any way to let the window have 4 attributes?
.  _  O  x 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Steven Bethard
Uwe Mayer wrote:
Tuesday 12 April 2005 06:36 am Steven Bethard wrote:
Uwe Mayer wrote:
I've been looking into ways of creating singleton objects.
It strikes me that I've never wanted or needed a singleton object.
Would you mind sharing your use case?  I'm just curious.
I am using a class to manage configuration settings in an application. This
object should only existe once so that when the user
changes a setting through a configuration dialog the change imminent in all
locations where access to config settings are needed.
Ahh, I see.  I would typically just use a module in this situation, 
where the configuration settings were just names global to the module. 
Is there a benefit to using a singleton object over using just a module?

STeVe
--
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Reinhold Birkenfeld
Uwe Mayer wrote:
 Tuesday 12 April 2005 06:36 am Steven Bethard wrote:
 Uwe Mayer wrote:
 I've been looking into ways of creating singleton objects.
 
 It strikes me that I've never wanted or needed a singleton object.
 Would you mind sharing your use case?  I'm just curious.
 
 I am using a class to manage configuration settings in an application. This
 object should only existe once so that when the user
 changes a setting through a configuration dialog the change imminent in all
 locations where access to config settings are needed.

In this case, you may want to read

http://www.aleax.it/5ep.html


Grüße
Reinhold
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Michael Kearns
Martin v. Löwis wrote:
For developers that need msvcr71.dll on the target system which don't
have a license to distribute it, the solution is simple: they just need
to advise their users to install python-2.4.1.msi. This comes with
msvcr71.dll included.
I understand this, and it's obviously a solution. Unfortunately it 
defeats the whole point of me 'freezing' my code in the first place.

The main feature (for me) of the way I could use this, was to create a 
simple Java launcher that didn't require the user to install anything 
extra, or end up with a whole stack of unused data on their machine.

They would see a .exe file, a dll and a pyd, and then the actual 
application files, and that was it. It may be fine for a 'knowledgeable' 
user to install python etc., but not for everyone.

Michael.
--
http://mail.python.org/mailman/listinfo/python-list


Re: NSInstaller Vs. Inno Setup

2005-04-12 Thread Stephen Kellett
In message [EMAIL PROTECTED], Martin v. Löwis 
[EMAIL PROTECTED] writes
dcrespo wrote:
Any comments?
MSI.
MSI fails on every NT 4 system I've seen. Even with all the patches from 
Microsoft. Inno Setup wins every time in this situation. Its also a lot 
less hassle than MSI for what I need.

Stephen
--
Stephen Kellett
Object Media Limitedhttp://www.objmedia.demon.co.uk
RSI Information:http://www.objmedia.demon.co.uk/rsi.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Michael Kearns
Do Re Mi chel La Si Do wrote:
Hi !
This DLL come also with MS-JVM engine, who is free.  Therefore...
This is very true (and the .NET suggestion as well). However, why should 
I require an end-user to install MS-JVM or the .NET framework, purely 
for a simple little launcher application ?

The main application it launches is Java, but there's no way it would 
run on the MS-JVM, and .NET just gives a load more technology that we 
don't really need (and is a bigger install than the entire application).

Michael.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Michael Kearns
A.B., Khalid wrote:
Kindly note that the Python source distribution does include project
files for building Python 2.4 with MSVC6. Add to that the fact that
with pyMinGW[1] one can build yet another Windows distribution not
dependent on mscvr71.dll and some of the logic about not upgrading to
Python 2.4, IMHO, just goes away.
An official release of installers for either or both versions would I
think complicate matters: more choices translate to more confusion.
Needless to say that extension authors (for Python 2.4) would then need
to make two binaries for every extension they release for Python 2.4:
one for the mscvr71.dll dependent Python distribution, and another one
for the mscvrt.dll dependent version(s). This I think would hurt Python
and its users.
The solution is to have those that know enough to really need to build
Python on their own according to their requirments. They would then
have to deal with compiling the Python 2.4 extensions themselves, of
course. But this would make things simple and hopefully address the
needs of everyone.
This is all very true, and a fair point of what is achievable. It just 
seems unfortunate that a developer is required to get involved in C 
compilation and looking after all module dependencies, purely to use 
Python in a commercial environment.

I write Java as my main language. It's what I'm paid to do, and I've 
spent the best part of the last 8 years doing so.

Over the last couple of years, I've been toying with Python, and trying 
to find ways to integrate it with my daily routine - I now have a 
complete internal build system written with it, along with several 
utility scripts.

I don't code C. I could probably blag it at a very slow pace, but I'm 
not going to be given time to play with it. We have some C developers, 
but again, no resource allocation will ever be made to compile a 
language that isn't used for the mainstream software we produce.

All I'm trying to do is use python wherever I can without having to 
persuade those in power that it would be a valuable asset (as this would 
probably be a waste of breath in many circumstances), and yet I can't 
(from 2.4 at least) because it requires more time and cost to be allocated.

I would guess from the responses so far that Python 2.4 just isn't used 
within commercially shipping products, or is quietly used by an product 
so as not to incur any legal wrath that might be found. Perhaps it isn't 
quite ready for what I want to achieve. I don't know.

I just know that I am spending the rest of the day migrating back to 2.3 
where I will stay.

Michael.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to minimize the window

2005-04-12 Thread vincent wehren
Austin [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
|I wrote a GUI program with wxPython.
| In the window, there are 3 attributes on left top.
| _ could let the program to minimize to tool bar.
| I want to let the program minimized to the system tray.

You can take look at Main.py in the wx Demo.

Look for class DemoTaskBarIcon(wx.TaskBarIcon) and how it is
used in the wxPythonDemo class.

| Is there any way to let the window have 4 attributes?
| .  _  O  x

Not that I know of.

HTH,
--

Vincent Wehren



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: args attribute of Exception objects

2005-04-12 Thread Sebastien de Menten
Thank you guys for those good advices (and the very interesting
example of AST hacking).

However, this was an example of use for Exception.args. It does not
alleviate my concerns about the fact that the args attribute is poorly
designed for standard Exceptions.
It is as if the Exception design was only made for end users (display
of a string in an interpreter) without thinking about original ways to
use them :-)

Seb
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: variables exist

2005-04-12 Thread Richard Brodie

Brian van den Broek [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 I'm a hobbyist and still learning, but the claim the try/except is
 lousy Python surprise me a bit.

I think it wasn't the use of try/except as such. It's more that
if you're the developer you ought to know whether variables
are defined or not. It might be a sign you're using global
variables more often than would be considered good style in
Python.


-- 
http://mail.python.org/mailman/listinfo/python-list


Python license (2.3)

2005-04-12 Thread Antoon Pardon
I have made a module derived from the Queue module deliverd
with python 2.3. I would like to make this module (called
tube) available for other people. However it is not clear
to me how I can do this in accordance with the python
license.

First of all it seems I have to make a sumary of how
my module differs from the original.

Second it seems I have to include the following in
my code:

  Copyright (c) 2001, 2002 Python Software Foundation;
   All Rights Reserved

Do I understand correctly?

Because I don't mind the first but I'm not so happy
with the second. Are there other things I have to
watch out for?

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Fredrik Lundh
Uwe Mayer wrote:

 It strikes me that I've never wanted or needed a singleton object.
 Would you mind sharing your use case?  I'm just curious.

 I am using a class to manage configuration settings in an application. This
 object should only existe once so that when the user
 changes a setting through a configuration dialog the change imminent in all
 locations where access to config settings are needed.

So use a module-level object, and be done with it.

Or if you're using an application object (you should), just add a config object
to the application object (app.config.param = ...).

Or use a module to hold the configuration data (import config; config.param = 
...);
serializing to and from module variables work really well in Python.

 I was using a factory function bevore, but since I am starting to use Python
 2.4 and I remembered having read about a singleton-decorator I went to look
 deeper into the possibilities.

I'm sure your users would love you even more if you spend that time and
energy adding stuff to the application... ;-)

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to minimize the window

2005-04-12 Thread Steve Holden
Austin wrote:
I wrote a GUI program with wxPython.
In the window, there are 3 attributes on left top.
_ could let the program to minimize to tool bar.
I want to let the program minimized to the system tray.
Is there any way to let the window have 4 attributes?
.  _  O  x 


These features of window behavior are normally handled by the Windows or 
X Window window manager code. Though you can reach behind the interface 
and change them, it might be easier simply to have a Migrate to System 
Tray button inside your system's GUI. This could toggle to Normal 
Iconisation when the window only appeared int he system tray.

Or, you could do what the Windows Task Manager does, and provide both a 
standard icon *and* a system tray icon.

Noticed you seem to be pretty new to c.l.py, so while I have your 
attention: welcome aboard!

regards
 Steve
--
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why does StringIO discard its initial value?

2005-04-12 Thread David Fraser
Raymond Hettinger wrote:
[Leif K-Brooks]
The obvious workaround is to call buffer.write() with the initial value
instead of passing it to StringIO's constructor,

More than just a workaround, it is the preferred approach.
That makes is easier to switch to cStringIO where initialized objects are
read-only.
Others may find this helpful ; it's a pure Python wrapper for cStringIO 
that makes it behave like StringIO in not having initialized objects 
readonly. Would it be an idea to extend cStringIO like this in the 
standard library? It shouldn't lose performance if used like a standard 
cStringIO, but it prevents frustration :-)

David
class StringIO:
def __init__(self, buf = ''):
if not isinstance(buf, (str, unicode)):
buf = str(buf)
self.len = len(buf)
self.buf = cStringIO.StringIO()
self.buf.write(buf)
self.buf.seek(0)
self.pos = 0
self.closed = 0
def __iter__(self):
return self
def next(self):
if self.closed:
raise StopIteration
r = self.readline()
if not r:
raise StopIteration
return r
def close(self):
Free the memory buffer.

if not self.closed:
self.closed = 1
del self.buf, self.pos
def isatty(self):
if self.closed:
raise ValueError, I/O operation on closed file
return False
def seek(self, pos, mode = 0):
if self.closed:
raise ValueError, I/O operation on closed file
self.buf.seek(pos, mode)
self.pos = self.buf.tell()
def tell(self):
if self.closed:
raise ValueError, I/O operation on closed file
return self.pos
def read(self, n = None):
if self.closed:
raise ValueError, I/O operation on closed file
if n == None:
  r = self.buf.read()
else:
  r = self.buf.read(n)
self.pos = self.buf.tell()
return r
def readline(self, length=None):
if self.closed:
raise ValueError, I/O operation on closed file
if length is not None:
r = self.buf.readline(length)
else:
r = self.buf.readline(length)
self.pos = self.buf.tell()
return r
def readlines(self):
if self.closed:
raise ValueError, I/O operation on closed file
lines = self.buf.readlines()
self.pos = self.buf.tell()
return lines
def truncate(self, size=None):
if self.closed:
raise ValueError, I/O operation on closed file
self.buf.truncate(size)
self.pos = self.buf.tell()
self.buf.seek(0, 2)
self.len = self.buf.tell()
self.buf.seek(self.pos)
def write(self, s):
if self.closed:
raise ValueError, I/O operation on closed file
origpos = self.buf.tell()
self.buf.write(s)
self.pos = self.buf.tell()
if origpos + len(s)  self.len:
  self.buf.seek(0, 2)
  self.len = self.buf.tell()
  self.buf.seek(self.pos)
def writelines(self, lines):
if self.closed:
raise ValueError, I/O operation on closed file
self.buf.writelines(lines)
self.pos = self.buf.tell()
self.buf.seek(0, 2)
self.len = self.buf.tell()
self.buf.seek(self.pos)
def flush(self):
if self.closed:
raise ValueError, I/O operation on closed file
self.buf.flush()
def getvalue(self):
if self.closed:
raise ValueError, I/O operation on closed file
return self.buf.getvalue()
--
http://mail.python.org/mailman/listinfo/python-list


Re: Programming Language for Systems Administrator

2005-04-12 Thread Ville Vainio
 Sizer == Sizer  [EMAIL PROTECTED] writes:

Sizer Looking at my followup, I really didn't make it clear that
Sizer you'll have to learn some bash scripting to be an effective
Sizer *nix administrator, just because so many parts of the
Sizer system use bash scripting. But python is much nicer to
Sizer write anything non-trivial in.

If you don't need to edit already existing system scripts, you don't
really need to know bash scripting. For debugging purposes, it's easy
to see what commands the script executes to perform a task.

You just need to know about `backticks` and $ENV_VARS, but that's more
general Unix knowledge than actual shell scripting.

So IMHO learning bash scripting might be a waste of time, and it
should be learnt 'as you go' - i.e. if/when you eventually bump into a
problem where you need to be able to do bash scripting. There's the
'Unix romantic' movement that still thinks shell scripts are a good
idea, but this is my .02EUR to point out that not everyone agrees with
them.

-- 
Ville Vainio   http://tinyurl.com/2prnb
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Robin Becker
Michael Kearns wrote:
.
I would guess from the responses so far that Python 2.4 just isn't used 
within commercially shipping products, or is quietly used by an product 
so as not to incur any legal wrath that might be found. Perhaps it isn't 
quite ready for what I want to achieve. I don't know.

I just know that I am spending the rest of the day migrating back to 2.3 
where I will stay.

The switch to 2.4+msvc7.1 has been a success for MS as many developers now 
require both 6  7 to provide full coverage. Of course this wasn't a pythonic 
choice, but MS certainly encouraged the move by delivering free SDKs to key 
people. It's not really MS's fault; they want to advance and get revenue like 
everyone else; python has to follow or end up on a dying platform.

People have mentioned the older v6 build scripts/tools still work. Last time I 
tried they seemed a bit out of date.

-wondering where my paper tape editor is-ly yrs-
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list


Re: zlib and zipfile module in Python2.4

2005-04-12 Thread Bill Anderson
On Mon, 11 Apr 2005 10:38:37 -0400, Alan Toppen wrote:

 I was unable to use the ZipFile class in the zipfile module in
 Python2.4. I got an error that zlib could not be found. Comparing my
 Python 2.2 installation I noticed Python 2.4 was missing a certain file:
 /usr/lib/python2.2/lib-dynload/zlibmodule.so. Unable to find a more
 elegant solution, I copied the file from my Python 2.2 directory into my
 Python 2.4 directory. When running my Python script it gives a warning:
 
 /usr/local/lib/python2.4/zipfile.py:7: RuntimeWarning: Python C API
 version mismatch for module zlib: This Python has C API version 1012,
 module zlib has version 1011.
   import zlib # We may need its compression method
 
 But it works. Python 2.2 and 2.3 handle zipfiles out of the box. Could a
 file have been omitted from Python 2.4 by accident?

If you built it you should check for the zlib development headers. If they
are not, zlib will not be built.

I recently had this issue and discovered that if zlib headers are not
there, python still builds gzip ... which imports zlib. Seems to me that
since zlib apparently depends on gzip, gzip should only be built if zlib
is.

Cheers,
Bill
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: World First Cancer Immune Booster

2005-04-12 Thread Will McGugan
Health wrote:
Most people with Cancer or AIDS have no immune system left.
We've developed a world first natural immune booster which helps
people fight their disease.
Our totally natural product comes from the fresh Arctic Ocean.
www.protecura.com
Spam rarely offends me, but this is really low. Scamming money out of 
people with potentially fatal illnesses. I hope there's a level of hell 
devoted to spammers like this!

Will McGugan
--
http://www.willmcgugan.com
.join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-84)%26) for c 
in jvyy*jvyyzpthtna^pbz ] )
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Fredrik Lundh
Michael Kearns wrote:

 I would guess from the responses so far that Python 2.4 just isn't used 
 within commercially 
 shipping products

that kind of unfounded hyperbole only makes you look silly.

 I don't know.

exactly.  now calm down, and go read the replies to this thread again.  or 
consult
a lawyer, and make it clear to him that you're not actually *using* the MSVCR71
component yourself, *and* that the Python application you are using (and passing
on to your users) is adding significant and primary functionality to the MSCVR71
library.

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Fredrik Lundh
Martin v. Löwis wrote:

 What happens if I try to install Python2.4 on a system wich doesn't have
 the dll?

 It will just work. Python installs the DLL if it is missing, and leaves
 it alone (just incrementing the refcount) if it is present on the target
 system.

installs it where?  the MS docs seem to indicate that they want you to install
it in the program directory, rather than in a shared location:

http://support.microsoft.com/default.aspx?scid=kb;en-us;326922

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: zlib and zipfile module in Python2.4

2005-04-12 Thread Fredrik Lundh
Bill Anderson wrote:

 I recently had this issue and discovered that if zlib headers are not
 there, python still builds gzip ... which imports zlib. Seems to me that
 since zlib apparently depends on gzip, gzip should only be built if zlib
 is.

gzip is a Python module, and isn't built.

if zlib isn't available, importing gzip gives you an ImportError exception.  if 
you
remove gzip, you still get an ImportError exception.  the only difference is 
that
the former message tells you exactly what module you need to add.

attempting to remove Python modules that may or may not work depending
on what other modules are available or not when you run the Python installation
scripts, in order to make the error message less informative, strikes me as 
some-
what silly.

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: args attribute of Exception objects

2005-04-12 Thread Bengt Richter
On 12 Apr 2005 01:57:31 -0700, [EMAIL PROTECTED] (Sebastien de Menten) wrote:

Thank you guys for those good advices (and the very interesting
example of AST hacking).

However, this was an example of use for Exception.args. It does not
alleviate my concerns about the fact that the args attribute is poorly
designed for standard Exceptions.
It is as if the Exception design was only made for end users (display
of a string in an interpreter) without thinking about original ways to
use them :-)

Look into it some more ;-)

Have you thought of subclassing Exception for your own purpose?
You can override the base exception class's Exception.__init__
which UIAM effectively does

def __init__(self, *args):
self.args = args

and no more. Using an existing special purpose exception like NameError
(IIRC seeing that correctly) to carry info for you is pretty weird ;-)

Here is a subclass that takes what would be e.args[0] and delivers it
instead as e.answer (well, e is retans below ;-)

  class BailingOutWithAnswer(Exception):
 ... def __init__(self, answer):
 ... self.answer = answer
 ...
  for ans in ['string', 123, 4.5, 67L, 8+9j,
 ... type('MyClass',(),{}), type('MyInst',(),{})()]:
 ... try: raise BailingOutWithAnswer(ans)
 ... except BailingOutWithAnswer, retans:
 ... print '%r - retans.answer: %r' %(ans, retans.answer)
 ...
 'string' - retans.answer: 'string'
 123 - retans.answer: 123
 4.5 - retans.answer: 4.5
 67L - retans.answer: 67L
 (8+9j) - retans.answer: (8+9j)
 class '__main__.MyClass' - retans.answer: class '__main__.MyClass'
 __main__.MyInst object at 0x02EF14EC - retans.answer: __main__.MyInst 
object at 0x02EF14EC

It's the easiest thing in the world to define a minimal Exception subclass to 
give you
back in e.args whatever you pass it as args when you raise it. Obviously I 
could have used
a table of arg tuples and just raise XEasy(*argtuples[i]) instead of separating 
them out,
but I wanted to show how plain raise expression syntax with
different numbers of arguments map to e.args.

  class XEasy(Exception): pass
 ...
  for i in xrange(7):
 ... try:
 ... if i==0: raise XEasy(123)
 ... elif i==1: raise XEasy(4.5, 67L)
 ... elif i==2: raise XEasy(*'this may seem tricky ;-)'.split())
 ... elif i==3: raise XEasy, 'usual ordinary message form'
 ... elif i==4: raise XEasy(8+9j, type('AClass',(),{}))
 ... elif i==5: raise XEasy(type('AClass',(),{})(),'=[class instance]')
 ... elif i==6: raise 
XEasy('')
 ... except XEasy, e:
 ... print e.args
 ...
 (123,)
 (4.5, 67L)
 ('this', 'may', 'seem', 'tricky', ';-)')
 ('usual ordinary message form',)
 ((8+9j), class '__main__.AClass')
 (__main__.AClass object at 0x02EF166C, '=[class instance]')
 ('',)

Oops, left out the no-arg raises

  try: raise XEasy
 ... except XEasy, e: print e.args
 ...
 ()
  try: raise XEasy()
 ... except XEasy, e: print e.args
 ...
 ()

Did I misunderstand the problem again?

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Overlapping matches in Regular Expressions

2005-04-12 Thread André Søreng
With the re/sre module included with Python 2.4:
pattern = (?Pid1avi)|(?Pid2avi|mp3)
string2match = some string with avi in it
matches = re.finditer(pattern, string2match)
...
matches[0].groupdict()
{'id2': None, 'id1': 'avi'}
Which was expected since overlapping matches are ignored.
But I would also like to know if other groups had a match.
What modifications to the re/sre module is needed to allow
overlapping matches?
--
http://mail.python.org/mailman/listinfo/python-list


[perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Xah Lee
http://python.org/doc/2.4.1/lib/module-re.html
http://python.org/doc/2.4.1/lib/node114.html

-
QUOTE
The module defines several functions, constants, and an exception. Some
of the functions are simplified versions of the full featured methods
for compiled regular expressions. Most non-trivial applications always
use the compiled form
UNQUOTE


What does a programer who wants to use regex gets out from this piece
of motherfucking irrevalent drivel?

--
QUOTE
compile(
pattern[, flags])

Compile a regular expression pattern into a regular expression  object,
which can be used for matching using its match() and  search() methods,
described below.

The expression's behaviour can be modified by specifying a  flags
value. Values can be any of the following variables,  combined using
bitwise OR (the | operator).
UNQUOTE


What exactly is it fucking saying?

I wanted to use regex to find  replace on text. I've read in a file.
Trying to reading this fucking doc is a pain in the ass. What are these
flags? Do i do

re.compile(r'mypat','M') or
re.compile(r'mypat',M)
or perhaps
re.compile(r'mypat',re.M)

The M isn't a fucking variable. Why does the doc incompetently use that
term?
And what the fuck is it unclearly meant by OR operator with the
mother fucking bitwise jargon?

All a person reading regex really wanted is to see how to use a string
pattern and replace it with another. The fucking doc cannot be possibly
fucking worsely written.

Fuck the mother fucking coders in the IT industry.

So, is
re.compile(r'mypat','M')
re.compile(r'mypat','MULTILINE')
equivalent?

and, by that fucking bitwise shit is it meant to say like
re.compile(r'mypat','M'|'U')
?

why cannot this piece of shit writing give a single example of usage?
and motherfucking confusedly organized, with fucking variable terms the
writer don't fucking understand, and meanwhile always trying to sound
big asshole and don't stop at masturbation by mention a regex book and
not hesitate to mention another language Perl. Fucking morons.

for a exposition of IT's fucking stupid docs and their fuckhead coders,
see:
http://xahlee.org/Periodic_dosage_dir/t2/xlali_skami_cukta.html

a cleaned up account of this post will be appended to the above
exposition.



One final piece of advice here to sober up the fuckheads who are
currently offended and defiant: you want to ask yourself this question:
Can a seasoned programer, who is expert at least 2 languages, who is
also a expert at Perl and knew regex well, and who has also read the
official Python tutorial and has written at least 10 simple python
programs over a span of a month, can such a person, who have not yet
used regex in Python but now wants to use regex in Python and have just
read the doc, must he, resort to many trial and error to see exactly
what the doc is talking about?

But, can this doc be (re-)written effectively and easily so that any
programers needn't do trial'n'error post-reading?

The answer to the questions are resounding yeses, you fucking asses.

paypal me a hundred dollars and i'll rewrite the whole re doc in a few
hours.

Fuck you the standard IT morons. Excuse me for i didn't have time to
write a more coherent and detailed analysis of the stupidities of the
re doc.

 Xah
 [EMAIL PROTECTED]
 http://xahlee.org/PageTwo_dir/more.html 

--
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Uwe Mayer
Tuesday 12 April 2005 10:01 am Steven Bethard wrote:
 I am using a class to manage configuration settings in an application.
 This object should only existe once so that when the user
 changes a setting through a configuration dialog the change imminent in
 all locations where access to config settings are needed.
 
 Ahh, I see.  I would typically just use a module in this situation,
 where the configuration settings were just names global to the module.
 Is there a benefit to using a singleton object over using just a module?

Basically I am using a module. The config file is stored in
$HOME/.app/app.conf where the user can go and edit it. It is a working
python program which globally declares variables.
I cannot simply import this module as it does not lie in the path and I am
not too fond of dynamically cluttering sys.path to my needs. My intend was
to make it look as little complicated as possible (for the user) while
retaining maximum flexibility.

Therefore I wrote a class, subclassing a dict, which executes the config
file and takes up the variables into its namespace. Afterwards I update the
dict with default-values (in case the user kicked some vars out) or
manipulate the read-in config variables, in case the format changed. 

When the application closes the Singleton is written back to the config file
in the user home by using the PrettyPrinter and substituting variables in a
rather longer descriptive text. That way the user always has a nicely
formatted, descriptive configuration file - I thought that was rather
straight forward. :/

Ciao
Uwe 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming Language for Systems Administrator

2005-04-12 Thread Peter Maas
Ville Vainio schrieb:
If you don't need to edit already existing system scripts, you don't
really need to know bash scripting. For debugging purposes, it's easy
to see what commands the script executes to perform a task.
This is only true for trivial bash scripts. I have seen bash scripts
which were quite hard to read especially for beginners.
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Michael Kearns
Fredrik Lundh wrote:
Michael Kearns wrote:

I would guess from the responses so far that Python 2.4 just isn't used within commercially 
shipping products
that kind of unfounded hyperbole only makes you look silly.
As no-one had replied that they had found it fine to use in a commercial 
sense, or pointed to other product that may use it, I'm not entirely 
sure how it makes me look any sillier than I normally do in real life.

I don't know.
exactly.  now calm down, and go read the replies to this thread again.  or 
consult
a lawyer, and make it clear to him that you're not actually *using* the MSVCR71
component yourself, *and* that the Python application you are using (and passing
on to your users) is adding significant and primary functionality to the MSCVR71
library.
I apologise if my writing suggests a lack of calm. I have fully read the 
replies, and although there are many fine suggestions of shipping 
additional products, none seems to address the lack of legality 
regarding the windows distribution other than It's not the Python 
developers problem. Again, if I paraphrased incorrectly, I'm sorry.

As for consulting a lawyer, this is exactly what I'm trying to avoid. My 
usage of python in a commercial sense is as a small utility - a helper, 
if you will. It has no business value whatsoever, compared to the 
product that it ships with, and certainly does not warrant any 
investment regarding legal advice.

I would agree that Python is adding significant value to the library. 
Unfortunately, the Microsoft Redistribution document, from what I read, 
does not allow an end-user to further redistribute the library. I am 
that end-user, of Python.

The whole situation is already becoming far more work than if I'd used a 
different technology for what I had to achieve, and as such I have no 
desire to pursue it further. I'm once more running 2.3, and happy with that.

With respect,
Michael.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Overlapping matches in Regular Expressions

2005-04-12 Thread Fredrik Lundh
André Søreng wrote:

 With the re/sre module included with Python 2.4:

 pattern = (?Pid1avi)|(?Pid2avi|mp3)
 string2match = some string with avi in it
 matches = re.finditer(pattern, string2match)
 ...
 matches[0].groupdict()
 {'id2': None, 'id1': 'avi'}

 Which was expected since overlapping matches are ignored.
 But I would also like to know if other groups had a match.

that's not how regular expressions work: a regular expression describes a
set of strings (the regular set), and the engine can tell you if a given string
belongs to that set.

 What modifications to the re/sre module is needed to allow
 overlapping matches?

if you want overlapping matches, you have to apply the pattern multiple
times.  for trivial cases like your example, it's probably easier to create a
single pattern that matches all interesting cases, and use a dictionary (or
a number of sets) to do the rest.

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming Language for Systems Administrator

2005-04-12 Thread Pierre-Frdric Caillaud
I am confused to chose between C++,Python,Perl.
Writing scripts in C++, you'll just die of brain burn.
	Python has very good shell integration and I heard it can do funky stuff  
with COM/OLE with a few lines of code where you'd need a few pages worth  
of impossible to understand COM code to do the same in C. Also basic shell  
tasks like spawning processes, piping from / to their output, regular  
expressions, parsing files, etc are a breeze. There are modules for INI  
files, csv files, etc.

Perl should be about the same, but you have to like the scary syntax.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Michael Hoffman
I've had enough.
*PLONK*
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


Cannot import mod_python modules

2005-04-12 Thread Mark
Hi, I've just installed the Win32 build of mod_python 3.1.4 for Python
2.4 and have setup my Apache config file with the LoadModule and
PythonHandler directives and then copied mod_python.so to my Apache
modules directory.

I restarted Apache and decided to do a quick cgi.test() and it shows
that mod_python listed under server software section.

OK, next I tried mptest.py, but I get an Internal Server Error. The
traceback recorded in the error log says No module named _apache

mptest.py:

from mod_python import apache

def handler(req):
req.write(Hello World!)
return apache.OK

Why doesn't this work? or rather what have I missed?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: THE GREATEST NEWS EVER ! °º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°` (newsgroup

2005-04-12 Thread sheltech

Soy Bomb [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 The Holy Bible descibes Hell as a place of
 eternal torment, suffering, pain and agony
 for all those who have rejected Jesus Christ. 

 Sounds like the USA 2005.


and what's worse is that it smells like teen spirit .
a generation of kids growing up being taught  superstition instead of
science,
in this day and age ? . sanctioned by otherwise presumably intelligent,
educated people holding public office ?. unfreaking believable, in this
day and age . what  *^$*$ planet did I wake up on ?. I'm all for  us
exploring
our spiritual nature , but  everything in it's place , and  some things are
just
so obviously metaphorical , allegorical, or just plain storytelling , that
it's
stupid to take them literally .  f#kin freaks  (^:#  




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.4 killing commercial Windows Python development ?

2005-04-12 Thread Fredrik Lundh
Michael Kearns wrote:

 As for consulting a lawyer, this is exactly what I'm trying to avoid. My 
 usage of python in a 
 commercial sense is as a small utility - a helper, if you will. It has no 
 business value 
 whatsoever, compared to the product that it ships with, and certainly does 
 not warrant any 
 investment regarding legal advice.

without consulting a lawyer, how come you're so sure that the MS C support
library is the only component you're using that may cause you legal problems?

 Unfortunately, the Microsoft Redistribution document, from what I read, does 
 not allow an end-user 
 to further redistribute the library.

the REDIST document doesn't say anything like that, and neither does the
EULA (at least not the copies I have in my properly licensed VS Enterprise
installation).

all it says is that when the Python developers (you in the EULA) redistributes
the redistributable component as part of a Python distribution (the licensee 
soft-
ware in the EULA), the developers must respect the original EULA wrt. this
component.  And when someone using Python is redistributing Python, that third
part (your distributors in the EULA) must also respect the original EULA wrt.
this component.

(see section 3.1a in the EULA, and make sure you understand what the words
you, licensee software, redistributables and distributors mean in that 
text)

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Joe Smith
Xah Lee wrote:
of motherf***ing irrevalent drivel?
I am greatly amused.
A troll impersonating Xah Lee has made xah look like a total moron.
LOL
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2005-04-12 03:25:33 -0700:
 QUOTE
 compile(
 pattern[, flags])
 
 Compile a regular expression pattern into a regular expression  object,
 which can be used for matching using its match() and  search() methods,
 described below.
 
 The expression's behaviour can be modified by specifying a  flags
 value. Values can be any of the following variables,  combined using
 bitwise OR (the | operator).
 UNQUOTE

 And what the fuck is it unclearly meant by OR operator with the
 mother fucking bitwise jargon?

bitwise OR (the | operator): it doesn't speak about an OR
operator, does it?

 for a exposition of IT's fucking stupid docs and their fuckhead coders,
 see:
 http://xahlee.org/Periodic_dosage_dir/t2/xlali_skami_cukta.html

Interesting reading, I might send you a few of my pet peeves for
inclusion.

 you want to ask yourself this question:
 Can a seasoned programer, who is expert at least 2 languages, who is
 also a expert at Perl and knew regex well, and have just read the doc,
 must he, resort to many trial and error to see exactly what the doc is
 talking about?

While I understand your frustration (I curse the same when I try to
use the Python documentation), you are spoiling your message by
the (IMNSHO well granted, but still) unhelpful profanity.

Unfortunately, the python community seems to bathe in the
misorganized half-documentation, see e. g.
http://marc.theaimsgroup.com/?l=python-listm=111303919606261w=2
especially the reply that (as I read it) suggested reverse
engineering as a viable alternative to documentation.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: THE GREATEST NEWS EVER ! °º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°`°º·...·°` (newsgroup

2005-04-12 Thread beelzabubba
sheltech [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 

 
 Soy Bomb [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 The Holy Bible descibes Hell as a place of
 eternal torment, suffering, pain and agony
 for all those who have rejected Jesus Christ. 

 Sounds like the USA 2005.

 
 and what's worse is that it smells like teen spirit .
 a generation of kids growing up being taught  superstition instead of
 science,
 in this day and age ? . sanctioned by otherwise presumably
 intelligent, educated people holding public office ?. unfreaking
 believable, in this day and age . what  *^$*$ planet did I wake up on
 ?. I'm all for  us exploring
 our spiritual nature , but  everything in it's place , and  some
 things are just
 so obviously metaphorical , allegorical, or just plain storytelling ,
 that it's
 stupid to take them literally .  f#kin freaks  (^:#  
 
 
 
 
 

Jesus loves you sheltech.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Richie Hindle

[Xah]
 motherfucking ... fucking ... fucking ... fucking ... fuck ... fucking
 fucking ... fucking ... mother fucking ... fucking ... piece of shit ...
 motherfucking ... fucking ... fucking ... big asshole ... masturbation ...
 Fucking morons ... fucking stupid ... fuckhead coders ... fuckheads ...
 you fucking asses.

 paypal me a hundred dollars and i'll rewrite the whole re doc in a few
 hours.

Can we paypal you a hundred dollars to leave us alone?  I'll pledge $10.
Are there another nine people here who'll do the same?

-- 
Richie Hindle
[EMAIL PROTECTED]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Bengt Richter
On 12 Apr 2005 03:09:48 -0700, Michele Simionato [EMAIL PROTECTED] wrote:

Steven Bethard:
 It strikes me that I've never wanted or needed a singleton object.
 Would you mind sharing your use case?  I'm just curious.

Singleton is the most idiotic pattern ever. If you want an instance,
just
instantiate your class once. If a class should have only one instance,
you can just document it. What I find usuful is memoize, which
contains Singleton as a special case. So I use memoize even
for singleton would-be, i.e. logfiles and databases connections
(memoizing the connections, if I try to open a database twice with the
same parameters, I am returned an instance of the already opened
database).


For most user application purposes, I agree,
just use a single instance like a responsible adult ;-)

But isn't bool supposed to be a singleton class/type ?

  [bool(x) for x in 0, 0.0, [], {}, False]
 [False, False, False, False, False]
  [id(bool(x)) for x in 0, 0.0, [], {}, False]
 [505014288, 505014288, 505014288, 505014288, 505014288]

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Uwe Mayer
Tuesday 12 April 2005 12:09 pm Michele Simionato wrote:

 Steven Bethard:
 It strikes me that I've never wanted or needed a singleton object.
 Would you mind sharing your use case?  I'm just curious.
 
 Singleton is the most idiotic pattern ever. If you want an instance,
 just
 instantiate your class once. If a class should have only one instance,
 you can just document it. What I find usuful is memoize, which
 contains Singleton as a special case. So I use memoize even
 for singleton would-be, i.e. logfiles and databases connections
 (memoizing the connections, if I try to open a database twice with the
 same parameters, I am returned an instance of the already opened
 database).

Singleton is simple (like the wheel), but that does not make it stupid.
There are two aspects that are important:

1. a Singleton has one, very simple property and virtually everyone knows
what you talk about when you explain that you used a Singleton. In this
case its just a technical term. We need technical terms.

2. the property of a Singleton, i.e. there is only one, is important - you
use it yourself through memoize. That is just a more flexible
implementation of having one instance of whatever you memoize.

Using @memoize on the __new__ method works very well and is flexible enough
to be used with any function call. Thanks for the tip.

Ciao
Uwe 
-- 
http://mail.python.org/mailman/listinfo/python-list


./pyconfig.h?

2005-04-12 Thread Magnus Lie Hetland
It seems that in my Solaris installation,
sysconfig.get_config_h_filename() returns './pyconfig.h', which is, of
course, in most cases just wrong... :)

Shouldn't this return an absolute path (in all cases)? I've use an
absolute path in the --prefix of ./configure -- but I guess I was
standing in that very directory when compiling; maybe there's some
mix-up there?

-- 
Magnus Lie HetlandFall seven times, stand up eight
http://hetland.org  [Japanese proverb]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: workaround for generating gui tools

2005-04-12 Thread Diez B. Roggisch
Hi,

 So, instead, with this new system (note I wasn't involved with the old
 system), I do everything with metadata. (Credit where credit is due, the
 other programmer was starting to do some of this, though he couldn't quite
 take it down to the interface and there are some things I had to add
 later.) Every thing (class) has a description of what it's made out of,
 and what type each of those things are. When I go to edit an instance, the
 Javascript pulls down that description, and a description of the instance
 (and all of its associated sub-instances), and instead *generates* a form
 to edit the object based on what it is made of.

Ok. I can assure you that I've been doing that myself, and that this
attitude describes my general approach to computers and programming: If the
machine can be told to do tedious work for me, I'd rather tell her how to
do it than do that work myself for the thousands time. I did this for a
LDAP browser/editor once, nice thing. But - there is a big BUT here - if
we're talking about GUIs, we inevitably enter the realm of taste and
customization requirements. And that's the point where things get tricky:
technically inclined people can be easily satisfied with simple and pureley
functional interfaces. But even I as a strong FFF (form follows function)
believer have to say: The form _does_ matter, once the function is in
place. In my more complicated qt forms, I had to invest quite an amount of
time to rearrange my controls in a way that (hopefully) communicated the
purpose of the whole thing. These days the rollout will come and certainly
some feedback will tell me that I still didn't do a perfect or even good
job. But then I'll fire up my designer, and can rearrange things - without
further bothering in the code.

To me the importent lesson to learn is not to mingle layout with logic. And
as layout follows its own rules (that techies sometimes have difficulties
to grasp), one should be as flexible and powerful with layouting tools as
it gets.

 How do I decide the order to create the fields? Classes carry a metadata
 field called order that lists the fields it wants in order, the
 remainder will by default be tacked on the end. What if I don't want a
 certain field to display? There's a metadata field that lists the ones we
 want to display for editing, there's another I can use to just filter a
 couple out if the first isn't present. What if I want a particular widget
 to do something special like be a certain width? I've created a metadata
 escape hatch that lets me pass parameters directly to the input node;
 it's bad style, but sometimes useful. Everything I use is backed by a
 database which has limited typing abilities, so I have a field called
 humantype that declares the human type of the data, so I can then create
 intelligent widgets for that, too. One of the things we can do, for
 instance, is create an image widget that specifies a URL for an image,
 and as validation, shows it there in the browser. We could also make it
 accept uploads. Then, just by labelling a field as an htmlImage, we get
 the image editor, no form redesign, no muss, no fuss.

I'm not convinced that this is really a superiour way to go. I'm all with
you in terms of form-validation, constraint checking and mapping to the
persistence layer. I do all of this based on meta-information (or
reflection, which is the same). But what you propose is that you create a
style-annotation which in the end will grow until it becomes a unmanagable
beast. Instead, I prefer to have the designer (this time the person doing
the html templates, not the tool) make the decision if a text-property of
my object becomes a simple input type='text' or a textarea - to me,
both just contain and propagate strings.

So I say: Use html (or qt xml gui description files) for what they are, and
programming for the rest.

Having said that, I can only emphasize again that I'm very well in favour of
automation of tasks - and where my data-types have an inherant flexibility,
I certainly prefer to generate editing forms (as e.g. zope does for
zclasses) instead of having to write them on my on. But usually
customization will be required, and then I'll have to deliver it.


-- 
Regards,

Diez B. Roggisch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolons

2005-04-12 Thread Pierre-Frdric Caillaud
sometimes i'll write
if( key in myarray ) { ...
	in PHP and then realize I have to use array_key_exists and curse that the  
parameters are key then array, and bless scite auto-api-display for saving  
me each time...
--
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Fredrik Lundh
Bengt Richter wrote:

 But isn't bool supposed to be a singleton class/type ?

  [bool(x) for x in 0, 0.0, [], {}, False]
 [False, False, False, False, False]
  [id(bool(x)) for x in 0, 0.0, [], {}, False]
 [505014288, 505014288, 505014288, 505014288, 505014288]

False is an ordinary global object, not an object factory or a singleton 
class.

/F 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IPython - problem with using US international keyboard input scheme on W2K

2005-04-12 Thread Claudio Grondi
Considering what I found in the ipython mailing archives
and the fact, that after the fix with displaying colors on
bright backgrounds Gary had no time yet to get in touch
with me about the code I have sent him, I suppose, that
there will be no new releases addressing this problem
soon, right?

Claudio
lazy at the moment, because instead of trying to fix it just
switched back to Idle ...

Ville Vainio [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
  Claudio == Claudio Grondi [EMAIL PROTECTED] writes:

 Claudio Is it already known, that after switching the keyboard
 Claudio input scheme on German Windows 2000 to english USA
 Claudio International IPython generates \x00 instead of  when
 Claudio trying to input quotation marks?

 This has been reported previously - apparently it's a problem with
 Gary's readline module (or however it was called ;-), and hacking it
 solved the problem for someone. I suggest you search the ipython
 mailing list archives, or post this question there.

 -- 
 Ville Vainio   http://tinyurl.com/2prnb


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Diez B. Roggisch
 Can we paypal you a hundred dollars to leave us alone?  I'll pledge $10.
 Are there another nine people here who'll do the same?

Me, me. I'm good for ten, too. The current euro-dollar exchange course makes
that the price of a normal size McDonalds Menu - so sparing that makes me
healthier both mentally and physically. Great deal.
-- 
Regards,

Diez B. Roggisch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming Language for Systems Administrator

2005-04-12 Thread beliavsky
Ville Vainio wrote:

 If you don't need to edit already existing system scripts, you don't
 really need to know bash scripting. For debugging purposes, it's easy
 to see what commands the script executes to perform a task.

 You just need to know about `backticks` and $ENV_VARS, but that's
more
 general Unix knowledge than actual shell scripting.

 So IMHO learning bash scripting might be a waste of time, and it
 should be learnt 'as you go' - i.e. if/when you eventually bump into
a
 problem where you need to be able to do bash scripting. There's the
 'Unix romantic' movement that still thinks shell scripts are a good
 idea, but this is my .02EUR to point out that not everyone agrees
with
 them.

The simplest script is just a set of commands one could run from the
command line. One step above is learning how to pass arguments (for
cmd.exe in Windows, they are just %1, %2, etc.) and set variables. I
think every computer user, not just system administrators, show know
this much about the shell language of his OS, regardless of whether
it's Windows, Unix, or something else. On Windows I often see people
mousing around instead of getting things done faster from the command
line.

I actually like the Windows cmd language (it's an acquired taste), but
I have read it is going away in Windows Longhorn (WH). That's an
argument for writing more complicated scripts in Python. WH is supposed
to get a much better shell, called Monad, inspired by the philosophy of
Gottfried Wilhelm Leibniz :).

Between a low-level shell scripting language and a higher-level
language like Python, and intermediate level language such as Rexx
could be considered. Many IBM people swear by it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Pokerface

Gotta say, is we let this man write the docs for us, they'll sure as
sugar be more colorful than the ones we presently have, even if he
doesn't manage to make them better.

The [insert relation]ing Python interpreter is usually installed
as /usr/local/bin/python on those g*dd*mn machines where it is
available; putting /usr/local/bin in your ing Unix shell's search
path makes it possible to start it by typing the command python to the
shell.  F***er.


-- 
Pokerface:: Posted from Tactical Gamer - http://www.TacticalGamer.com ::

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: some sort of permutations...

2005-04-12 Thread Bill Mill
On Apr 12, 2005 2:37 AM, Fredrik Lundh [EMAIL PROTECTED] wrote:
 Bernard A. wrote:
 
  i'm looking for a way to have all possible length fixed n-uples from a
  list, i think generators can help, but was not able to do it myself,
  maybe some one could point me out to an idea to do it ?
 
 did you try googling for python permutations ?
 
 here's the first hit:
 
 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
 

I've used that recipe a significant amount, and I feel like its
recursion really slows it down (but I haven't been profiled it). Does
anyone know of a non-recursive algorithm to do the same thing?

And, while I'm asking that question, is there a good reference for
finding such algorithms? Do most people keep an algorithms book handy?

Peace
Bill Mill
bill.mill at gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can't Stop Process On Windows

2005-04-12 Thread Dave Brueck
Dan wrote:
I have a python script running under Windows XP that I need to
terminate from the keyboard.  A control-c works fine under Linux, but
not under Windows.  I'm pretty sure that the culprit is 'select' that
I'm using to multiplex socket i/o, which seems to be blocking the
keyboard interrupt.  Is there some way around this?
Are you calling select with a long timeout? An alternative would be to call 
select with a much shorter timeout, but call it multiple times from a loop.
--
http://mail.python.org/mailman/listinfo/python-list


Re: database in python ?

2005-04-12 Thread Uwe Grauer
Pierre-Frédéric Caillaud wrote:
 
 MySQL is an excellent option is very well documented.  It is also a
 defacto standard for OpenSource databases.
 
 
 MySQL sucks for anything but very very basic stuff as it supports
 no  transactions, foreign keys, procedures, triggers, concurrency, etc.
 Postgresql is a lot better, free, and the psycopg adapter for
 Postgres is  *very very* fast (a lot faster than the MySQL one) and it
 has a  dictfetchall() method which is worth its weight in donuts !

Yes, Postgresql is a lot better than MySQL but take a look at Firebird
to see how easy a full featured db-System could be.
Use kinterbasdb from Sourceforge to get Firebird into Python.

Uwe
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python license (2.3)

2005-04-12 Thread Steve Holden
Antoon Pardon wrote:
I have made a module derived from the Queue module deliverd
with python 2.3. I would like to make this module (called
tube) available for other people. However it is not clear
to me how I can do this in accordance with the python
license.
First of all it seems I have to make a sumary of how
my module differs from the original.
That would seem to apply primarily because this is a derivative product 
of a Python distribution. Therefore, your description could be limited 
to removed the rest of the distribution followed by specific details 
of your changes making Queue into tube.

Second it seems I have to include the following in
my code:
  Copyright (c) 2001, 2002 Python Software Foundation;
   All Rights Reserved
Do I understand correctly?
I believe so.
Because I don't mind the first but I'm not so happy
with the second. Are there other things I have to
watch out for?
Since the PSF copyrighted the original work from which you are deriving, 
you have already agreed to do this in any distributed derived work:

  http://www.python.org/2.3/license.html
clearly says provided, however, that PSF's License Agreement and 
PSF's notice of copyright, i.e., Copyright (c) 2001, 2002, 2003 Python 
Software Foundation; All Rights Reserved are retained in Python 2.3 
alone or in any derivative version prepared by Licensee.

Should we wait until you publish tube and then remove *your* attribution 
to claim the code as our own?

regards
 Steve
--
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: IPython - problem with using US international keyboard input scheme on W2K

2005-04-12 Thread Ville Vainio
 Claudio == Claudio Grondi [EMAIL PROTECTED] writes:

Claudio Considering what I found in the ipython mailing archives
Claudio and the fact, that after the fix with displaying colors
Claudio on bright backgrounds Gary had no time yet to get in
Claudio touch with me about the code I have sent him, I suppose,
Claudio that there will be no new releases addressing this
Claudio problem soon, right?

No idea. There have been multiple complaints about the issue (and
functional patches to fix the problem), so I wouldn't be surprised if
this issue was solved quickly enough.

Claudio lazy at the moment, because instead of trying to fix it
Claudio just switched back to Idle ...

Don't get too lazy, you're not alone with this problem. I get a beep
every time I try to type a scandinavian character () on ipython
console, luckily I never have to do that :-).

-- 
Ville Vainio   http://tinyurl.com/2prnb
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cannot import mod_python modules

2005-04-12 Thread Steve Holden
Mark wrote:
Hi, I've just installed the Win32 build of mod_python 3.1.4 for Python
2.4 and have setup my Apache config file with the LoadModule and
PythonHandler directives and then copied mod_python.so to my Apache
modules directory.
I restarted Apache and decided to do a quick cgi.test() and it shows
that mod_python listed under server software section.
OK, next I tried mptest.py, but I get an Internal Server Error. The
traceback recorded in the error log says No module named _apache
mptest.py:
from mod_python import apache
def handler(req):
req.write(Hello World!)
return apache.OK
Why doesn't this work? or rather what have I missed?
Usually this is a permissions issue, often because you installed 
mod_python as a non-administrator.

regards
 Steve
--
Steve Holden+1 703 861 4237  +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread rbt
Xah Lee wrote:
What does a programer who wants to use regex gets out from this piece
of motherf**king irrevalent drivel?
Any resume that ever crosses my desk that includes 'Xah Lee' anywhere in 
the name will be automatically trashed.
--
http://mail.python.org/mailman/listinfo/python-list


Tkinter withdraw and askstring problem

2005-04-12 Thread Miki Tebeka
Hello All,

The following script hangs on win32 system:

from Tkinter import *
from tkSimpleDialog import askstring

root = Tk()
root.withdraw() #  Problem here
askstring(Yap, What's up?)

If I remove the problematic withdraw line the script works but there is
another Tk window at the back.

Any way to solve the problem?

Thanks.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys


pgpfX5LvFsR5i.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Programming Language for Systems Administrator

2005-04-12 Thread Kanthi Kiran Narisetti
Hi All,

Thank You for your suggestionsI request you all to eloborate the
Uses(In Practical) for systems administrator.Some of my questions
regarding the same follows.

1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.

2)Which is best opensource database to be used with Python ?

3)When i write a remote execution script in python is it required that
python should be installed in remote system.

4)I heard about Perl/CGI and that CGI application done by python
too.Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating.

Sorry if these questions are out of this group , but answers to these ?
will help me a lot.

Thanks in Advance

Kanthi.

-- 
http://mail.python.org/mailman/listinfo/python-list


os.open() i flaga lock

2005-04-12 Thread JZ
Szukam jakiego odpowiednika fcntl na win32. W manualu napisali e
os.open() z odpowiedni flag jest bardziej uniwersalne od fcntl. Niestety
zero informacji na temat tej flagi oraz brak jakiegokolwiek przykadu... :(

--
JZ
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Bengt Richter
On Tue, 12 Apr 2005 13:26:54 +0200, Fredrik Lundh [EMAIL PROTECTED] wrote:

Bengt Richter wrote:

 But isn't bool supposed to be a singleton class/type ?

  [bool(x) for x in 0, 0.0, [], {}, False]
 [False, False, False, False, False]
  [id(bool(x)) for x in 0, 0.0, [], {}, False]
 [505014288, 505014288, 505014288, 505014288, 505014288]

False is an ordinary global object, not an object factory or a singleton 
class.

UIAM, False is a string, or a representation of a string ;-)
And the name False is typically found as  __builtins__.False  unless you
have shadowed it locally or in some module globals, as I'm sure you know.

I was just demonstrating that all the bool(x) _instances_ are the identical
False object in the above, and duck-wise that quacks singleton-like,
even though the True maybe makes it a dualton, since bool does return two 
distinct instances ;-)

IMO the global False name accessibility is a red herring, since it's the object 
it is
normally bound to that is the real subject.

  __builtins__.False is bool(0)
 True

UIAM, the True and False objects per se are unique and built into boolobject.c
And you can bind all the names you like to them, but bool(0) is always that 
single
unique object and so is bool(1) its unique object. I don't believe this is an
optimization like that involving the first 100 integer values or so.

It's a weird beast, being a subtype of int also. I'll defer to the BDFL in
http://www.python.org/peps/pep-0285.html


The values False and True will be singletons, like None.  Because
the type has two values, perhaps these should be called
doubletons?  The real implementation will not allow other
instances of bool to be created.


Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.open() i flaga lock

2005-04-12 Thread JZ
Dnia Tue, 12 Apr 2005 15:14:25 +0200, JZ napisa(a):

 Szukam jakiego odpowiednika fcntl na win32. W manualu napisali e
 os.open() z odpowiedni flag jest bardziej uniwersalne od fcntl. Niestety
 zero informacji na temat tej flagi oraz brak jakiegokolwiek przykadu... :(

Sorry, I wanted to send to another group. because I cannot remove the post,
I provide simple translation:

I am looking for function similar ro fcnt but for win32. I've found brief
info in manual about os.open() which should work with specific flag value.
But I cannot find any info abotu that flag and no examples at all. :(

--
JZ
-- 
http://mail.python.org/mailman/listinfo/python-list


BayPIGgies REMINDER: April 14, 7:30pm (FIRST meeting at IronPort)

2005-04-12 Thread Aahz
NOTE: we are no longer meeting at Stanford; the April meeting is at
IronPort in San Bruno


The next meeting of BayPIGgies will be Thurs, April 14 at 7:30pm.

Guido van Rossum (and any other BayPIGgies who wish to contribute) will
review the activities at PyCon 2005.

BayPIGgies meetings alternate between IronPort (San Bruno, California)
and Google (Mountain View, California).  For more information and
directions, see http://www.baypiggies.net/


Before the meeting, we may meet at 6pm for dinner.  Discussion of dinner
plans is handled on the BayPIGgies mailing list.


Advance notice: The May 12 meeting agenda has not been set.  Please send
e-mail to [EMAIL PROTECTED] if you want to suggest an agenda (or
volunteer to give a presentation).
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death.  --GvR
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python license (2.3)

2005-04-12 Thread Antoon Pardon
Op 2005-04-12, Steve Holden schreef [EMAIL PROTECTED]:
 Antoon Pardon wrote:
 I have made a module derived from the Queue module deliverd
 with python 2.3. I would like to make this module (called
 tube) available for other people. However it is not clear
 to me how I can do this in accordance with the python
 license.
 
 First of all it seems I have to make a sumary of how
 my module differs from the original.
 
 That would seem to apply primarily because this is a derivative product 
 of a Python distribution. Therefore, your description could be limited 
 to removed the rest of the distribution followed by specific details 
 of your changes making Queue into tube.

 Second it seems I have to include the following in
 my code:
 
   Copyright (c) 2001, 2002 Python Software Foundation;
All Rights Reserved
 
 Do I understand correctly?
 
 I believe so.

 Because I don't mind the first but I'm not so happy
 with the second. Are there other things I have to
 watch out for?
 
 Since the PSF copyrighted the original work from which you are deriving, 
 you have already agreed to do this in any distributed derived work:

http://www.python.org/2.3/license.html

 clearly says provided, however, that PSF's License Agreement and 
 PSF's notice of copyright, i.e., Copyright (c) 2001, 2002, 2003 Python 
 Software Foundation; All Rights Reserved are retained in Python 2.3 
 alone or in any derivative version prepared by Licensee.

 Should we wait until you publish tube and then remove *your* attribution 
 to claim the code as our own?

Oh I see, I just have to include that attribution, next to my own.
I somehow got the idea that I had to hand over my copyright to
the Python Software Foundation.

What licence can I use? Somewhere they say you can combine python
code with GPL code. Does that mean that the resulting code has
to have both the GPL license as the PSF license, as both seem
to want that derived work uses the same license.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python license (2.3)

2005-04-12 Thread R. C. James Harlow
On Tuesday 12 April 2005 09:51, Antoon Pardon wrote:
 It seems I have to include the following in
 my code:

   Copyright (c) 2001, 2002 Python Software Foundation;
All Rights Reserved

 Do I understand correctly?

You are of course allowed to *add* your own copyright statement:

Copyright (c) 2001, 2002 Python Software Foundation;
All Rights Reserved
Copyright (c) 2005 Antoon Pardon;
All Rights Reserved


pgpzG0ivpEZo9.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: some sort of permutations...

2005-04-12 Thread Scott David Daniels
Bill Mill wrote:
On Apr 12, 2005 2:37 AM, Fredrik Lundh [EMAIL PROTECTED] wrote:
Bernard A. wrote:
i'm looking ... to have all possible length fixed n-uples from a list...
... http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
And, while I'm asking that question, is there a good reference for
finding such algorithms? Do most people keep an algorithms book handy?
Volume 4 of Knuth's TAOCP (The Art of Computer Programming) is about
combinatorics.  Fascicle 2 is out and relevant.  Admittedly buying
fascicles is a bit like buying a long chapter at a time, but it is
chock-a-block with great stuff. I paid about twenty bucks a fascicle.
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Michele Simionato
Uwe Mayer wrote:
 Singleton is simple (like the wheel), but that does not make it
stupid.
 There are two aspects that are important:

 1. a Singleton has one, very simple property and virtually everyone
knows
 what you talk about when you explain that you used a Singleton. In
this
 case its just a technical term. We need technical terms.

No. Not everybody knows about Singleton. It is an acquired knowledge.
The reason why I am so opposed to Singletons is that a while ago I was
in the condition of not knowing what a Singleton was. However,
everybody
was talking about Singletons, posting recipes of how to implement them
in
Python, etc. So I figured out it was a very important concept and that
I was missing something, since I was incapable of understand its
relevance.
It was only after many months that I understood that there was really
nothing
more to it. I am the kind of person that can learn easily even very
hard
concept, if I can see and use/interest for them. However, I find
extremely
difficult to learn even simple concepts if they do not make sense for
me.
Singleton did not make sense for me since I did not have an use case
for
it. Now, I have some use case for it, but still I think these use cases
are much better managed by memoize. BTW, when I first heard about
memoize,
I understood it instantenously, since I had tons of cases where I had
implemented it in my own code without knowing the technique was called
memoize.

There is so much to know. I don't want to waste my time with concepts
that
are not worth it. IMO, Singleton is not worth the fuss, and we would
be better off without a fancy name for it (just tell what it is: a
class returning always the same instance). Let us reserve fancy names
to
worthy concepts.

In my lectures at Oxford next week I have carefully expunged anything
referring to Singletons ;)

 2. the property of a Singleton, i.e. there is only one, is important
- you
 use it yourself through memoize. That is just a more flexible
 implementation of having one instance of whatever you memoize.

IMNSHO, the property there is only one is not important enough to
deserves
a name. The property if you have already called this callable with the
same arguments you don't need to recompute it instead is quite worthy
and subsumes the other concept as a special case. It also gives you
plenty of use case to illustrate it, even to beginner programmers.


 Michele Simionato

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: some sort of permutations...

2005-04-12 Thread Jack Diederich
On Tue, Apr 12, 2005 at 08:41:15AM -0400, Bill Mill wrote:
 On Apr 12, 2005 2:37 AM, Fredrik Lundh [EMAIL PROTECTED] wrote:
  Bernard A. wrote:
  
   i'm looking for a way to have all possible length fixed n-uples from a
   list, i think generators can help, but was not able to do it myself,
   maybe some one could point me out to an idea to do it ?
  
  did you try googling for python permutations ?
  
  here's the first hit:
  
  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
  
 
 I've used that recipe a significant amount, and I feel like its
 recursion really slows it down (but I haven't been profiled it). Does
 anyone know of a non-recursive algorithm to do the same thing?

If you need the speed probstat.sf.net has permutations, combinations,
and cartesian products written in C.  I'm the author and I use pure-python
versions when I know I'm just doing small lists (to avoid a dependency).

From your original problem it looks like you want a combination, not
a permutation.  Combinations don't care about order (just unique sets).

 import probstat
 for (item) in probstat.Combination([0,1,2,3,4], 3):
...   print item
... 
[0, 1, 2]
[0, 1, 3]
[0, 1, 4]
[0, 2, 3]
[0, 2, 4]
[0, 3, 4]
[1, 2, 3]
[1, 2, 4]
[1, 3, 4]
[2, 3, 4]

-jackdied
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming Language for Systems Administrator

2005-04-12 Thread Gerald Klix

Kanthi Kiran Narisetti schrieb:
Hi All,
Thank You for your suggestionsI request you all to eloborate the
Uses(In Practical) for systems administrator.Some of my questions
regarding the same follows.
1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.
Yes, you can.
There are far too many options, to be listed here:
Here are just 3 pointers:
http://www.zope.org/
http://www.cherrypy.org/
http://www.webwareforpython.org/
http://skunkweb.sourceforge.net/
2)Which is best opensource database to be used with Python ?
It's hard to say. It depends on our taste and the type of your application.
There is a python standard for a relation DB-API
and there are som object relational adapters, like:
http://python-dbo.sourceforge.net/
http://sqlobject.org/
http://skunkweb.sourceforge.net/PyDO/
http://dustman.net/andy/python/SQLDict
And, of course, there is ZODB the object oriented DB below Zope:
http://www.zope.org/Products/ZODB3.3

3)When i write a remote execution script in python is it required that
python should be installed in remote system.
No.
Using xmlrpc the server and may be written in any programming language.
xmlrpc is include din the standard libray.
Other remote execution systems use CORBA or do things upon their own:
http://pyro.sourceforge.net/
It is also possible to package python applications in an executable using:
http://starship.python.net/crew/theller/py2exe/
http://starship.python.net/crew/atuining/cx_Freeze/
or the Freeze utility delivered with the python standard distribution.
4)I heard about Perl/CGI and that CGI application done by python
too.Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating.
No it's rather slow, but widley used. There is a mod_python for Apache
which is used be some of the web application frameworks mentioned above.
Sorry if these questions are out of this group , but answers to these ?
will help me a lot.
The are perfectly valid.
HTH,
Gerald
--
GPG-Key: http://keyserver.veridis.com:11371/search?q=0xA140D634
--
http://mail.python.org/mailman/listinfo/python-list


printing with wxPython

2005-04-12 Thread Fabio Pliger
Hi!
I'm using wxPython to handle my application gui.. So,  I have a notebook
widget and i have to print the object inside it's tab ... Maybe doing a
preview before printing... I know that wx has many objects to handle
printing.. i've tryied to use them, but i wasn't able to... Any hint? By
now, i solved the problem saving a screenshot if the screen in an image(bmp)
and then sending it to printer... (a print preview would be cool...)
tnx
F.P.





-- 
http://mail.python.org/mailman/listinfo/python-list


Why won't someone step up and make use of the Free tools (was Re: Python 2.4 killing commercial Windows Python development ?)

2005-04-12 Thread Jeff Epler
I'm sorry that this is going to come out sounding like a flame, but it
seems to me that there today only a few technical problems remaining
with Python when built with mingw32.

If one of the people who has expressed such deep concern about this
msvcr71.dll problem would simply install the Free tools and start
putting patches on sourceforge, it's quite possible that for the next
2.4.x release the mingw32 port could be a first-rate one, and suitable
for the uses that the posters in this thread have mentioned.

Since mingw32 is Free (gpl and other licenses for tools, public domain
libraries and copyrighted headers with no restrictions for programs
built using the headers) anyone can install and use these tools and
mingw creates no new problems with distribution of the resulting binary,
whether the final product is Free or proprietary.

(Admittedly I don't know anything about whether win32all builds under
mingw32, and it's not clear whether binary compatibility with extensions
built by microsoft compilers is an easy goal either)

http://www.mingw.org/

Jeff


pgplhycX3JBjH.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Extending an embeded Python

2005-04-12 Thread Mikin von Flap
I'm trying to embed Python in a Windows exe, and extend it with some 
functions in the same program. So far I only add one function:
file.h
static PyObject* py_print( PyObject* self, PyObject* args ) {
const char* msg;
if( !PyArg_ParseTuple( args, s, msg ) )
return 0;
EventLog::log( msg );
Py_INCREF( Py_None );
return Py_None;
}
static PyMethodDef StoneAgeMethods[] = {
{ log, py_print, METH_VARARGS, Print a message to the log },
{ 0, 0, 0, 0 } /* sentinel */
};
file.cpp
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int ) {
EventLog::init( con_dump.txt );
Py_Initialize();
EventLog::log( Python version '%s', Py_GetVersion() );
PyObject* res0 = Py_InitModule( stoneage, StoneAgeMethods );
res1 = PyRun_SimpleString( stoneage.log( \test\ )\n ); // FAIL
res2 = PyRun_SimpleString( log( \test\ )\n ); // FAIL
res3 = PyRun_SimpleString( print \test\\n ); // OK
Py_Finalize();
}
This compiles without problems, but when I run it I can't use the log 
function. Result res0 is a non-null object.
As far as I can understand the Extending and Embedding the Python 
Interpreter doc, res1 should work but it doesn't!
I'm a total newbie to Python, so any help appreciated :) 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming Language for Systems Administrator

2005-04-12 Thread Laszlo Zsolt Nagy
 Hello,
I have some answers but for some of your questions, there are many 
(possibly good) answers.

1)Can i build web applications in Python ? If so how. I am planning to
build a web application for intranet use which deals with workflow of
Internal office communication.
 

I believe you want something that is more just a mailing list. There are 
at least 4 different solutions for creating web sites with Python.
Here are some:

 Plone  (www.plone.org)
 Zope  (Plone is build with Zope)
 mod_python
Depends on what you need and how much time you have to do it.
2)Which is best opensource database to be used with Python ?
 

Under Windows platform, I would like to recommend PostgreSQL 8 - fast 
enough, it has many data types, procedural languages, triggers, 
contributed extensions. Supports nested transactions, deferrable 
constraints etc. For small applications, it can be too heavy.
For smaller, simple applications you can consider FireBird. It is more 
simple and lightweight.
I also tried SAP-DB before. I cannot tell too much about SAP but it 
looked promising.
I do not recommend MySQL. If you really want to take advantage of the 
modern concepts of today's database systems, you will notice that MySQL 
is not standard enough and usually you will find something that you 
cannot do with it. (Otherwise MySQL is very popular.)

You can also try other object persistence systems. (For example, ZODB 
) They are not relational databases but they can be good for you.

3)When i write a remote execution script in python is it required that
python should be installed in remote system.
 

I'm not sure what it means. Are you talking about RPC? You can write COM 
servers using Python. Does this answer your question?

4)I heard about Perl/CGI and that CGI application done by python
too.Is CGI still valid when PHP has taken over the WebApplication
Development, Dominating.
 

CGI is still valid but nobody will recommend it to you. It is obsolete. 
You should better use a templating or content management system. For 
bigger sites, you can use a better web application server like Zope, 
make the programming part at lower level. It requires more knowledge but 
gives you virtually infinite number of possiblilites.

Sorry if these questions are out of this group , but answers to these ?
will help me a lot.
 

It seems to me that you have interests in various fields but it looks 
you did not search on the internet.
For example, if you search for web development Python wiki on google 
then you will get this link
on the first page:

http://www.fredshack.com/docs/pythonweb.html
I can't believe that you tried to get information from search engines. 
Please do not ask this list to dig the information for you.
Search on the internet first. Use Python Wiki. Read the articles, read 
at least the front pages of the tools found. Compare them yourself.
Then if you still need to choose between two but you cannot decide wich 
one to use - you can come back and ask others what is their experience.

--
_
 Laszlo Nagy  web: http://designasign.biz
 IT Consultantmail: [EMAIL PROTECTED]
Python forever!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter withdraw and askstring problem

2005-04-12 Thread Jeff Epler
The answer has to do with a concept Tk calls transient.  
wm transient window ?master?
If master is specified, then the window manager is informed that
window  is  a  transient window (e.g. pull-down menu) working on
behalf of master (where master is the path name for a  top-level
window).   If master is specified as an empty string then window
is marked as not being a transient window any  more.   Otherwise
the command returns the path name of windows current master, or
an empty string if window isnt currently a transient window.  A
transient  window  will  mirror  state changes in the master and
inherit the state of the master when initially mapped. It is  an
error to attempt to make a window a transient of itself.

In tkSimpleDialog, the dialog window is unconditionally made transient
for the master.  Windows is simply following the documentation: The
askstring window inherit[s] the state of the master [i.e., withdrawn]
when initially mapped.

The fix is to modify tkSimpleDialog.Dialog.__init__ to only make the
dialog transient for its master when the master is viewable.  This
mirrors what is done in dialog.tcl in Tk itself.  You can either change
tkSimpleDialog.py, or you can include a new definition of __init__ with 
these lines at the top, and the rest of the function the same:
def __init__(self, parent, title = None):
''' the docstring ... '''
Toplevel.__init__(self, parent)
if parent.winfo_viewable():
self.transient(parent)
...

# Thanks for being so dynamic, Python!
tkSimpleDialog.Dialog.__init__ = __init__; del __init__

Jeff


pgp4ueSCXQcCg.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: HELP ! Anybody knows where the stackless python website is ?

2005-04-12 Thread cfbolz
Hi!

Pierre-Frédéric Caillaud wrote:
 I've been trying desperately to access http://www.stackless.com but
 it's been down, for about a week now !

The stackless webpage is working again.

Regards,

Carl Friedrich Bolz

--
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Uwe Mayer
Tuesday 12 April 2005 14:51 pm Michele Simionato wrote:

 No. Not everybody knows about Singleton. It is an acquired knowledge.

Well, what isn't? 
What I ment to say, but failed to do so more explicitly, was that it is a
term I felt which was generally known to the programming society. Or that
it is a term that might pop up in a comunity where software design is an
issue.
This of course does not mean that you could not have used it without knowing
that someone had thought of a fancy name for it. 

[...]
 It was only after many months that I understood that there was really
 nothing
 more to it. 

I agree. There really isn't much to Singletons. There was a time when I also
did not know about Singletons or design pattern in general. But thats
always the case somehow, somewhere. 

[...] 
 In my lectures at Oxford next week I have carefully expunged anything
 referring to Singletons ;)

Perhapts you shouldn't. Otherwise people might stumble over the same problem
you did. 

 IMNSHO, the property there is only one is not important enough to
 deserves
 a name. 

The problem here is: it has already a name. It is the probably most simple
pattern there is. And if only it serves as a mind-boggingly example of a
design pattern, why not call it a singleton. Why call it a class that
can only be instanciated once?
I do not yet feel there is being made too much fuss about it. People do not
start name-dropping on singletons. Design pattern in general, perhaps. 

 The property if you have already called this callable with the 
 same arguments you don't need to recompute it instead is quite worthy
 and subsumes the other concept as a special case. It also gives you
 plenty of use case to illustrate it, even to beginner programmers.

To step in your argument, you could also call that caching a function
call.

BTW: @memoize on the __new__ method isn't quite enough. You'll have to call
it on __init__ as well, otherwise it is executed again on the already
initialised object.
Also calling @memoize on the __init__ does not suffice either, because can
call it with different parameters...

Ciao
Uwe 
-- 
http://mail.python.org/mailman/listinfo/python-list


Northampton, UK

2005-04-12 Thread Fuzzyman
Just on the off chance I thought I'd ask if there were any
Pythoneers out there local to Northampton UK ?

Best Regards,

Fuzzy
http://www.voidspace.org.uk/python

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Ivan Van Laningham
Hi All--

Richie Hindle wrote:
 
 [Xah]
  motherfucking ... fucking ... fucking ... fucking ... fuck ... fucking
  fucking ... fucking ... mother fucking ... fucking ... piece of shit ...
  motherfucking ... fucking ... fucking ... big asshole ... masturbation ...
  Fucking morons ... fucking stupid ... fuckhead coders ... fuckheads ...
  you fucking asses.
 
  paypal me a hundred dollars and i'll rewrite the whole re doc in a few
  hours.
 
 Can we paypal you a hundred dollars to leave us alone?  I'll pledge $10.
 Are there another nine people here who'll do the same?
 
 

Why don't we pay him $100 to re-write the PERL docs?

Metta,
Ivan
--
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours
-- 
http://mail.python.org/mailman/listinfo/python-list


Informixdb: New maintainer, new version

2005-04-12 Thread Carsten Haese
Hi Everybody:

Since the current maintainer of the informixdb module appears to have
gone missing, I have decided to take over the project. The new home of
the informixdb module is http://sourceforge.net/projects/informixdb .

Version 1.4 features the following improvements:

* Build uses distutils instead of deprecated Makefile.pre.in mechanism.
* Connect method takes optional username and password parameters for
connecting to a remote database.
* Cursor attribute .sqlerrd exposes Informix's sqlca.sqlerrd resulting
from the cursor's most recent .execute() call.

If you have any questions or comments, please let me know.

Best regards,

-- 
  Carsten Haese - Software Engineer   |Phone:  (419) 861-3331
Unique Systems, Inc.  |  FAX:  (419) 861-3340
 1446 Reynolds Rd, Suite 313  |
 Maumee, OH  43537|  mailto:[EMAIL PROTECTED]

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Steven Bethard
Fredrik Lundh wrote:
Or if you're using an application object (you should), just add a config object
to the application object (app.config.param = ...).
Do you have a link or two that describe what you mean by an application 
object?  The you should comment makes me think this is something of a 
design pattern, but googling around wasn't able to satisfy my curiosity.

STeVe
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] Python documentation moronicities (continued)

2005-04-12 Thread Richard Gration
On Tue, 12 Apr 2005 04:02:20 -0700, Joe Smith wrote:

 Xah Lee wrote:
 
 of motherf***ing irrevalent drivel?
 
 I am greatly amused.
 A troll impersonating Xah Lee has made xah look like a total moron. LOL

The fucking doc cannot be possibly fucking worsely written.

This is very Xahish though, even if it's not him.

It's right up there with AND, the writting as usuall is fantastic
incompetent.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: singleton objects with decorators

2005-04-12 Thread Steven Bethard
Uwe Mayer wrote:
Tuesday 12 April 2005 10:01 am Steven Bethard wrote:
I am using a class to manage configuration settings in an application.
This object should only existe once so that when the user
changes a setting through a configuration dialog the change imminent in
all locations where access to config settings are needed.

Ahh, I see.  I would typically just use a module in this situation,
where the configuration settings were just names global to the module.
Is there a benefit to using a singleton object over using just a module?
Basically I am using a module. The config file is stored in
$HOME/.app/app.conf where the user can go and edit it. It is a working
python program which globally declares variables.
I cannot simply import this module as it does not lie in the path and I am
not too fond of dynamically cluttering sys.path to my needs.
Hmmm...  Maybe you could use a memoized wrapper to imp.load_source? 
I've never used it, but it looks kinda like it might do what you want...

But I guess that probably doesn't really gain you too much over the 
Singleton solution...

STeVe
--
http://mail.python.org/mailman/listinfo/python-list


exporting imports to reduce exe size?

2005-04-12 Thread Ron_Adam

In looking at ways to reduce the size of exe's created with py2exe,
I've noticed that it will include a whole library or module even if I
only need one function or value from it.  

What I would like to do is to import individual functions and then
export 'write' them to a common resource file and import that with
just the resources I need in them.

Has anyone tried this?  

I'm considering using pickle to do it, but was wondering if this is
even a viable idea?  

Is it possible to pickle the name space after the imports and then
reload the name space in place of the imports later?

Cheers, 
Ron

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming Language for Systems Administrator

2005-04-12 Thread Terry Reedy

Kanthi Kiran Narisetti [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
.Some of my questions
 regarding the same follows.

Most of these have been discussed many times.  You can use Google to search 
the archives of this newsgroup.  I strongly recommend that you learn to use 
that resource.

 1)Can i build web applications in Python ? If so how. I am planning to
 build a web application for intranet use which deals with workflow of
 Internal office communication.

Yes, see Google

 2)Which is best opensource database to be used with Python ?

Currently being debated in another thread.  See Google for previous 
discussions.

 3)When i write a remote execution script in python is it required that
 python should be installed in remote system.

Yes.  I think there are a couple of options that have been discussed.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python / Win32 extensions compatibility with Windows XP

2005-04-12 Thread Jim Sizelove
Matthew wrote:
Hi:
I recently installed Python 2.4 and the Win 32 extensions on
Windows XP.  I had some problems with the COM makepy utility for the
Excel COM libraries.  I reported this problem to the sourceforge bug
tracker.
My question is , is python 2.3 and the win32 extensions more stable
than Python 2.4?
Thank You
Matthew Harelick
There were some memory issues that caused makepy on Python 2.4 to crash 
for some large type libraries (including Excel).  This problem has been 
fixed in build 204 of pywin32, released just today.

Regards,
Jim
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >