Zenoss Project (Network/Systems Management)

2006-03-20 Thread Bill Karpovich
We are pleased to announce the Zenoss project.

Zenoss is Python/Zope-based, network/systems monitoring application that has
been in development since 2002.

The goal of Zenoss is to Simplify Systems Management with a Python, open
source alternative to the big commercial management suites (e.g. IBM Tivoli,
HP OpenView, etc.). 

Zenoss also strives to go beyond Nagios and OpenNMS with improved
architecture, scalability, ease and breadth. 

Links:
  - http://www.zenoss.org (home)
  - http://www.zenoss.org/download (download)
  - http://www.zenoss.org/product (product info)
  - http://dev.zenoss.org/trac (wiki/roadmap/tickets)

Register ASAP and get a free Here it is ... Your Moment of Zen t-shirt!
  - http://www.zenoss.org/participate/

We are currently recruiting for the project, including paid positions and
bounties.
  - http://www.zenoss.org/participate/helpwanted.html

Zenoss product highlights:
  - Monitoring across layers (network, servers, apps, environment...)
  - Monitoring across platforms (windows, linux, unix...)
  - Monitoring across perspectives (availability, performance, events)
  - Automated, object-based modeling of the IT environment
  - Role-based access/management through web portal
  - Written in Python...

Enjoy,

Bill Karpovich
[EMAIL PROTECTED]

Erik Dahl
[EMAIL PROTECTED]


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

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


Pywin32 - 2.08

2006-03-20 Thread M�ta-MCI
Hi!

Mark Hammond must be a little timid. Then, I copy and past his message:

---
Hi all,
  I have just released build 208 of the pywin32 extensions.

Change log and release notes:
 https://sourceforge.net/project/shownotes.php?release_id=403008

Download via:
  https://sourceforge.net/project/showfiles.php?group_id=78018

Please log any issues via the SourceForge bug collector:
 https://sourceforge.net/tracker/?group_id=78018atid=551954

Regards,

Mark.
---


@-salutations
--
Michel Claveau




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

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


Bug Day on Friday, 31st of March

2006-03-20 Thread Georg Brandl
Hello,

it's time for the 7th Python Bug Day. The aim of the bug day is to close
as many bugs, patches and feature requests as possible, this time with a
special focus on new features that can still go into the upcoming 2.5 alpha
release.

When?
^

The bug day will take place on Friday, March 31st, running from
1PM to 7PM GMT (9AM to 3PM Eastern time). You don't need to be around all day;
feel free to stop by for a few hours and contribute.

Where and How?
^^

To join, stop by the IRC channel #python-dev on irc.freenode.net, where
efforts will be discussed and coordinated. We'll collaboratively go through
the Python bug database at SourceForge and fix things as they come up.

IMPORTANT: *No* prior knowledge of the Python source is necessary to
participate! You'll get all assistance the developers can offer for starting
up with helping, this is in fact a good opportunity to learn the basics.

Bug day participation helps the developers and makes Python 2.5 a better
release by reducing the backlog of bugs and patches.  Plus, it's fun!

More information


For instructions and more information, see the Wiki page at
http://www.python.org/cgi-bin/moinmoin/PythonBugDay


Cheers,
Georg

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

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


Dr. Dobb's Python-URL! - weekly Python news and links (Mar 20)

2006-03-20 Thread Peter Otten
QOTW:  Anything with 'Python' in its name can't market Python
well. - Iain Bicking

Who really cares whether NASA uses Python? One thing I learned from
having to sit through too many software marketing presentations is
that organizations like NASA are to software what the Library of
Congress is to books. - Steven Lumos on comp.lang.ruby


How would you compare two strings when you don't care about
whitespace? Hint: no regular expressions needed.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/2ad8fae9cc32e333/b4dc3a17d7502391

Jarek Zgoda's hack seems to be the most reliable way to get localized
month names.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/7d8e318b9b27a460/8b8283877bc02aa1?tvc=1

Python 2.5 is scheduled for August 19, 2006. Among the highlights are
the with-statement simplifying reliable resource acquisition/release
and Fredrik Lundh's ElementTree. When bugs due to clever workarounds
made it into the standard library Guido finally gave in, so there will
be an inline-if/else, too. Use with discretion :-)
http://groups.google.com/group/comp.lang.python/msg/f6f95174484c24cc

Experienced developers wrestle with thorny deployment issues.
 http://blog.ianbicking.org/packaging-python.html

Is coding a text adventure? Matt Webb and his co-developers think so.
They use Python as the tried and tested tool to explore new ideas.
http://www.wired.com/news/technology/0,70413-0.html?tw=wn_technology_4

Iain Bicking shares his thoughts about the new python.org website and
marketing Python.
http://blog.ianbicking.org/python-marketing-2006.html

You don't always need a big fat office suite to get your data out of
an Excel spreadsheet. 

http://groups.google.com/group/comp.lang.python/browse_frm/thread/af8f5484123101ae/fd7fb0d4d894dce2?tvc=1

Stackless Python has been ported to Python 2.4.2.
http://www.stackless.com/Members/rmtew/pycon2006Result



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance. 
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Although unmaintained since 2002, the Cetus collection of Python
hyperlinks retains a few gems.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a 

Re: Pycrypto - active ??

2006-03-20 Thread dirvine
Yes the homepage says updated, but I think that refers to more than
just pycrypto. The data etc. all seems old. Perhaps it's at it's level
?

I just wonder if the project itself is active and more recent docs
exist to answer some of the questions I have posed.

I certainly hope theres some answers.

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


Re: Chained Comparisons

2006-03-20 Thread John Machin
On 20/03/2006 5:24 PM, Sathyaish wrote:
 I) What does the following expression evaluate to?
 
 a  b == c
 
 1) (a  b) and (b == c)
 2) (a  b) or (b == c)
 

Given the common idiom in mathematics (a = b = c) and what it means, 
please contemplate which of and and or might be the more 
sensible/useful/plausible answer. Failing that, try to write a small 
script which answers your question. If that doesn't work, try reading 
section 5.9 (Comparisons) of the Python Reference Manual.

 
 II) How many operands can be chained for comparison in a single
 expression? For e.g, is the under-stated expression a valid comparison
 chain?
 
 a  b == c  d
 

Similar process: infer a plausible answer / script / see the above 
manual reference.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Chained Comparisons

2006-03-20 Thread Sathyaish
John,


I did guess but I wasn't quite sure and so I asked. OK, I did not
perform a search on the docs, but that was because:

1) It is easier to learn through an interactive medium like a forum;
and
2) A search in the same document you are reading takes you off and
adrift, and as such, is equivalant to a task-switch, because you're
already reading some material from the same help file and are stuck at
some point.

Thanks for the help.

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


Re: whats your favourite object relational mapper?

2006-03-20 Thread Giovanni Bajo
Jonathan Ellis wrote:

 ... which, of course, goes to show how stupid a metric this is, now
 that even Ian Bicking has admitted that SqlObject in its current form
 is a dead end.


Got a pointer?
-- 
Giovanni Bajo


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


Re: C API: Testing my reference counting

2006-03-20 Thread Martin v. Löwis
lord trousers wrote:
 Is there a way I can get hold of these kinds of statistics for
 debugging?

This is best done when Python is build in debug mode.
sys.gettotalrefcount then gives you the number of INCREF
calls for which no DECREF has been made; you said that
this shouldn't change.

If it does change, sys.get_counts() will give you the
number of objects per type.

Furthermore, sys.getobjects() will give you a list of
all objects allocated (excluding the result list).

HTH,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.5 Schedule

2006-03-20 Thread Martin v. Löwis
Ben Finney wrote:
 - ASCII is the default coding
 
 Er? How did this happen?
 
 To be specific, what about all the movement toward UTF-8?

See PEP 263. ASCII is the default encoding for source code;
if you want to use UTF-8 in source code, either put

# -*- coding: utf-8 -*-

into the file, or start the file with the UTF-8 signature
(if your editor supports that).

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


combining mod_python handlers publisher and psp problem

2006-03-20 Thread exhuma.twn
Simple problem:

When I define a funtion the way you would with the publisher handler
(without using psp), all works as expected. However when I define a
publisher-like function and instantiate a PSP object in it ( as
suggested on
http://www.onlamp.com/pub/a/python/2004/02/26/python_server_pages.html
) mod_python seems to fail to tell the browser which content-type the
document has. The output is what I expect it to be, but instead of
rendering the page I see the source code, so I suppose the browser sees
it as text/python or text/plain.

I tried to do a

   print Content-Type: text/html
   print

as first statement, but then it only outputs that as normal text too.

Any ideas?

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


Re: Chained Comparisons

2006-03-20 Thread Duncan Booth
Sathyaish wrote:

 I did guess but I wasn't quite sure and so I asked. OK, I did not
 perform a search on the docs, but that was because:
 
 1) It is easier to learn through an interactive medium like a forum;

and what exactly do you think the other people in the forum do? They go off 
and read the documentation so that they can be sure to quote it back 
accurately to you. So you've saved yourself the bother of looking up the 
docs just so that a large number of people can all do it for you.

Please, in future, try looking in the documentation before you post: if 
you've looked and can't find what you need, that's fine, or if you've found 
it unclear and want more information that is also fine.

 2) A search in the same document you are reading takes you off and
 adrift, and as such, is equivalant to a task-switch, because you're
 already reading some material from the same help file and are stuck at
 some point.

I've tried reading this several times and can't make sense of what you are 
trying to say?
-- 
http://mail.python.org/mailman/listinfo/python-list


Error sending message [1142579362378.1884.rpppl] from [randpoly.com]

2006-03-20 Thread randpoly.com PostMaster
[00] V-POP3bounce: [EMAIL PROTECTED];Error=[550 Error: Invalid Attachment]


[01] Error sending message [1142579362378.1884.rpppl] from [randpoly.com].

ID:SCB9A
Mail From: python-list@python.org
Rcpt To:   [EMAIL PROTECTED]
Server:relaymaster.rapidns.com [209.120.245.170]


[02] The reason of the delivery failure was:

550 Error: Invalid Attachment


[05] Here is listed the initial part of the message:

Received: from python.org (192.168.0.24:4368)
by smtp.randpoly.com with [V-POP3Mail (Win32/Ix86) ESMTP Server]
id SCB9A for [EMAIL PROTECTED] from python-list@python.org;
Fri, 17 Mar 2006 12:39:22 +0530
From: python-list@python.org
To: [EMAIL PROTECTED]
Subject: hello
Date: Fri, 17 Mar 2006 12:51:11 +0530
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary==_NextPart_000_0007_20D01A2C.9CCD2AD1
X-Priority: 3
X-MSMail-Priority: Normal

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


Re: combining mod_python handlers publisher and psp problem

2006-03-20 Thread exhuma.twn
exhuma.twn wrote:
 Simple problem:

 When I define a funtion the way you would with the publisher handler
 (without using psp), all works as expected. However when I define a
 publisher-like function and instantiate a PSP object in it ( as
 suggested on
 http://www.onlamp.com/pub/a/python/2004/02/26/python_server_pages.html
 ) mod_python seems to fail to tell the browser which content-type the
 document has. The output is what I expect it to be, but instead of
 rendering the page I see the source code, so I suppose the browser sees
 it as text/python or text/plain.

 I tried to do a

print Content-Type: text/html
print

 as first statement, but then it only outputs that as normal text too.

 Any ideas?

Update:
I got it working. My old code was as follows:

   def index(req, name='John'):
  s = 'Hello, there!'
  if name:
 names = ['a', 'b', 'c']
 s = 'Hello, %s!' % name.capitalize()
 tmpl = psp.PSP(req, filename='index.psp')
 tmpl.run(vars = { 'greet': s, 'names': names })
  return

Now I did this:

   def index(req, name='John'):
  s = 'Hello, there!'
  if name:
 names = ['a', 'b', 'c']
 s = 'Hello, %s!' % name.capitalize()
 tmpl = psp.PSP(req, filename='index.psp',
vars = { 'greet': s, 'names': names })
  return tmpl

So basically I assigned the variables on instantiation of the PSP
object and returned the resulting reference. This is different to what
is noted at onlamp.com

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


Re: IMAP Folder Size Information

2006-03-20 Thread Tim Williams (gmail)
On 20/03/06, Kevin F [EMAIL PROTECTED] wrote:
I'm trying to use the following code to get my remote server's foldersize information.Unfortunately, i'm getting the error:Traceback (most recent call last): File /Life/School/Homework/Spring 2006/OPIM
399/Tutorial/IMAP/mailboxsize.py, line 23, in -toplevel- number_of_messages_all += int(number_of_messages[0])ValueError: invalid literal for int(): The requested item could not befound.
The error is on line 23, so insert the following print statement at line 23

23  print number_of_messages =, number_of_messages # For debugging
24  number_of_messages_all += int(number_of_messages[0]) # original line

and the reported error changes to:

number_of_messages = ['Could not select box']
Traceback (most recent call last):
 File C:\MXEXTRA\scripts\imapt1.py, line 24, in ?
 number_of_messages_all += int(number_of_messages[0])
ValueError: invalid literal for int(): Could not select box

HTH :)


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

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-20 Thread Dinko Tenev
Doug Quale wrote:
 funkyj [EMAIL PROTECTED] writes:

  One advantage of a generator over filtering the full product is that I,
  as the user of the generator, am not obligated to iterate over the
  entire solution space.
 
  Are there other _practical_ advantages of generators over mapping 
  filtering complete sets?

 Storage.  You can iterate over problem spaces much too large to fit in
 memory.  Also generate + iterate can be faster because of reduced
 memory pressure.

Hmmm...storage is not an issue in the Prolog version.  It generates a
candidate solution, then checks membership in the wildcard set, then
backtracks (backtracking is caused by fail in the test goal.)  On
backtracking, it effectively forgets the last solution, so the memory
is freed up (or at least free to be reclaimed through GC.)

Cheers,

Dinko

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


Error sending message [1142825372138.2332.rpppl] from [randpoly.com]

2006-03-20 Thread randpoly.com PostMaster
[00] V-POP3bounce: [EMAIL PROTECTED];Error=[550 Error: Invalid Attachment]


[01] Error sending message [1142825372138.2332.rpppl] from [randpoly.com].

ID:SE8B0
Mail From: python-list@python.org
Rcpt To:   [EMAIL PROTECTED]
Server:relaymaster.rapidns.com [209.120.245.170]


[02] The reason of the delivery failure was:

550 Error: Invalid Attachment


[05] Here is listed the initial part of the message:

Received: from python.org (192.168.0.24:1479)
by smtp.randpoly.com with [V-POP3Mail (Win32/Ix86) ESMTP Server]
id SE8B0 for [EMAIL PROTECTED] from python-list@python.org;
Mon, 20 Mar 2006 08:59:32 +0530
From: python-list@python.org
To: [EMAIL PROTECTED]
Subject: Status
Date: Mon, 20 Mar 2006 09:11:17 +0530
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary==_NextPart_000_0013_4CCCFBDD.E2A9B589
X-Priority: 3
X-MSMail-Priority: Normal

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


Re: Keeping a function from taking to long--threads?

2006-03-20 Thread Rene Pijlman
[EMAIL PROTECTED]:
I'm using windows, and from what I've tried, the setdefaulttimeout 
function doesn't work on my machine.

It should. It does on mine.

-- 
René Pijlman

Wat wil jij leren?  http://www.leren.nl
-- 
http://mail.python.org/mailman/listinfo/python-list


mod_python + publisher + psp + session problems

2006-03-20 Thread exhuma.twn
Hi again,

as soon as I try to make use of the session object inside a
psp-template file, I get the following error:

Mod_python error: PythonHandler mod_python.publisher

Traceback (most recent call last):

  File /usr/lib/python2.4/site-packages/mod_python/apache.py, line
299, in HandlerDispatch
result = object(req)

  File /usr/lib/python2.4/site-packages/mod_python/publisher.py, line
143, in handler
result = str(result)

  File /usr/lib/python2.4/site-packages/mod_python/psp.py, line 228,
in __str__
self.run()

  File /usr/lib/python2.4/site-packages/mod_python/psp.py, line 191,
in run
session = Session.Session(req)

  File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
389, in Session
timeout=timeout, lock=lock)

  File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
294, in __init__
timeout=timeout, lock=lock)

  File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
132, in __init__
Cookie.add_cookie(self._req, self.make_cookie())

  File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
160, in make_cookie
c.path = dirpath[len(docroot):]

TypeError: unsubscriptable object

Any ideas?

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


Re: Need design advice. What's my best approach for storing this data?

2006-03-20 Thread Magnus Lycka
Mudcat wrote:
 I am trying to build a tool that analyzes stock data. Therefore I am
 going to download and store quite a vast amount of it. Just for a
 general number - assuming there are about 7000 listed stocks on the two
 major markets plus some extras, 255 tradying days a year for 20 years,
 that is about 36 million entries.
 
 Obviously a database is a logical choice for that. However I've never
 used one, nor do I know what benefits I would get from using one. I am
 worried about speed, memory usage, and disk space.

This is a typical use case for relational database systems.
With something like DB2 or Oracle here, you can take advantage
of more than 20 years of work by lots of developers trying to
solve the kind of problems you will run into.

You haven't really stated all the facts to decide what product
to choose though. Will this be a multi-user applications?
Do you forsee a client/server application? What operating
system(s) do you need to support?

With relational databases, it's plausible to move some of
the hard work in the data analysis into the server. Using
this well means that you need to learn a bit about how
relational databases work, but I think it's with the trouble.
It could mean that much less data ever needs to reach your
Python program for processing, and that will mean a lot for
your performance. Relational databases are very good at
searching, sorting and simple aggregations of data. SQL is
a declarative language, and in principle, your SQL code
will just declare the correct queries and manipulations that
you want to achieve, and tuning will be a separate activity,
which doesn't need to involve program changes. In reality,
there are certainly cases where changes in SQL code will
influence performance, but to a very large extent, you can
achieve good performance through building indices and by
letting the database gather statistics and analyze the
queries your programs contain. As a bonus, you also have
advanced systems for security, transactional safety, on-
line backup, replication etc.

You don't get these advantages with any other data storage
systems.

I'd get Chris Fehily's SQL Visual Quickstart Guide, which
is as good as his Python book. As database, it depends a bit
on your platform you work with. I'd avoid MySQL. Some friends
of mine have used it for needs similar to yours, and they are
now running into its severe shortcomings. (I did warn them.)

For Windows, I think the single user version of SQL Server
(MSDE?) is gratis. For both Windows and Linux/Unix, there are
(I think) gratis versions of both Oracle 10g, IBM DB2 UDB and
Mimer SQL. Mimer SQL is easy to install, Oracle is a pain, and
I think DB2 is somewhere in between. PostgreSQL is also a good
option.

Either way, it certainly seems natural to learn relational
databases and SQL if you want to work with financial software.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Keeping a function from taking to long--threads?

2006-03-20 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 Thanks, however, I forgot to mention that I'm using windows, and from what
 I've tried, the setdefaulttimeout function doesn't work on my machine.
 Again, thanks for your help!
 Brandon McGinty
 
What version of Python are you running? Under 3.4 setdefaulttimeout() 
works perfectly well on my Windows system.

If you are running 2.3 or earlier, you may want to use Timothy 
O'Malley's timeoutsocket module instead.

However, you seem to be assuming that socket.gethostbyaddr() will report 
on the existence of systems, which I don't think it will - that function 
is for converting IP addresses to names:

   import socket
   socket.gethostbyaddr(127.0.0.1)
('localhost', [], ['127.0.0.1'])
   socket.gethostbyaddr(192.168.10.215)
('bigboy.lan', [], ['192.168.10.215'])
   socket.gethostbyaddr(82.165.194.52)
('perfora.net', [], ['82.165.194.52'])
  

So it will tell you something about the DNS service's content rather 
than the existence or non-existence of systems at a particular IP address.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

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


Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-20 Thread jcmendez
John

Thanks for walking us through the comparison.  On the xlrd website I
saw that it does not import formulas from the Excel files, which is
what I'm looking for.  Any suggestions?

Juan C.

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


Re: mod_python + publisher + psp + session problems

2006-03-20 Thread grahamd

exhuma.twn wrote:
 Hi again,

 as soon as I try to make use of the session object inside a
 psp-template file, I get the following error:

 Mod_python error: PythonHandler mod_python.publisher

 Traceback (most recent call last):

   File /usr/lib/python2.4/site-packages/mod_python/apache.py, line
 299, in HandlerDispatch
 result = object(req)

   File /usr/lib/python2.4/site-packages/mod_python/publisher.py, line
 143, in handler
 result = str(result)

   File /usr/lib/python2.4/site-packages/mod_python/psp.py, line 228,
 in __str__
 self.run()

   File /usr/lib/python2.4/site-packages/mod_python/psp.py, line 191,
 in run
 session = Session.Session(req)

   File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
 389, in Session
 timeout=timeout, lock=lock)

   File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
 294, in __init__
 timeout=timeout, lock=lock)

   File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
 132, in __init__
 Cookie.add_cookie(self._req, self.make_cookie())

   File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
 160, in make_cookie
 c.path = dirpath[len(docroot):]

 TypeError: unsubscriptable object

 Any ideas?

Upgrade to mod_python 3.2.8 and your problem will go away.

See:

  http://issues.apache.org/jira/browse/MODPYTHON-50

I suggest that in future you use the mod_python mailing list for
questions
as that is where most knowledgeable people on mod_python hang out.

Graham

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


Re: Pycrypto - active ??

2006-03-20 Thread Paul Rubin
dirvine [EMAIL PROTECTED] writes:
 I just wonder if the project itself is active and more recent docs
 exist to answer some of the questions I have posed.
 
 I certainly hope theres some answers.

You mentioned TLS/SSL, so I hope you do know about http://trevp.com/tlslite. 
But that doesn't answer your immediate question about Pycrypto.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: combining mod_python handlers publisher and psp problem

2006-03-20 Thread grahamd
You could also have done:

   def index(req, name='John'):
  s = 'Hello, there!'
  if name:
 names = ['a', 'b', 'c']
 s = 'Hello, %s!' % name.capitalize()
 tmpl = psp.PSP(req, filename='index.psp')
 req.content_type = 'text/html'
 tmpl.run(vars = { 'greet': s, 'names': names })
  return

Try the mod_python mailing list if you want an explaination of why.

Graham

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


Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-20 Thread John Machin
On 20/03/2006 9:28 PM, jcmendez wrote:
 John
 
 Thanks for walking us through the comparison.  On the xlrd website I
 saw that it does not import formulas from the Excel files, which is
 what I'm looking for.  Any suggestions?
 
 Juan C.
 
Juan, what do you want to do with the formulas after importing them? 
Pretty-print them? Evaluate them?
Cheers,
John
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-20 Thread Dinko Tenev
[EMAIL PROTECTED] wrote:
 It would seem that your program is just filtering the full cartesian
 product, right? The solution I'm looking for generates the elements
 one-by-one so that it could be used in a loop.

OK, having read some of the comments so far, I have the feeling that I
may be missing the point in more than one way, so let's set this
straight:

If I understand correctly, for an alphabet S, and a subset W of S*
specified by the wildcards, you expect the enumeration of sequences of
length n to run in Theta( n*|S^n - W| ) instead of Theta( n*|S^n| ).

First, this doesn't seem to hold for your Python program.  Try, for
example, S = { a, b, c }, W = { *a*b*, *b*c*, *c*a*, *b*a*, *c*b*,
*a*c* }, with some large values of n.  Theta( n*|S^n - W| ) predicts
that the enumeration time should grow linearly with n, as |S^n - W| =
3, but if you take some measurements, you'd notice that it grows faster
than that.

Second, my current bet is that such an improvement in asymptotic
complexity is not possible, if we consider *both* pre-processing of the
wildcard set and subsequent enumeration.  Speculation: the time for
building-up a smart structure to speed-up enumeration, together with
the time for enumerating the set using that structure, should sum up to
roughly Theta( n*|S^n| ), even with a really smart algorithm.

Even if you're willing to pay up-front for tighter loop execution
later, and you build a suitable structure for this purpose, you would
have to consider the structure's size, so here's another speculation:
such structure would likely take up Theta( |S^n| ) space in memory, in
the worst case.

I would really appreciate it if you could pour some light into what
you're trying to do exactly, and possibly point out anything that I
might have missed so far.

Cheers,

Dinko

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


Re: Chained Comparisons

2006-03-20 Thread Sathyaish
And firing up a news client, posting a message, and /waiting/ for a
response isn't? In most cases, you could have read half the language
reference manual in the time it takes to get an online response.

No, it isn't because you continue reading the same stuff and you have
the stuff open in another window at the same point you left reading it.
That point is not lost. Posting a question in the newsgroup is like
asking someone else; asking some other person to help you out and it
works better than searching the documentation and loosing your train of
thought.

Besides, one doesn't stop reading the help file after posting a
question on the newsgroup until the answer comes. The reading goes on.




and what exactly do you think the other people in the forum do? They go off
and read the documentation so that they can be sure to quote it back
accurately to you. So you've saved yourself the bother of looking up
the
docs just so that a large number of people can all do it for you.

No, I see the people in this forum engage in trivia instead of
understanding a beginner's anxiety, they engage in these flame wars on
trivial issues.

OK, let me calm down. People here are helpful, too. Python is a new
language for me. I've been programming for over eight years now and
have been there, done that on other forums where I saw a beginner.
Sometimes, a few posts as a beginner can be a bitch.



I've tried reading this several times and can't make sense of what you are 
trying to say?

http://www.joelonsoftware.com/articles/fog22.html

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


Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-20 Thread jcmendez
Hi John

I'd like to create a dependency graph and plot it with Graphviz.  I've
played a bit with exporting the sheet in XML format, and parsing the
XML.  That somehow works, but it would be much better if the users
wouldn't need to save as the sheets, just put them is a shared
directory where I can get them with the script.

Thanks!!

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


Re: Is there no end to Python?

2006-03-20 Thread Magnus Lycka
John Salerno wrote:
 But isn't Python sort of known for the opposite, i.e. 'one simple way', 
 or something to that effect?

If we compare it with the opposite language--Perl, and think
of these languages as natural languages, rather than programming
languages, Perl's inventor Larry Wall, felt that having a lot of
synonymns and allowing a lot of flexibility in word order etc,
would make it easier to express one's ideas well.

Python's inventor Guido van Rossum took a different approach. With
fewer synonyms and a less redundant grammer, it will be easier to
master the language, and certainly easier to read texts written by
others.

I don't know, but I suspect that the difference in approach is
rooted in Guido's understanding that we typically spend much more
time reading source code than we spend writing source code.

As it turns out, having fewer synonyms and grammatic variants, does
not make it harder to come up with different solutions to problems.
It rather seems that the lack of complexity that a simpler grammer
leads to makes it much easier to try out different solutions.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Relative paths in mod_python

2006-03-20 Thread Ivo van der Sangen
On 2006-03-19, Bruno Desthuilliers [EMAIL PROTECTED] 
wrote:
 Ivo van der Sangen a écrit :
 I was wondering if I could use relative paths in a mod_python script. At
 the moment I am defining a constant string
 /path/to/dir/where/script/resides. The problem with this is that when
 I move the script including files I use to get metadata I have to change
 this variable. The same problem occurs when I distribute the script; the
 person using it will first have to modify it, which is not what I want. Is
 it possible that a mod_python script has as current working directory
 the directory where the script resides? At the moment os.getcwd()
 returns '/'.

 You could set this constant in the apache conf as a PythonOption. And/Or 
 you could post this question to mod_python's mailing list !-)

I wasn't aware of the mod_python list. The next time I will post my
question there, but I don't think I will get a better answer there; the
solutions given here so far are fine.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-20 Thread John Machin
On 20/03/2006 10:00 PM, jcmendez wrote:
 Hi John
 
 I'd like to create a dependency graph and plot it with Graphviz.  I've
 played a bit with exporting the sheet in XML format, and parsing the
 XML.  That somehow works, but it would be much better if the users
 wouldn't need to save as the sheets, just put them is a shared
 directory where I can get them with the script.
 
 Thanks!!
 

I guess that you need, for each formula cell in a worksheet, a list of 
the cells that are referred to by the formula ... is that correct?


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


Re: Chained Comparisons

2006-03-20 Thread Peter Otten
Sathyaish wrote:

 I) What does the following expression evaluate to?
 
 a  b == c
 
 1) (a  b) and (b == c)
 2) (a  b) or (b == c)

then later

 1) It is easier to learn through an interactive medium like a forum;

There is a convenient alternative to asking basic questions on c.l.py or
ploughing through formal docs. When you have a clear conception of the
possible outcomes it is also reliable.

 1  2 == 3
False

It can't be 'or' then. 
In short, the interactive prompt is *the* tool to learn about language
features and libraries.

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


Re: markup.py - HTML/XML generator

2006-03-20 Thread Gerard Flanagan
Daniel Nogradi wrote:

 Just in case the thought of not having a millionth implementation of a
 HTML/XML generator for Python makes the world as we know it a
 miserable place, well then your suffering might be over soon since
 exactly the one millionth implementation is out. You can download
 markup.py from

 http://markup.sourceforge.net/


(Corrected the link).

You opened a door I was pushing!

I wrote a HTML generator a few weeks ago to generate a static site, but
it was only a little less tortuous to use than writing out the HTML by
hand.  I wanted to do things the way  'markup.py' does but couldn't
manage it. Then I read your code, added straightforward '__getattr__'
and '__call__' methods to my own code, and now I need only half the
'LOC' that I did before.

Before I did this:

page = HtmlPage('Test Page')
left_div = page.append( HtmlElement('div', id='left') )
main_div = page.append( HtmlElement('div', id='main') )
navbar = HtmlElement('ul', css='navbar')
for href,link in {'/home':'Home', '/shop':'Shop',
'/cart':'Cart'}.iteritems():
li = navbar.append( HtmlElement('li') )
li.append( HtmlElement('a',link, href=href) )
left_div.append(navbar)
main_div.append( HtmlElement('h1','Header') )
main_div.append( HtmlElement('p','Text Goes Here') )

Now I can do this:

page = HtmlPage('Test Page')
navbar = page.div(id='left').ul(css='navbar')
for href,link in {'/home':'Home', '/shop':'Shop',
'/cart':'Cart'}.iteritems():
navbar.li.a(link,href=href)
page.div(id='main').h1('Header').p('Text Goes Here')


So *that's* what '__call__' does - I am enlightened!

Thanks a lot.

Here's mine:

http://www.gflanagan.net/site/python/htmlbuilder/htmlbuilder.py

(So, 'More than one million ways to do it' then...)

Gerard

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


Re: Chained Comparisons

2006-03-20 Thread Sathyaish
OK, I get it. Just stop whining endlessly about it, guys. I *do* use
the interpreter. I posted a question here. Sorry, I committed a sin.

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


Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-20 Thread jcmendez
Exactly.  Once I get the formulas, I can do a weak parsing of them and
find the references.

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


Re: ** Operator

2006-03-20 Thread Christoph Zwerschke
Alex Martelli wrote:
 Sathyaish wrote:
 
 I tried it on the interpreter and it looks like it is the to the power
 of operator symbol/function. Can you please point me to the formal
 definition of this operator in the docs?
 
 http://docs.python.org/ref/power.html

I think this should be also mentioned in the Built-In Functions section 
of the Library Reference. Probably most users do not read the Language 
Reference (since the main menu says it's for language lawyers and yes, 
it is not really fun to read).

In the explanation about pow() at 
http://docs.python.org/lib/built-in-funcs.html, the notation 10**2 is 
suddenly used, without explaining that it is equivalent to pow(10,2). I 
think this could be improved in the docs.

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


Re: Importing an output from another function

2006-03-20 Thread Magnus Lycka
Byte wrote:
 Now what do I do if Func1() has multiple outputs and Func2() requires
 them all to give its own output, as follows:
 
 import random
 
 def Func1():
 choice = ('A', 'B', 'C')
 output = random.choice(choice)
 output2 = random.choice(choice)
 return output
 return output2
 
 def Func2(item1, item2):
 print item1, item2
 
 output1 = Func1()
 Func2(output1)

Some more options (untested):

def func1(n, choice=('A', 'B', 'C')):
 # n=number of choices
 # choice can now be overridden with
 # other values
 choices = []
 for i in range(n):
 choices.append(random.choice(choice))
 return choices

def func2(choices):
 for choice in choices:
 print choice,
 print

func2(func1(2))

#

class ChoosePrinter(object):
 def __init__(self, to_choose_from=('A', 'B', 'C')):
 self.to_choose_from=to_choose_from
 self.choosen = []
 def get_choices(self, n=2):
 for i in range(n):
 self.choosen.append(random.choice(choice))
 def dump_choosen(self):
 print  .join(self.choosen)
 self.choosen = []

cp = ChoosePrinter()
cp.get_choices(2)
cp.dump_choosen()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pycrypto - active ??

2006-03-20 Thread dirvine
Thanks Paul

I will check this out. Perhaps theres a case for pycrypto to be
revamped and perhaps a new python cryptographic page to be created
mentioning all these projects. I have foudn it a bit difficult to find
info on this area. Mny thanks for this though.

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


Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-20 Thread John Machin
On 20/03/2006 10:37 PM, jcmendez wrote:
 Exactly.

Yes, your requirement is exactly that, a list of references.


  Once I get the formulas, I can do a weak parsing of them and
 find the references.
 

A formula is not stored as input e.g. (A1+A2)*3.0+$Z$29; it's kept as 
an RPN stream of variable-length tokens. You don't need to parse it in 
the sense you were probably thinking of; *ALL* [ho ho chuckle chuckle] 
you need to do is step through the tokens and do something with the ones 
that contain references. Have a peek at this: 
http://sc.openoffice.org/excelfileformat.pdf -- formulas are covered in 
40+ pages starting at about page 25.

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


Re: Counting number of each item in a list.

2006-03-20 Thread per9000
Dear counters,

I have also encountered the above problem, and I frequently use the two
blocks of code below.

The first one is commented already - except that this version does not
start from an empty dict.

The second inverts the first one. Meaning that a dict in word2hits
style:

my_dict['the'] = 120
my_dict['word'] = 4
...
my_dict['gene'] = 4

becomes a dict in hits2words style:

new_dict[4] = ['word','gene', ...]
new_dict[120] = ['the', ...]

I used these to count genes in in abstracts from pubmed the when I
invented them (but it took some time to remove them from the code and
use them as functions).

def dict_add(indict,inlist,init=1):
  for item in inlist:
if indict.has_key(item):
  indict[item] += 1
else:
  indict[item] = init
  return indict
# end def

def dict_invert(indict):
  new_dict = {}
  for key in indict.keys():
if new_dict.has_key(indict[key]):
  new_dict[indict[key]].append(key)
else:
  new_dict[indict[key]] = [key]
  return new_dict
#end def

A good idea could be to change the header of the first one (if you want
the option to start counting from zero) into:
def dict_add(inlist,indict={},init=1):

/P9K

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


Ink

2006-03-20 Thread mshawjr
Sorry guys.  The spam stuff was not my intent.  I do oppoligies and won't
happen again.  I have never been on newsgroups before and not sure how to
work them. I hope you guys can forgive a bad choice.  Murphey
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Chained Comparisons

2006-03-20 Thread Peter Otten
Sathyaish wrote:

 OK, I get it. Just stop whining endlessly about it, guys. 

Relax. Take what's in it for you and forget about the rest. 

 I *do* use the interpreter. I posted a question here. 

And I showed you an easy way to answer it yourself. Using the interpreter
doesn't seem to be as ingrained in your working style as I trust it will
become if you stick with Python.

 Sorry, I committed a sin.  

Python is a tool, not a religion.

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


Re: Chained Comparisons

2006-03-20 Thread Sathyaish
Thanks, Peter. I do use the interpreter alongside while reading the
documentation and also try out the examples. It was just a matter of
chance that for this particular situation, I did not.

Thank you for the answers, everyone. I hope I am still welcome here for
more questions.

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


Re: Counting number of each item in a list.

2006-03-20 Thread Peter Otten
per9000 wrote:

 A good idea could be to change the header of the first one (if you want
 the option to start counting from zero) into:
 def dict_add(inlist,indict={},init=1):

make that

def dict_add(inlist, indict=None, init=1):
if indict is None:
indict = {}

See 5. Mutable default arguments at
http://zephyrfalcon.org/labs/python_pitfalls.html for an explanation.

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


compile function and future statements

2006-03-20 Thread Fuzzyman
Hello all,

The following is a copy of a blog entry. It's asking a question about
future statements and the built in compile function. I'd appreciate any
pointers or comments about possible approaches.

`Movable Python http://www.voidspace.org.uk/python/movpy/`_ supports
running both Python scripts and ``.pyc`` bytecode files. It does this
by compiling scripts to bytecode, or extracting the code object from
bytecode files, and then calling ``exec``.

When you call `compile
http://docs.python.org/dev/lib/built-in-funcs.html`_ you can pass in
an optional ``flags`` argument which tell Python which future
statements to compile the code with. I currently don't do this, which
means that ``from __future__ import ...`` statements are ignored.

For Python 2.4.2 the most significant of these is `division
http://www.python.org/doc/peps/pep-0238/`_. Code which expects
integer division to yield floats is just plain broken if this future
statement is ignored.

I'd like to fix this in the next release of **Movable Python**.

First of all, I *assume* that the code objects contained in bytecode
files are already compiled with the relevant future statements. This
would mean that no further action is necessary. Can anyone confirm if
this is correct ? [#]_

For Python scripts there are a couple of possible approaches.

The simplest approach would be to use a simple regular expression to
find statements that look like
``from __future__ ...``. Unfortunately this could score false positives
for comments and docstrings. [#]_

Another alternative would be to parse the code into an abstract syntax
tree using the `compiler module
http://docs.python.org/lib/module-compiler.html`_. I would then have
to recognise the import statements in the nodes. I can see that there
is an `Import node
http://docs.python.org/lib/module-compiler.ast.html`_ does anyone
have any hints for me with this approach ? I would prefer a solution
that works across Python versions 2.2 to 2.5 and beyond.

Ominously, the ``compile.compile`` function has unsupported options for
passing in ``flags``, so it looks like it doesn't handle it
automatically from the parse tree.

.. [#] It will actually be easy enough to test.
.. [#] Future statements shuld only occur at the toplevel of code, and
in fact ought to occur before any other statements (although that was
broken in Python 2.4), so it ought to be possible to minimize false
positives a bit.

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


Re: ** Operator

2006-03-20 Thread Sathyaish
Thanks very much for helping out, Christopher.

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


py2exe 0.6.5 released

2006-03-20 Thread Jimmy Retzlaff
py2exe 0.6.5 released
=

py2exe is a Python distutils extension which converts Python scripts
into executable Windows programs, able to run without requiring a
Python installation. Console and Windows (GUI) applications, Windows
NT services, exe and dll COM servers are supported.

Changes in 0.6.5:

* Fixed modulefinder / mf related bugs introduced in 0.6.4. This
  will be most evident when working with things like
  win32com.shell and xml.xpath.

* Files no longer keep read-only attributes when they are copied
  as this was causing problems with the copying of some MS DLLs.

Changes in 0.6.4:

* New skip-archive option which copies the Python bytecode files
  directly into the dist directory and subdirectories - no
  archive is used.

* An experimental new custom-boot-script option which allows a
  boot script to be specified (e.g., --custom-boot-script=cbs.py)
  which can do things like installing a customized stdout
  blackhole. See py2exe's boot_common.py for examples of what can
  be done. The custom boot script is executed during startup of
  the executable immediately after boot_common.py is executed.

* Thomas Heller's performance improvements for finding needed
  modules.

* Mark Hammond's fix for thread-state errors when a py2exe
  created executable tries to use a py2exe created COM DLL.

Changes in 0.6.3:

* First release assembled by py2exe's new maintainer, Jimmy
  Retzlaff. Code changes in this release are from Thomas Heller
  and Gordon Scott.

* The dll-excludes option is now available on the command line.
  It was only possible to specify that in the options argument to
  the setup function before.

  The dll-excludes option can now be used to filter out dlls like
  msvcr71.dll or even w9xpopen.exe.

* Fix from Gordon Scott: py2exe crashed copying extension modules
  in packages.

Changes in 0.6.2:

* Several important bugfixes:

  - bundled extensions in packages did not work correctly, this
made the wxPython single-file sample fail with newer wxPython
versions.

  - occasionally dlls/pyds were loaded twice, with very strange
effects.

  - the source distribution was not complete.

  - it is now possible to build a debug version of py2exe.

Changes in 0.6.1:

* py2exe can now bundle binary extensions and dlls into the
  library-archive or the executable itself.  This allows to
  finally build real single-file executables.

  The bundled dlls and pyds are loaded at runtime by some special
  code that emulates the Windows LoadLibrary function - they are
  never unpacked to the file system.

  This part of the code is distributed under the MPL 1.1, so this
  license is now pulled in by py2exe.

* By default py2exe now includes the codecs module and the
  encodings package.

* Several other fixes.

Homepage:

http://www.py2exe.org

Download from the usual location:

http://sourceforge.net/project/showfiles.php?group_id=15583

Enjoy,
Jimmy
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cmp() on integers - is there guarantee of returning only +-1 or 0?

2006-03-20 Thread Christoph Zwerschke
Alex Martelli wrote:
 [EMAIL PROTECTED] wrote:
 Why not

 def sign(n):
 return n and n/abs(n) or 0
 
 If you assume n is a number, the 'or 0' appears redundant (if you don't
 so assume, then the abs(n) and the division are doubtful;-).

Without the 'or 0' it is also more consistent with the behavior of your 
function that the sign of a float is also a float.

One issue is that division should be normally avoided because it is a 
costly operation and can lead to rounding errors. Maybe performance is 
is not a problem for ints and floats, but if you are planning to use the 
function on long ints, I would consider using something like:

def sign(x): return x0 and 1 or x0 and -1 or 0

def sign(x): return (x0)-(x0)

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


Re: Chained Comparisons

2006-03-20 Thread Steve Holden
Sathyaish wrote:
 Thanks, Peter. I do use the interpreter alongside while reading the
 documentation and also try out the examples. It was just a matter of
 chance that for this particular situation, I did not.
 
 Thank you for the answers, everyone. I hope I am still welcome here for
 more questions.
 
Absolutely no reason why not. You'll be answering them before long. 
Welcome to c.l.py.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

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


compile function and future statements

2006-03-20 Thread Fuzzyman
Hello all,

The following is a copy of a blog entry. It's asking a question about
future statements and the built in compile function. I'd appreciate any
pointers or comments about possible approaches.

`Movable Python http://www.voidspace.org.uk/python/movpy/`_ supports
running both Python scripts and ``.pyc`` bytecode files. It does this
by compiling scripts to bytecode, or extracting the code object from
bytecode files, and then calling ``exec``.

When you call `compile
http://docs.python.org/dev/lib/built-in-funcs.html`_ you can pass in
an optional ``flags`` argument which tell Python which future
statements to compile the code with. I currently don't do this, which
means that ``from __future__ import ...`` statements are ignored.

For Python 2.4.2 the most significant of these is `division
http://www.python.org/doc/peps/pep-0238/`_. Code which expects
integer division to yield floats is just plain broken if this future
statement is ignored.

I'd like to fix this in the next release of **Movable Python**.

First of all, I *assume* that the code objects contained in bytecode
files are already compiled with the relevant future statements. This
would mean that no further action is necessary. Can anyone confirm if
this is correct ? [#]_

For Python scripts there are a couple of possible approaches.

The simplest approach would be to use a simple regular expression to
find statements that look like
``from __future__ ...``. Unfortunately this could score false positives
for comments and docstrings. [#]_

Another alternative would be to parse the code into an abstract syntax
tree using the `compiler module
http://docs.python.org/lib/module-compiler.html`_. I would then have
to recognise the import statements in the nodes. I can see that there
is an `Import node
http://docs.python.org/lib/module-compiler.ast.html`_ does anyone
have any hints for me with this approach ? I would prefer a solution
that works across Python versions 2.2 to 2.5 and beyond.

Ominously, the ``compile.compile`` function has unsupported options for
passing in ``flags``, so it looks like it doesn't handle it
automatically from the parse tree.

.. [#] It will actually be easy enough to test.
.. [#] Future statements shuld only occur at the toplevel of code, and
in fact ought to occur before any other statements (although that was
broken in Python 2.4), so it ought to be possible to minimize false
positives a bit.

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


Re: String comparison question

2006-03-20 Thread luc . saffre
Michael Spencer wrote:
 Olivier Langlois wrote:

  I would like to make a string comparison that would return true without
  regards of the number of spaces and new lines chars between the words
 
  like 'A   B\nC' = 'A\nBC'

Here is how I do such comparisons:

  if a.strip().split() == b.strip().split()

Luc

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


Re: Ink

2006-03-20 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 Sorry guys.  The spam stuff was not my intent.  I do oppoligies and won't
 happen again.  I have never been on newsgroups before and not sure how to
 work them. I hope you guys can forgive a bad choice.  Murphey

A gracious apology wipes out the sin.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

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


Re: cmp() on integers - is there guarantee of returning only +-1 or 0?

2006-03-20 Thread Paul Rubin
Christoph Zwerschke [EMAIL PROTECTED] writes:
 def sign(x): return (x0)-(x0)

Cute, I'll try to remember that one.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: String comparison question

2006-03-20 Thread Peter Otten
[EMAIL PROTECTED] wrote:

 Michael Spencer wrote:
 Olivier Langlois wrote:

  I would like to make a string comparison that would return true without
  regards of the number of spaces and new lines chars between the words
 
  like 'A   B\nC' = 'A\nBC'
 
 Here is how I do such comparisons:
 
   if a.strip().split() == b.strip().split()

The strip() is not necessary:

  a b c\n  .split() == a b c.split()
True

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


Re: Is there such an idiom?

2006-03-20 Thread Bruce Cropley

Per wrote:
 http://jaynes.colorado.edu/PythonIdioms.html
[snip]

 Is this correct?
 s = [1,2,3,4,5...]
 t = [4,5,6,,8,...]
 how to find whether there is/are common item(s) between two list in
 linear-time?
 how to find the number of common items between two list in linear-time?

A common technique if both lists are sorted is to iterate through both
lists in parallel, advancing the smaller iterator each time. This is
the merge algorithm that is used by a merge sort, and it is O(s+t).

For two lists, the algorithm would go something like:

while not finished:
if s_iter_val  t_iter_val:
move s_iter on
elif s_iter_val  t_iter_val:
move t_iter on
else:
include / yield the value
move both iters on

For more on the standard merge algorithm, see:
http://en.wikipedia.org/wiki/Merge_algorithm

For an intersection merge, I hacked the recursive solution from
there...

def merge(a, b):
if len(a) == 0: return []
if len(b) == 0: return []
if a[0]  b[0]:   return merge(a[1:], b)
elif a[0]  b[0]: return merge(a, b[1:])
else: return a[0:1] + merge(a[1:], b[1:])

#-8-
import unittest

class TestMerge(unittest.TestCase):
def test_merge(self):
self.assertEquals(merge([1,2],[]), [])
self.assertEquals(merge([],[1,2]), [])
self.assertEquals(merge([1,3,5],[2,4,6]), [])
self.assertEquals(merge([1,2,3],[3,4,5]), [3])
self.assertEquals(merge([1,2,3,5,6,7],[3,4,5,7,8]), [3,5,7])

if __name__ == __main__:
unittest.main()


HTH,
Bruce

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


Dr. Dobb's Python-URL! - weekly Python news and links (Mar 20)

2006-03-20 Thread Peter Otten
QOTW:  Anything with 'Python' in its name can't market Python
well. - Iain Bicking

Who really cares whether NASA uses Python? One thing I learned from
having to sit through too many software marketing presentations is
that organizations like NASA are to software what the Library of
Congress is to books. - Steven Lumos on comp.lang.ruby


How would you compare two strings when you don't care about
whitespace? Hint: no regular expressions needed.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/2ad8fae9cc32e333/b4dc3a17d7502391

Jarek Zgoda's hack seems to be the most reliable way to get localized
month names.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/7d8e318b9b27a460/8b8283877bc02aa1?tvc=1

Python 2.5 is scheduled for August 19, 2006. Among the highlights are
the with-statement simplifying reliable resource acquisition/release
and Fredrik Lundh's ElementTree. When bugs due to clever workarounds
made it into the standard library Guido finally gave in, so there will
be an inline-if/else, too. Use with discretion :-)
http://groups.google.com/group/comp.lang.python/msg/f6f95174484c24cc

Experienced developers wrestle with thorny deployment issues.
 http://blog.ianbicking.org/packaging-python.html

Is coding a text adventure? Matt Webb and his co-developers think so.
They use Python as the tried and tested tool to explore new ideas.
http://www.wired.com/news/technology/0,70413-0.html?tw=wn_technology_4

Iain Bicking shares his thoughts about the new python.org website and
marketing Python.
http://blog.ianbicking.org/python-marketing-2006.html

You don't always need a big fat office suite to get your data out of
an Excel spreadsheet. 

http://groups.google.com/group/comp.lang.python/browse_frm/thread/af8f5484123101ae/fd7fb0d4d894dce2?tvc=1

Stackless Python has been ported to Python 2.4.2.
http://www.stackless.com/Members/rmtew/pycon2006Result



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance. 
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Although unmaintained since 2002, the Cetus collection of Python
hyperlinks retains a few gems.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a 

Re: Chained Comparisons

2006-03-20 Thread Fredrik Lundh
Duncan Booth wrote:

 2) A search in the same document you are reading takes you off and
 adrift, and as such, is equivalant to a task-switch, because you're
 already reading some material from the same help file and are stuck at
 some point.

 I've tried reading this several times and can't make sense of what you are
 trying to say?

that Sathyaish's time is more important than your time, of course.

/F 



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


Re: Pycrypto - active ??

2006-03-20 Thread Frank Millman

dirvine wrote:
 Thanks Paul

 I will check this out. Perhaps theres a case for pycrypto to be
 revamped and perhaps a new python cryptographic page to be created
 mentioning all these projects. I have foudn it a bit difficult to find
 info on this area. Mny thanks for this though.

Just as a BTW -

I have recently installed TLSLite on linux and on MSW, and it seems to
work fine

The docs say that if you have any of m2crypto, cryptlib, pycrypto, or
GMPY installed, it will be used for fast cryptographic operations. I
installed M2Crypto on linux, and indeed, after the initial handshake,
there is hardly any noticeable slowdown.

However, I have not found an MSW binary for Python 2.4 for any of the
above packages. TLSLite works ok by itself, but it is noticeably slower
when transferring large amounts of data.

Frank Millman

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


Re: String comparison question

2006-03-20 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

  I would like to make a string comparison that would return true without
  regards of the number of spaces and new lines chars between the words
 
  like 'A   B\nC' = 'A\nBC'

 Here is how I do such comparisons:

  if a.strip().split() == b.strip().split()

clever solution (I was about to post a split/join solution, but the join is of 
course
meaningless), but the strip() isn't necessary: the default version of split 
already
removes leading and trailing whitespace:

  hello world .split()
['hello', 'world']

  hello world .split(None)
['hello', 'world']
  hello world .split( )
['', 'hello', 'world', '']

/F 



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


Bug Day on Friday, 31st of March

2006-03-20 Thread Georg Brandl
Hello,

it's time for the 7th Python Bug Day. The aim of the bug day is to close
as many bugs, patches and feature requests as possible, this time with a
special focus on new features that can still go into the upcoming 2.5 alpha
release.

When?
^

The bug day will take place on Friday, March 31st, running from
1PM to 7PM GMT (9AM to 3PM Eastern time). You don't need to be around all day;
feel free to stop by for a few hours and contribute.

Where and How?
^^

To join, stop by the IRC channel #python-dev on irc.freenode.net, where
efforts will be discussed and coordinated. We'll collaboratively go through
the Python bug database at SourceForge and fix things as they come up.

IMPORTANT: *No* prior knowledge of the Python source is necessary to
participate! You'll get all assistance the developers can offer for starting
up with helping, this is in fact a good opportunity to learn the basics.

Bug day participation helps the developers and makes Python 2.5 a better
release by reducing the backlog of bugs and patches.  Plus, it's fun!

More information


For instructions and more information, see the Wiki page at
http://www.python.org/cgi-bin/moinmoin/PythonBugDay


Cheers,
Georg

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


Re: ANNOUNCE: xlrd 0.5.2 -- extract data from Excel spreadsheets

2006-03-20 Thread Felipe Almeida Lessa
Em Seg, 2006-03-20 às 23:01 +1100, John Machin escreveu:
 *ALL* [ho ho chuckle chuckle] 
 you need to do is step through the tokens and do something with the ones 
 that contain references.

And contribute back the code? =)

-- 
Felipe.

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

Dr. Dobb's Python-URL! - weekly Python news and links (Mar 20)

2006-03-20 Thread Peter Otten
QOTW:  Anything with 'Python' in its name can't market Python
well. - Iain Bicking

Who really cares whether NASA uses Python? One thing I learned from
having to sit through too many software marketing presentations is
that organizations like NASA are to software what the Library of
Congress is to books. - Steven Lumos on comp.lang.ruby


How would you compare two strings when you don't care about
whitespace? Hint: no regular expressions needed.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/2ad8fae9cc32e333/b4dc3a17d7502391

Jarek Zgoda's hack seems to be the most reliable way to get localized
month names.

http://groups.google.com/group/comp.lang.python/browse_frm/thread/7d8e318b9b27a460/8b8283877bc02aa1?tvc=1

Python 2.5 is scheduled for August 19, 2006. Among the highlights are
the with-statement simplifying reliable resource acquisition/release
and Fredrik Lundh's ElementTree. When bugs due to clever workarounds
made it into the standard library Guido finally gave in, so there will
be an inline-if/else, too. Use with discretion :-)
http://groups.google.com/group/comp.lang.python/msg/f6f95174484c24cc

Experienced developers wrestle with thorny deployment issues.
 http://blog.ianbicking.org/packaging-python.html

Is coding a text adventure? Matt Webb and his co-developers think so.
They use Python as the tried and tested tool to explore new ideas.
http://www.wired.com/news/technology/0,70413-0.html?tw=wn_technology_4

Iain Bicking shares his thoughts about the new python.org website and
marketing Python.
http://blog.ianbicking.org/python-marketing-2006.html

You don't always need a big fat office suite to get your data out of
an Excel spreadsheet. 

http://groups.google.com/group/comp.lang.python/browse_frm/thread/af8f5484123101ae/fd7fb0d4d894dce2?tvc=1

Stackless Python has been ported to Python 2.4.2.
http://www.stackless.com/Members/rmtew/pycon2006Result



Everything Python-related you want is probably one or two clicks away in
these pages:

Python.org's Python Language Website is the traditional
center of Pythonia
http://www.python.org
Notice especially the master FAQ
http://www.python.org/doc/FAQ.html

PythonWare complements the digest you're reading with the
marvelous daily python url
 http://www.pythonware.com/daily  
Mygale is a news-gathering webcrawler that specializes in (new)
World-Wide Web articles related to Python.
 http://www.awaretek.com/nowak/mygale.html 
While cosmetically similar, Mygale and the Daily Python-URL
are utterly different in their technologies and generally in
their results.

For far, FAR more Python reading than any one mind should
absorb, much of it quite interesting, several pages index
much of the universe of Pybloggers.
http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog
http://www.planetpython.org/
http://mechanicalcat.net/pyblagg.html

comp.lang.python.announce announces new Python software.  Be
sure to scan this newsgroup weekly.

http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce

Steve Bethard, Tim Lesher, and Tony Meyer continue the marvelous
tradition early borne by Andrew Kuchling, Michael Hudson and Brett
Cannon of intelligently summarizing action on the python-dev mailing
list once every other week.
http://www.python.org/dev/summary/

The Python Package Index catalogues packages.
http://www.python.org/pypi/

The somewhat older Vaults of Parnassus ambitiously collects references
to all sorts of Python resources.
http://www.vex.net/~x/parnassus/   

Much of Python's real work takes place on Special-Interest Group
mailing lists
http://www.python.org/sigs/

Python Success Stories--from air-traffic control to on-line
match-making--can inspire you or decision-makers to whom you're
subject with a vision of what the language makes practical.
http://www.pythonology.com/success

The Python Software Foundation (PSF) has replaced the Python
Consortium as an independent nexus of activity.  It has official
responsibility for Python's development and maintenance. 
http://www.python.org/psf/
Among the ways you can support PSF is with a donation.
http://www.python.org/psf/donate.html

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Although unmaintained since 2002, the Cetus collection of Python
hyperlinks retains a few gems.
http://www.cetus-links.org/oo_python.html

Python FAQTS
http://python.faqts.com/

The Cookbook is a 

Re: ** Operator

2006-03-20 Thread Ziga Seilnacht

Christoph Zwerschke wrote:
 Alex Martelli wrote:
  Sathyaish wrote:
 
  I tried it on the interpreter and it looks like it is the to the power
  of operator symbol/function. Can you please point me to the formal
  definition of this operator in the docs?
 
  http://docs.python.org/ref/power.html

 I think this should be also mentioned in the Built-In Functions section
 of the Library Reference. Probably most users do not read the Language
 Reference (since the main menu says it's for language lawyers and yes,
 it is not really fun to read).

 In the explanation about pow() at
 http://docs.python.org/lib/built-in-funcs.html, the notation 10**2 is
 suddenly used, without explaining that it is equivalent to pow(10,2). I
 think this could be improved in the docs.

 -- Christoph

It is:
http://docs.python.org/lib/typesnumeric.html

Ziga

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


Re: combining mod_python handlers publisher and psp problem

2006-03-20 Thread exhuma.twn

[EMAIL PROTECTED] wrote:
 You could also have done:

def index(req, name='John'):
   s = 'Hello, there!'
   if name:
  names = ['a', 'b', 'c']
  s = 'Hello, %s!' % name.capitalize()
  tmpl = psp.PSP(req, filename='index.psp')
  req.content_type = 'text/html'
  tmpl.run(vars = { 'greet': s, 'names': names })
   return

 Try the mod_python mailing list if you want an explaination of why.
 
 Graham

Thanks, that worked.

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


Re: mod_python + publisher + psp + session problems

2006-03-20 Thread exhuma.twn

[EMAIL PROTECTED] wrote:
 exhuma.twn wrote:
  Hi again,
 
  as soon as I try to make use of the session object inside a
  psp-template file, I get the following error:
 
  Mod_python error: PythonHandler mod_python.publisher
 
  Traceback (most recent call last):
 
File /usr/lib/python2.4/site-packages/mod_python/apache.py, line
  299, in HandlerDispatch
  result = object(req)
 
File /usr/lib/python2.4/site-packages/mod_python/publisher.py, line
  143, in handler
  result = str(result)
 
File /usr/lib/python2.4/site-packages/mod_python/psp.py, line 228,
  in __str__
  self.run()
 
File /usr/lib/python2.4/site-packages/mod_python/psp.py, line 191,
  in run
  session = Session.Session(req)
 
File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
  389, in Session
  timeout=timeout, lock=lock)
 
File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
  294, in __init__
  timeout=timeout, lock=lock)
 
File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
  132, in __init__
  Cookie.add_cookie(self._req, self.make_cookie())
 
File /usr/lib/python2.4/site-packages/mod_python/Session.py, line
  160, in make_cookie
  c.path = dirpath[len(docroot):]
 
  TypeError: unsubscriptable object
 
  Any ideas?

 Upgrade to mod_python 3.2.8 and your problem will go away.

 See:

   http://issues.apache.org/jira/browse/MODPYTHON-50

 I suggest that in future you use the mod_python mailing list for
 questions
 as that is where most knowledgeable people on mod_python hang out.
 
 Graham

Thanks a lot Graham. This solved the problem.

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


Re: Python equivalent of Perl-ISAPI?

2006-03-20 Thread rurpy

Waldemar Osuch wrote:
 What Roger says and also:
 http://pyisapie.sourceforge.net/

Thanks for your and Roger's responses.

I looked at pyisapie and there seems to be almost no
dvcumentation -- no sample code and the single readme
is pretty opaque.The pywin isapi has a couple of
examples but its documentation too is pretty bad.
But they both seem to be tissue thin wtrappers around
the MS isapi api.  What I was hoping for is something
that would let me run existing cgi scripts efficiently with
minimal changes.  I think the isapi and perl-ex stuff that
comes with Activestate's Perl meets this requirement
but the stuff I've found for Python doesn't.  So looks
like it's back to Perl for this project :-(.

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


Re: Esub with linux - possible?

2006-03-20 Thread Thrasher Remailer
On Mon, 20 Mar 2006 14:09:52 +, Thrasher Remailer wrote:

 Are there any programs for linux that can use esub, or something similar,
 to encrypt/recognise a.a.m.  messages, like jbn and qs do for windows?

The message above was posted in alt.privacy.anon-server, but sounds like
it belongs here as well.

Does anyone know of a python program to do what the OP is asking?

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


Re: mydate.strftime('%x') and cgi script

2006-03-20 Thread Sibylle Koczian
Marc 'BlackJack' Rintsch schrieb:
 In [EMAIL PROTECTED], Sibylle Koczian wrote:
 
 
I'm writing a cgi script which only needs to run in a small LAN. I tried
to show dates in a reasonable format by using

 
 That's the web server's locale appropriate date representation then.
 

The web server is on my machine - doesn't it use its regional settings?
I've seen a little more in the meantime:

xx = locale.setlocale(locale.LC_ALL, '')

# print HTML header, title, everything up to and including body tag

print xx

# print rest of page

In the cgi script xx is C and not de_DE.utf-8. Looks as if setlocale
isn't executed.

If I do the same things using Windows instead of Linux, setlocale is
executed in the cgi script, no difference to the interactive interpreter.

Koczian

-- 
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg
e-mail : [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Multifile EOF error

2006-03-20 Thread [EMAIL PROTECTED]
Hi,

I had error in my script like sudden EOF in MultiFile readline()
Why such error occur

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


Win32 ActiveX with COM support

2006-03-20 Thread danbrwn
I am creating a web application where I access a database on a SQL
server machine from local networked PC's via Javascript and HTML.
Unfortunately, Microsoft does not allow the ado intervace to fire
events back using Javascript or VBScript. I am trying to figure out how
to notifiy each client that is connected to the server whenever the
database changes. What I think might work well is to have a client
activeX component built with Python embedded in the html page that
receives event notification from a server component embedded in an ASP
page or maybe an HTML I don't know yet. At any rate, Can I create a COM
server / client component set with Python?

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


Win32 ActiveX with COM support

2006-03-20 Thread danbrwn
I am creating a web application where I access a database on a SQL
server machine from local networked PC's via Javascript and HTML.
Unfortunately, Microsoft does not allow the ado intervace to fire
events back using Javascript or VBScript. I am trying to figure out how
to notifiy each client that is connected to the server whenever the
database changes. What I think might work well is to have a client
activeX component built with Python embedded in the html page that
receives event notification from a server component embedded in an ASP
page or maybe an HTML I don't know yet. At any rate, Can I create a COM
server / client component set with Python?

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


Re: Python equivalent of Perl-ISAPI?

2006-03-20 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 Waldemar Osuch wrote:
 
What Roger says and also:
http://pyisapie.sourceforge.net/
 
 
 Thanks for your and Roger's responses.
 
 I looked at pyisapie and there seems to be almost no
 dvcumentation -- no sample code and the single readme
 is pretty opaque.The pywin isapi has a couple of
 examples but its documentation too is pretty bad.
 But they both seem to be tissue thin wtrappers around
 the MS isapi api.  What I was hoping for is something
 that would let me run existing cgi scripts efficiently with
 minimal changes.  I think the isapi and perl-ex stuff that
 comes with Activestate's Perl meets this requirement
 but the stuff I've found for Python doesn't.  So looks
 like it's back to Perl for this project :-(.
 
If you want CGI then there's no need for an ISAPI filter specific to 
your programming language - you just need to associate .py requests with 
the Python interpreter.

If you want to use Python as an Active Scripting language (i.e. in the 
same way that VBScript is used) then you can do this by installing the 
win32all extensions maintained by Mark Hammond and enabling Active 
Scripting therein.

Don't suffer Perl if you don't want to!

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

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


Re: Python 2.5 Schedule

2006-03-20 Thread Don Taylor
Ravi Teja wrote:
 http://msdn.microsoft.com/visualc/vctoolkit2003/
 Free.
 
True, but 'The Microsoft Toolkit Compiler doesn't come out-of-the-box 
with everything you need to compile extensions.'  see:

http://www.vrplumber.com/programming/mstoolkit/

If you are going ahead with the VC 7.1 Toolkit compiler then is 
distutils going be modified to support it?

Do you think that the 7.1 toolkit compiler will be available a year from 
now?  MS could replace it with a VC 8.0 version of the toolkit compiler.

Don.

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


IMAP Checking Folder Size

2006-03-20 Thread Kevin F
I'm trying to use the following code to get my remote server's folder 
size information.  Unfortunately, i'm getting the error:



Traceback (most recent call last):
   File /Life/School/Homework/Spring 2006/OPIM 
399/Tutorial/IMAP/mailboxsize.py, line 23, in -toplevel-
 number_of_messages_all += int(number_of_messages[0])
ValueError: invalid literal for int(): The requested item could not be 
found.




What seems to be the problem?

My code is here:




import sys, os, string, imaplib, getpass

imap_server = webmail.x.x.edu

# Open a connection to the IMAP server
M = imaplib.IMAP4_SSL(imap_server)
M.login('', getpass.getpass())

# The list of all folders
result,list = M.list()

print %-30s%5s%10s\n % (Folder, # Msg, Size)

number_of_messages_all = 0
size_all = 0

for item in list[:]:
 x = item.split()
 mailbox = string.join(x[2:])

 # Select the desired folder
 result, number_of_messages  = M.select(mailbox, readonly=1)
 number_of_messages_all += int(number_of_messages[0])

 size_folder = 0
 # Go through all the messages in the selected folder
 typ, msg = M.search(None, 'ALL')
 # Find the first and last messages
 m = [int(x) for x in msg[0].split()]
 m.sort()
 if m:
 message_set = %d:%d % (m[0], m[-1])
 result, sizes_response = M.fetch(message_set, (UID RFC822.SIZE))
 for i in range(m[-1]):
 tmp = sizes_response[i].split()
 size_folder += int(tmp[-1].replace(')', ''))
 else:
 size_folder = 0
 print %-30s%5d%10s % (mailbox, int(number_of_messages[0]), 
size_folder);
 size_all += size_folder

print \n%-30s%5i%10.3f MB\n % (Sum, number_of_messages_all, 
size_all/1e6)

# Close the connection
M.logout()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ** Operator

2006-03-20 Thread Christoph Zwerschke
Ziga Seilnacht wrote:
 Christoph Zwerschke wrote:
 In the explanation about pow() at
 http://docs.python.org/lib/built-in-funcs.html, the notation 10**2 is
 suddenly used, without explaining that it is equivalent to pow(10,2). I
 think this could be improved in the docs.

 It is:
 http://docs.python.org/lib/typesnumeric.html

You're right, it's mentioned there in section 2.3.4, but the explanation 
of pow() is already in section 2.1 prior to that.

So it would be nice if the paragraph explaining pow() would mention that 
you can also write x**y for pow(x,y). And/or the example given in the 
paragraph should say pow(10,2) instead of 10**2. Otherwise it's a bit 
confusing for somebody who reads in chronological order and doesn't know 
about the ** syntax (many other languages write x^y instead of x**y).

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


Re: IMAP Checking Folder Size

2006-03-20 Thread Tim Williams (gmail)
On 20/03/06, Kevin F [EMAIL PROTECTED] wrote:
Traceback (most recent call last): File /Life/School/
Homework/Spring 2006/OPIM399/Tutorial/IMAP/mailboxsize.py, line 23, in -toplevel-
 number_of_messages_all += int(number_of_messages[0])ValueError: invalid literal for int(): The requested item could not be
found.
See the answer(s) to your previous post.

 File /Life/School/Homework/Spring 2006/OPIM

However, seeing as this is homework, its unlikely you'll get the fix, just pointers to where your mistakes are. :)

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

Re: Pycrypto - active ??

2006-03-20 Thread Alex Martelli
Frank Millman [EMAIL PROTECTED] wrote:
   ...
 The docs say that if you have any of m2crypto, cryptlib, pycrypto, or
 GMPY installed, it will be used for fast cryptographic operations. I
   ...
 However, I have not found an MSW binary for Python 2.4 for any of the
 above packages. TLSLite works ok by itself, but it is noticeably slower
 when transferring large amounts of data.

There are several Windows binaries of GMPY for 2.4 on sourceforge.net,
optimized for different intel and AMD processors.  Since gmpy.sf.net is
gmpy's home, I don't understand what you mean by have not found.


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


Re: markup.py - HTML/XML generator

2006-03-20 Thread Daniel Nogradi
  Just in case the thought of not having a millionth implementation of a
  HTML/XML generator for Python makes the world as we know it a
  miserable place, well then your suffering might be over soon since
  exactly the one millionth implementation is out. You can download
  markup.py from
 
  http://markup.sourceforge.net/
 

 (Corrected the link).

 You opened a door I was pushing!

 I wrote a HTML generator a few weeks ago to generate a static site, but
 it was only a little less tortuous to use than writing out the HTML by
 hand.  I wanted to do things the way  'markup.py' does but couldn't
 manage it. Then I read your code, added straightforward '__getattr__'
 and '__call__' methods to my own code, and now I need only half the
 'LOC' that I did before.

 Before I did this:

 page = HtmlPage('Test Page')
 left_div = page.append( HtmlElement('div', id='left') )
 main_div = page.append( HtmlElement('div', id='main') )
 navbar = HtmlElement('ul', css='navbar')
 for href,link in {'/home':'Home', '/shop':'Shop',
 '/cart':'Cart'}.iteritems():
 li = navbar.append( HtmlElement('li') )
 li.append( HtmlElement('a',link, href=href) )
 left_div.append(navbar)
 main_div.append( HtmlElement('h1','Header') )
 main_div.append( HtmlElement('p','Text Goes Here') )

 Now I can do this:

 page = HtmlPage('Test Page')
 navbar = page.div(id='left').ul(css='navbar')
 for href,link in {'/home':'Home', '/shop':'Shop',
 '/cart':'Cart'}.iteritems():
 navbar.li.a(link,href=href)
 page.div(id='main').h1('Header').p('Text Goes Here')


 So *that's* what '__call__' does - I am enlightened!

 Thanks a lot.

 Here's mine:

 http://www.gflanagan.net/site/python/htmlbuilder/htmlbuilder.py

 (So, 'More than one million ways to do it' then...)

 Gerard


Well, I'm glad you like it! And thanks for correcting the link, I
didn't even notice, so the correct link is

http://markup.sourceforge.net/

But I guess that was pretty obvious :) Your implementation also looks
all right, the only thing is that it has dependencies outside the
stdlib which some people might find not so nice.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pycrypto - active ??

2006-03-20 Thread Thomas G. Willis
On 19 Mar 2006 13:39:58 -0800, dirvine [EMAIL PROTECTED] wrote:
Does anyone know if pycrypto is active at allThis was one of the packages that was updated today on my gentoo box. so, I would say yes.-- Thomas G. Willis---
http://i-see-sound.comhttp://tomwillis.sonicdiscord.comAmerica, still more rights than North Korea
-- 
http://mail.python.org/mailman/listinfo/python-list

what's the general way of separating classes?

2006-03-20 Thread John Salerno
 From my brief experience with C#, I learned that it was pretty standard 
practice to put each class in a separate file. I assume this is a 
benefit of a compiled language that the files can then be grouped together.

What I'm wondering is how is this normally handled in Python? Is it 
normal for classes to be put in separate modules? It seems like this can 
get out of hand, since modules are separate from one another and not 
compiled together. You'd end up with a lot of import statements.

Are related classes put into a single module then? Or is there some 
recommended method for how to handle this?

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


Re: what's the general way of separating classes?

2006-03-20 Thread Felipe Almeida Lessa
Em Seg, 2006-03-20 às 15:42 +, John Salerno escreveu:
 Are related classes put into a single module then? Or is there some 
 recommended method for how to handle this?

IMHO, if they can be put on the same file without creating a huge one
(3000+ lines), then do it. If you can't, then instead of creating a
huge:

program/module.py

You can do lots of

program/modules/*.py

And create an program/modules/__init__.py that have something like

from program.modules.class1 import class1
from program.modules.class2 import class2

And, in the rest of your program, you can import class1 and class2 by
just issuing

from program.modules import class1, class2

HTH,

-- 
Felipe.

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

Re: what's the general way of separating classes?

2006-03-20 Thread John Salerno
Felipe Almeida Lessa wrote:

 And create an program/modules/__init__.py that have something like
 
 from program.modules.class1 import class1
 from program.modules.class2 import class2

I'm not sure I understand the point of those two lines, if you are going 
to then do this:

 And, in the rest of your program, you can import class1 and class2 by
 just issuing
 
 from program.modules import class1, class2

How does the __init__ file help if you are still individually importing 
class1 and class2 in each other module of your program?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Chained Comparisons

2006-03-20 Thread Sathyaish
Thanks for the encouragement, Steve. I am learning Python out of
earnest; I am intrigued by several languages such as Ruby, Python and
Lisp.

At work, I program VB6 (used to), VB.NET, C# and C over the Win32
platform.



 that Sathyaish's time is more important than your time, of course.

LOL. Certainly didn't mean that. :-)

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


Re: what's the general way of separating classes?

2006-03-20 Thread Roy Smith
John Salerno  [EMAIL PROTECTED] wrote:
 From my brief experience with C#, I learned that it was pretty standard 
practice to put each class in a separate file. I assume this is a 
benefit of a compiled language that the files can then be grouped together.

What I'm wondering is how is this normally handled in Python? Is it 
normal for classes to be put in separate modules? It seems like this can 
get out of hand, since modules are separate from one another and not 
compiled together. You'd end up with a lot of import statements.

Are related classes put into a single module then? Or is there some 
recommended method for how to handle this?

There are two different issues here.  One is how you organize your
source code, the other is what API you expose to the user.

From the source code point of view, I will generally put a single
class in each file, but there are exceptions (no pun intended).  If
I've got a bunch of very closely related classes, especially if
they're small, I'll put more than one class in a file.  How small is
small?  There's no hard number, but anything that's got more than a
couple of methods is probably not small.  Exception classes certainly
don't get their own file; they get put in the module where they make
the most sense.

From the API point of view, just because you split your classes up
into multiple modules, doesn't mean the user has to see that
complexity.  Have one top level module which imports the others.  The
user only has to import the top level one.

There's no magic answer here.

To give you a real example, I just took a look at a recent project I
did.  I've got 8 python source files, totalling 1505 lines.  I define
14 classes, of which 7 are exception classes.  My top level module
(the one a user would import) has no classes defined in it; it imports
the other modules and has a bunch of factory functions.  I looked at
the one file that contains two real classes; one of them is
essentially an inner class and has only two methods; __init__() and
__call__(), both of which are trivial.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Chained Comparisons

2006-03-20 Thread Grant Edwards
On 2006-03-20, Sathyaish [EMAIL PROTECTED] wrote:

And firing up a news client, posting a message, and /waiting/
 for a response isn't? In most cases, you could have read half
 the language reference manual in the time it takes to get an
 online response.

 Posting a question in the newsgroup is like asking someone
 else; asking some other person to help you out and it works
 better than searching the documentation and loosing your train
 of thought.

Hell, why not just ask somebody else to do the work for you?

-- 
Grant Edwards   grante Yow!  I'm encased in the
  at   lining of a pure pork
   visi.comsausage!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what's the general way of separating classes?

2006-03-20 Thread Felipe Almeida Lessa
Em Seg, 2006-03-20 às 16:01 +, John Salerno escreveu:
 Felipe Almeida Lessa wrote:
 
  And create an program/modules/__init__.py that have something like
  
  from program.modules.class1 import class1
  from program.modules.class2 import class2
 
 I'm not sure I understand the point of those two lines, if you are going 
 to then do this:
 
  And, in the rest of your program, you can import class1 and class2 by
  just issuing
  
  from program.modules import class1, class2
 
 How does the __init__ file help if you are still individually importing 
 class1 and class2 in each other module of your program?

Ermmm... Maybe I should give a bigger example? What's better, this

from program.modules.class1 import class1
from program.modules.class2 import class2
from program.modules.class3 import class3
from program.modules.class4 import class4
from program.modules.class5 import class5
from program.modules.class6 import class6
from program.modules.class7 import class7
from program.modules.class8 import class8
from program.modules.class9 import class9
from program.modules.class10 import class10
from program.modules.class11 import class11
from program.modules.class12 import class12
from program.modules.class13 import class13
from program.modules.class14 import class14
from program.modules.class15 import class15
from program.modules.class16 import class16
from program.modules.class17 import class17
from program.modules.class18 import class18
from program.modules.class19 import class19
from program.modules.class20 import class20

or this

from program.modules import (class1,  class2,  class3,  class4, 
 class5,  class6,  class7,  class8,
 class9,  class10, class11, class12,
 class13, class14, class15, class16,
 class17, class18, class19, class20,
 class21, class22, class23, class24,
 class25, class26, class27, class28,
 class29, class30, class31, class32,
 class33, class34, class35, class36,
 class37, class38, class39, class40)

???

If you mean doing from program.modules import * of course you *can*,
but you *shouldn't*. It makes your code a mess after some time.

-- 
Felipe.

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

Re: MPI implementations

2006-03-20 Thread Konrad Hinsen
On Mar 18, 2006, at 5:04, Daniel Nogradi wrote:

 I plan to use python parallel and -- fortunately or unfortunately --
 there are several implementations. At the moment I'm aware of

 http://datamining.anu.edu.au/~ole/pypar/
 http://pympi.sourceforge.net/
 http://www.fysik.dtu.dk/~schiotz/comp/PythonAndSwig/pythonMPI.html

 and wondered if anyone had experience with any of them. Pros, cons?
 Did anyone try more than one?

Add this one:

http://dirac.cnrs-orleans.fr/ScientificPython/ScientificPythonManual/ 
Scientific_27.html

and unless you are 100% convinced that MPI is the interface you want  
to use, also check out this:

http://dirac.cnrs-orleans.fr/ScientificPython/BSP_Tutorial.pdf

PyPar and pyMPI are both high-level interfaces to MPI, i.e. they  
propose an MPI-like message passing interface with the main added  
value being communication of arbitrary Python objects. My own MPI  
interface in ScientificPython is more low-level, since it handles  
only strings and arrays. Its strong point is its C interface, which  
makes it possible to write parallelized mixed C-Python code and to  
integrate parallelized C libraries into Python projects.

My BSP interface (the second link) is what I personally consider the  
most convenient interface for parallel programming in Python. It is  
built on the BSP (Bulk Synchronous Processing) model that works at a  
higher level than message passing: the programmer does not have to  
worry about synchronization, which is a major source of hard-to-track- 
down bugs.

Konrad.
--
-
Konrad Hinsen
Laboratoire Léon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: [EMAIL PROTECTED]
-


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


Re: Question about csv writer

2006-03-20 Thread Paul McGuire
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I expected the following code to work:

 f = file(fn,wb)
 writer = csv.writer(f)
 for i in range(IMax):
  writer.writerow([dates[i]].append([ReturnHistories[j][i] for j in
 range(N)]))

 but instead i got the following error message:
 Error: sequence expected


Probably because append returns None, not the list you just appended to.

Also, it appears that your append statement is not doing what you want,
appending to [dates[i]] (that is, a temporary list containing a single
element, the list that is the i'th element of dates), when your working
example appends directly to dates[i].

Sometimes (usually?) an explicit body of 2 or 3 statements is better than
trying to cram everything into a one-liner...

-- Paul


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


Re: ** Operator

2006-03-20 Thread Kent Johnson
Christoph Zwerschke wrote:
http://docs.python.org/lib/typesnumeric.html
 
 You're right, it's mentioned there in section 2.3.4, but the explanation 
 of pow() is already in section 2.1 prior to that.
 
 So it would be nice if the paragraph explaining pow() would mention that 
 you can also write x**y for pow(x,y). And/or the example given in the 
 paragraph should say pow(10,2) instead of 10**2. Otherwise it's a bit 
 confusing for somebody who reads in chronological order and doesn't know 
 about the ** syntax (many other languages write x^y instead of x**y).

The way to make this change happen is to submit a bug report with your 
suggested change. See the link at the bottom of the above page to find 
out how.

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


Re: __dict__ strangeness

2006-03-20 Thread Alan Franzoni
Georg Brandl on comp.lang.python said: 

 It's 2.4.2, on Linux. The 2.5 SVN trunk has the same symptom.

Yes, I confirm this. I think I had done something strange on my system
(probably misspelled something).

-- 
Alan Franzoni [EMAIL PROTECTED]
-
Togli .xyz dalla mia email per contattarmi.
Rremove .xyz from my address in order to contact me.
-
GPG Key Fingerprint:
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-20 Thread Mark Tarver
Hi,

You wrote into the Qilang News group with your problem.
This is a solution in 17 lines of Qi for any n-product = 2.
It falls short of your complete requirement since it uses
generate and then test, rather than interleaving the
two.

(define challenge
   Patterns N X - (filter (/. Y (member Y Patterns)) (n-product N X)))

(define n-product
2 X - (cartesian-product l X X)
N X - (cartesian-product c X (n-product (- N 1) X)))

(define cartesian-product
   _ [ ] _ - [ ]
   c [X | Y] Z - (append (map (/. W [X | W]) Z) (cartesian-product c Y
Z))
   l  [X | Y] Z - (append (map (/. W [X W]) Z) (cartesian-product l Y
Z)))

(define filter
_ [] - []
F [X | Y] - (filter F Y)   where (F X)
F [X | Y] - [X | (filter F Y)])

(define member
_ [] - false
X [Pattern | _]  - truewhere (query-prolog [[= Pattern X]])
X [_ | Patterns] - (member X Patterns))

Notes:

Pattern filtering is done by a unification test within the member
function.  You
can do this most easily by calling Qi Prolog using query-prolog.
Here's a test.

(42 -) (n-product 3 [a b c])
[[a a a] [a a b] [a a c] [a b a] [a b b] [a b c] [a c a] [a c b] [a c
c]
 [b a a] [b a b] [b a c] [b b a] [b b b] [b b c] [b c a] [b c b] [b c
c]
 [c a a] [c a b] [c a c] [c b a] [c b b] [c b c] [c c a] [c c b] [c c
c]]

OK, remove all lists beginning [a a ].

(43-) (challenge [[a a | X]] 3 [a b c])
[[a b a] [a b b] [a b c] [a c a] [a c b] [a c c] [b a a] [b a b] [b a
c]
 [b b a] [b b b] [b b c] [b c a] [b c b] [b c c] [c a a] [c a b] [c a
c]
 [c b a] [c b b] [c b c] [c c a] [c c b] [c c c]]

Remove all lists beginning with a or b.

(51-) (challenge [[a | X] [b | X]] 3 [a b c])
[[c a a] [c a b] [c a c] [c b a] [c b b] [c b c] [c c a] [c c b] [c c
c]]

Mark

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


Re: Python / glade fundamentals

2006-03-20 Thread Franck Pommereau
 maybe you will find it easyer to use GladeGen to generate the
 skeleton of your application rather then coding it yourself. Take a
 look here: http://www.linuxjournal.com/article/7421

You may also use my PyGG module: http://freshmeat.net/projects/pygg

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


New-style Python icons

2006-03-20 Thread and-google
Personally, I *like* the new website look, and I'm glad to see Python
having a proper logo at last!

I've taken the opportunity to knock up some icons using it, finally
banishing the poor old standard-VGA-palette snake from my desktop. If
you like, you can grab them from:

  http://www.doxdesk.com/img/software/py/icons.zip

in .ICO format for Windows - containing all resolutions/depths up to
and including Windows Vista's crazy new enormo-icons. Also contains the
vector graphics source file in Xara format. You can also see a preview
here:

  http://www.doxdesk.com/img/software/py/icons.png

-- 
And Clover
mailto:[EMAIL PROTECTED]
http://www.doxdesk.com/

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


Re: New-style Python icons

2006-03-20 Thread Steve Holden
[EMAIL PROTECTED] wrote:
 Personally, I *like* the new website look, and I'm glad to see Python
 having a proper logo at last!
 
 I've taken the opportunity to knock up some icons using it, finally
 banishing the poor old standard-VGA-palette snake from my desktop. If
 you like, you can grab them from:
 
   http://www.doxdesk.com/img/software/py/icons.zip
 
 in .ICO format for Windows - containing all resolutions/depths up to
 and including Windows Vista's crazy new enormo-icons. Also contains the
 vector graphics source file in Xara format. You can also see a preview
 here:
 
   http://www.doxdesk.com/img/software/py/icons.png
 
Nice job!

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

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


Re: Python / glade fundamentals

2006-03-20 Thread Ido Yehieli
Franck:
PyGG seems pretty cool, thanks for the link!

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


Re: whats your favourite object relational mapper?

2006-03-20 Thread Steve Holden
Jonathan Ellis wrote:
 Giovanni Bajo wrote:
 
Jonathan Ellis wrote:


... which, of course, goes to show how stupid a metric this is, now
that even Ian Bicking has admitted that SqlObject in its current form
is a dead end.


Got a pointer?
 
 
 http://blog.ianbicking.org/sqlobject-2.html
 
I think describing this as Ian saying the code in its current form is a 
dead end is to read rather more into the words than is actually there. 
I spoke to Ian, because he made the blog entry the same day as I was 
using SQLObject as an ORM exemplar in my Using Databases in Python 
tutorial, and I wanted a few words of reassurance.

You will find as SQLObject 2 appears that it's more of a refactoring 
than a complete revision. I suspect the maintenance of the code had 
become tedious because it had slowly morphed into a less-than-ideal form 
for its fully-developed functionality.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com

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


user-supplied locals dict for function execution?

2006-03-20 Thread Lonnie Princehouse
Can anyone think of a way to substitute a user-supplied dictionary as
the local dict for a function call?

e.g.

def f():
   x = 5

d = {}

exec_function_in_dictionary( f, d )  # ???

print d[x]  #  5


#--

Right now, the way I'm doing this is to parse the function body out of
its source code and call exec on the body.  This has problems ---
notably that it only works on functions for which source code can be
found, also that the parsing is tricky (but I can fix that).

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


Re: New-style Python icons

2006-03-20 Thread Scott David Daniels
[EMAIL PROTECTED] wrote:
  announcing new web-site based Windows icons
 You can also see a preview here:
   http://www.doxdesk.com/img/software/py/icons.png

Maybe you could change the ink color to better distinguish
the pycon and pyc icons.

-- 
-Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python equivalent of Perl-ISAPI?

2006-03-20 Thread rurpy

Steve Holden wrote:
 If you want CGI then there's no need for an ISAPI filter specific to
 your programming language - you just need to associate .py requests with
 the Python interpreter.

 If you want to use Python as an Active Scripting language (i.e. in the
 same way that VBScript is used) then you can do this by installing the
 win32all extensions maintained by Mark Hammond and enabling Active
 Scripting therein.

 Don't suffer Perl if you don't want to!

Pure cgi is too slow.  Active Scripting means ASP, yes?
I need something that will do cgi scripts (a lot of which I already
have
and can modify but don't want to rewrite extensively, partly because
of time issues, partly because I want to preserve some degree of
portability back to a unix environment.).   I want something that does
for IIS what mod_python does for apache.  Fastcgi looked scary even
on unix plaforms, seems like an act of desperation on Windows,

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


  1   2   3   >