IPython 0.7.3 is out

2006-12-20 Thread Ville Vainio
Hi all,

The IPython team is happy to release version 0.7.3, with a lot of new
enhancements, as well as many bug fixes (including full Python 2.5
support).

We hope you all enjoy it, and please report any problems as usual.


WHAT is IPython?


1. An interactive shell superior to Python's default. IPython has many
features for object introspection, system shell access, and its own
special
command system for adding functionality when working interactively.

2. An embeddable, ready to use interpreter for your own programs.
IPython can
be started with a single call from inside another program, providing
access to
the current namespace.

3. A flexible framework which can be used as the base environment for
other
systems with Python as the underlying language.

4. A shell for interactive usage of threaded graphical toolkits.
IPython has
support for interactive, non-blocking control of GTK, Qt and WX
applications
via special threading flags. The normal Python shell can only do this
for
Tkinter applications.


Where to get it
---

IPython's homepage is at:

http://ipython.scipy.org

and downloads are at:

http://ipython.scipy.org/dist

We've provided:

  - Source download (.tar.gz)
  - A Python Egg
(http://peak.telecommunity.com/DevCenter/PythonEggs).
  - A native win32 installer.

We note that IPython is now officially part of most major Linux and BSD
distributions, so packages for this version should be coming soon, as
the
respective maintainers have the time to follow their packaging
procedures.
Many thanks to Jack Moffit, Norbert Tretkowski, Andrea Riciputi, Dryice
Liu
and Will Maier for the packaging work, which helps users get IPython
more
conveniently.

Many thanks to Enthought for their continued hosting support for
IPython.


Release notes
-

See

http://projects.scipy.org/ipython/ipython/wiki/Release/0.7.3/Features

for notable new features in this release.


Enjoy, and as usual please report any problems.


The IPython team.

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

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


itools 0.15.0 released

2006-12-20 Thread J. David Ibáñez

itools is a Python library, it groups a number of packages into a single
meta-package for easier development and deployment:
 
  itools.catalogitools.http itools.uri
  itools.cmsitools.i18n itools.vfs
  itools.csvitools.ical itools.web
  itools.datatypes  itools.rss  itools.workflow
  itools.gettextitools.schemas  itools.xhtml
  itools.handlers   itools.stl  itools.xliff
  itools.html   itools.tmx  itools.xml

The template language STL has seen the most important change since its
inception. A new method for variable substitution has been implemented,
it replaces stl:attributes and stl:content. To illustrate this change,
while before we wrote:

  a stl:attributes=href object_uri stl:content=object_title /

Now we will write:

  a href=${object_uri}${object_title}/a
 
This new approach produces more compact and readable templates. It will
also make easier to build some user interfaces. And will help translators
since the messages extracted from the templates will be more easy to read.


This release is also the first to include some C code. We have rewritten
the XML parser (itools.xml.parser) in C for performance. The programming
interface is mostly the same (see the UGRADE.txt file for the incompatible
changes).

For those who wonder... Why yet-another-xml-parser? Because its programming
interface is much much simpler (that means better) than the parsers based
in back-calls. See the itools documentation to know more [1].


The other big changes in this release are in itools.cms, one is for
disk usage, the other is functional.

The code that implements transactions has been rewritten. From a brute
force technique we have moved to a refined one that takes advantage of
the extensibility of the itools.vfs layer. The visibile change is that
we don't need anymore a backup database, so the size of an instance has
been reduced to (almost) the half.

The functional change has to do with user management. Now we use the
email address to identify users, instead of a username. The user must
confirm the registration sending an email, this way the application
can be certain the email address is valid.


There have been also some smaller improvements to the programming
interface of other packages, most notably itools.vfs, itools.catalog,
itools.web and itools.cms. See the file UPGRADE.txt file for the
incompatible changes.


[1] http://download.ikaaro.org/doc/itools/itools.html


Credits:

 - Hervé Cauwelier wrote the new database code and made other important
   changes in itools.cms (metadata stored roles);
 - J. David Ibáñez did almost everything else;
 - Norman Khine helped testing.


Resources
-

Download
http://download.ikaaro.org/itools/itools-0.15.0.tar.gz

Home
http://www.ikaaro.org/itools

Mailing list
http://mail.ikaaro.org/mailman/listinfo/itools

Bug Tracker
http://bugs.ikaaro.org/


-- 
J. David Ibáñez
Itaapy http://www.itaapy.com Tel +33 (0)1 42 23 67 45
9 rue Darwin, 75018 Paris  Fax +33 (0)1 53 28 27 88 

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

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


[ANNOUNCE] Thirty-fifth release of PythonCAD now available

2006-12-20 Thread Art Haas
Hi.

I'm pleased to announce the thirty-fifth development release of PythonCAD,
a CAD package for open-source software users. As the name implies,
PythonCAD is written entirely in Python. The goal of this project is
to create a fully scriptable drafting program that will match and eventually
exceed features found in commercial CAD software. PythonCAD is released
under the GNU Public License (GPL).

PythonCAD requires Python 2.2 or newer. The interface is GTK 2.0
based, and uses the PyGTK module for interfacing to GTK. The design of
PythonCAD is built around the idea of separating the interface
from the back end as much as possible. By doing this, it is hoped
that both GNOME and KDE interfaces can be added to PythonCAD through
usage of the appropriate Python module. Addition of other PythonCAD 
interfaces will depend on the availability of a Python module for that
particular interface and developer interest and action.

The thirty-fifth release contains several improvements dealing
with the storage and adjustment of user preferences and image settings.
The global user preferences are now saved into a file kept in the
user home directory, so the settings are now preserved between
PythonCAD sessions. Individual drawing settings can be examined and
adjusted via a new set of menus and dialogs. These new dialogs are
more complete than the single dialog previously used as well as
easier to use. In addition to the preference and setting changes, a
variety of bug fixes and miscellaneous code improvements are also
present in this new release.

A mailing list for the development and use of PythonCAD is available.
Visit the following page for information about subscribing and viewing
the mailing list archive:

http://mail.python.org/mailman/listinfo/pythoncad

Visit the PythonCAD web site for more information about what PythonCAD
does and aims to be:

http://www.pythoncad.org/

Come and join me in developing PythonCAD into a world class drafting
program!

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: [PythonCAD] [ANNOUNCE] Thirty-fifth release of PythonCAD now available

2006-12-20 Thread Art Haas
Hi again.

In addition to the thirty-fifth release of PythonCAD finally seeing the
light of day, the PythonCAD website was given a long overdue makeover.
I'd like to thank Jose Antonio Martin for doing the stylesheet and
artwork. The new look is an vast improvement from the plain text
layout the site has always had.

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


ANN: Pygments 0.6 Zimtstern released

2006-12-20 Thread Georg Brandl
I'm happy to announce the second public release of Pygments, the
generic Python syntax highlighter.

Download it from http://cheeseshop.python.org/pypi/Pygments, or
look at the demonstration at http://pygments.pocoo.org/demo.

News


The new features since 0.5.1 include:

  * New lexers: Scheme, Bash, Apache configs, Myghty templates, Groff.
  * New RTF formatter.
  * Added option for the HTML formatter to write the CSS to an external file
in full document mode.
  * Improved guessing methods for various lexers.
  * Support for guessing input encoding added.
  * Encoding support added: all processing is now done with Unicode strings,
input and output are converted from and optionally to byte strings.
  * License change to BSD.

In other news, the Trac 0.11 trunk already includes support for Pygments as
the default highlighting library.

About
-

Pygments is a generic syntax highlighter for general use in all kinds of
software such as forum systems, wikis or other applications that need to
prettify source code. Highlights are:

  * a wide range of common languages and markup formats is supported
  * special attention is paid to details increasing quality by a fair amount
  * support for new languages and formats are added easily
  * a number of output formats is available, presently HTML, LaTeX, RTF
and ANSI sequences
  * it is usable as a command-line tool and as a library
  * ... and it highlights even Brainf*ck!

The home page is at http://pygments.pocoo.org.

Read more in the FAQ list http://pygments.pocoo.org/faq or
look at the documentation http://pygments.pocoo.org/docs.

regards,
Georg Brandl
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: python script terminating

2006-12-20 Thread Fredrik Lundh
Aditya Vaish wrote:

 Using perl script name

perl is not a valid Python statement.  neither is Do something.  if 
you want to get help with your Python code, please post the actual code.

/F

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


Re: MySQLdb, lots of columns and newb-ness

2006-12-20 Thread Fredrik Lundh
Andrew Sackville-West wrote:

 I've also tried building tuples and lists and then using this
 
 cursor.execute(insert into daily values (%s), values)
 
 with no luck. it appears to me that I have to put in all 132 '%s' in
 order to make that work and that just seems stupid. 

on the other hand, hackers just *love* people who think they're too 
clever to do things in a safe and robust way:

   http://en.wikipedia.org/wiki/SQL_injection

using parameterized inserts also speeds things up for many databases, 
since the database engine don't have to parse and and analyze the sql 
statement over and over and over again.

to quickly generate the parameter list, use string repeat to create the 
parameter list:

   params = ( + ,.join([%s]*len(values)) + )
   cursor.execute(insert into daily values  + params, values)

you probably want to do some normalization work on your database too, 
but that's another story.

/F

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


Any easy-to-use email send module?

2006-12-20 Thread oyster
I find that the existing email moudle is some hard for me to
understand, especially the part of how to set the CC, BCC and attach
the files. Is there any more easy one like this p-code?

import easyemail
smtpserver=easyemail.server('something')
smtpserver.login('[EMAIL PROTECTED]', pwd)
newletter=smtpsever.letter(smtpserver)
newletter.sendto=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
newletter.sendcc=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
newletter.sendbcc=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
newletter.body='this is the body\nline 2'
newletter.att=['c:/file1.txt', 'd:/program files/app/app.exe']

if (newletter.send()==True):
print 'send ok'
smtpserver.close()

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


Re: Working with unsigned/signed types

2006-12-20 Thread Ant


On Dec 20, 6:25 am, [EMAIL PROTECTED] wrote:
 That seems like it'll do the trick quite well.

 As far as the future generations go, there's no question as to whether it 
 would
 last if it were on my site - there are always changes being made to it and I'm
 not expecting it to be very stable over the course of time, especially since 
 it
 would confuse the heck out of a bride trying to find her pictures if she 
 stumbled
 on it...  Is there a repository of some sort available for this sort of thing
 anywhere?

Sourceforge host open source projects for free:
http://sourceforge.net/

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


Re: SQLALCHEMY - Method to have the last word, by Michael Bayer

2006-12-20 Thread Hendrik van Rooyen
Diez B. Roggisch [EMAIL PROTECTED] wrote:

 So - stop it, go away, and please, pretty please with sugar on top: don't
 come back. Python doesn't need you, this NG doesn't need you, no FOSS
 project needs you. Buy a dog. That needs you. Until it runs away from
 being evaluated.

This proves it.

Wearing skull socks makes you mean.

- Hendrik

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


Re: urllib.unquote and unicode

2006-12-20 Thread Duncan Booth
Martin v. Löwis [EMAIL PROTECTED] wrote:

 Duncan Booth schrieb:
 The way that uri encoding is supposed to work is that first the input
 string in unicode is encoded to UTF-8 and then each byte which is not
 in the permitted range for characters is encoded as % followed by two
 hex characters. 
 
 Can you back up this claim (is supposed to work) by reference to
 a specification (ideally, chapter and verse)?

I'm not sure I have time to read the various RFC's in depth right now,
so I may have to come back on this thread later. The one thing I'm
convinced of is that the current implementations of urllib.quote and
urllib.unquote are broken in respect to their handling of unicode. In 
particular % encoding is defined in terms of octets, so when given a 
unicode string urllib.quote should either encoded it, or throw a suitable 
exception (not KeyError which is what it seems to throw now).

My objection to urllib.unquote is that urllib.unquote(u'%a3') returns 
u'\xa3' which is a character not an octet. I think it should always return 
a byte string, or it should calculate a byte string and then decode it 
according to some suitable encoding, or it should throw an exception 
[choose any of the above].

Adding an optional encoding parameter to quote/unquote be one option, 
although since you can encode/decode the parameter it doesn't add much.

 No, the http scheme is defined by RFC 2616 instead. It doesn't really
 talk about encodings, but hints an interpretation in 3.2.3:

The applicable RFC is 3986. See RFC2616 section 3.2.1:
 For definitive information on URL syntax and semantics, see Uniform 
 Resource Identifiers (URI):
 Generic Syntax and Semantics, RFC 2396 [42] (which replaces RFCs
 1738 [4] and RFC 1808 [11]).

and RFC 2396:
 Obsoleted by: 3986


 Now, RFC 2396 already says that URIs are sequences of characters,
 not sequences of octets, yet RFC 2616 fails to recognize that issue
 and refuses to specify a character set for its scheme (which
 RFC 2396 says that it could).

and RFC2277, 3.1 says that it MUST identify which charset is used (although 
that's just a best practice document not a standard). (The block capitals 
are the RFC's not mine.)

 The conventional wisdom is that the choice of URI encoding for HTTP
 is a server-side decision; for that reason, IRIs were introduced.

Yes, I know that in practice some systems use other character sets.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Sebastian 'lunar' Wiesner
Gabriel Genellina [EMAIL PROTECTED] schrieb

 On 17 dic, 19:21, Roger Upole [EMAIL PROTECTED] wrote:
 
 os.stat(selected)[ST_MODE]  (S_IXUSR|S_IXGRP|S_IXOTH

 This will tell you that x.exe is executable, even if x.exe
 contains
  nothing but zeros.

  Isn't the same with any other recipe, portable or not? Unless the
  OS actually tries to load and examine the file contents, which the
  OS's I'm aware of, don't do.

 On windows, you can use win32file.GetBinaryType to check if a file is
 actually a binary executable.
 
 A similar function exists on Linux too. But even if a file has the
 right file format, if it does not have the execute bit set, won't run.
 And you could set that bit on a JPG image too - and nothing good would
 happen, I presume. 

Really? I don't think so. Afaik on Linux executable binary files need an
ELF header.

[EMAIL PROTECTED]:15:43]  ~/Bilder
-- chmod a+x VM-Background.png

[EMAIL PROTECTED]:15:46]  ~/Bilder
-- ./VM-Background.png
bash: ./VM-Background.png: cannot execute binary file

As you can see, binary files without such a header are not executed...

Bye
lunar

-- 
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SQLALCHEMY - Method to have the last word, by Michael Bayer

2006-12-20 Thread Diez B. Roggisch
Hendrik van Rooyen wrote:

 Diez B. Roggisch [EMAIL PROTECTED] wrote:
 
 So - stop it, go away, and please, pretty please with sugar on top: don't
 come back. Python doesn't need you, this NG doesn't need you, no FOSS
 project needs you. Buy a dog. That needs you. Until it runs away from
 being evaluated.
 
 This proves it.
 
 Wearing skull socks makes you mean.

Ahh, I guess you're right - that twitching in my feet I should get rid
of them, wear cherubim socks instead and take a more relaxed stance towards
Ilias and his kind.

If only I manage to really do this until they convince me to keep them,
wearing them even in my sleep...

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


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Sebastian 'lunar' Wiesner
Tim Roberts [EMAIL PROTECTED] schrieb

 Gabriel Genellina [EMAIL PROTECTED] wrote:
 
On 16 dic, 04:47, Tim Roberts [EMAIL PROTECTED] wrote:
os.stat(selected)[ST_MODE]  (S_IXUSR|S_IXGRP|S_IXOTH

This will tell you that x.exe is executable, even if x.exe
contains
 nothing but zeros.

Isn't the same with any other recipe, portable or not? Unless the OS
actually tries to load and examine the file contents, which the OS's
I'm aware of, don't do.
 
 Yes, of course, you're right.  I was about to delve into a
 philosophical discussion about the difference in handling this between
 Linux and Windows, but they're both just conventions.  One is based on
 an arbitrary flag, one is based on a file extension.  Contents are
 irrelevant. 

No, they aren't! Try this:

[EMAIL PROTECTED]:24:44]  ~/test
-- dd if=/dev/zero of=test.sh count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 6.5e-05 seconds, 7.9 MB/s

[EMAIL PROTECTED]:24:46]  ~/test
-- chmod a+x test.sh

[EMAIL PROTECTED]:24:55]  ~/test
-- ./test.sh
bash: ./test.sh: cannot execute binary file

A file containing only zeros isn't executed...

-- 
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Fredrik Lundh
Sebastian 'lunar' Wiesner wrote:

 No, they aren't! Try this:

you're confusing the shell's is this file executable check with the 
loader's can I execute this file check:

$ export PATH=.:$PATH
$ dd if=/dev/zero of=ls count=1
1+0 records in
1+0 records out
$ ls -l ls
-rw-rw-r--  1 slab slab 512 Dec 20 03:33 ls
$ chmod a+x ls
$ ls
-bash: ./ls: cannot execute binary file

/F

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


Re: Good Looking UI for a stand alone application

2006-12-20 Thread Luc Heinrich
Chris Mellon [EMAIL PROTECTED] wrote:

 FYI: OS X ships with wxWidgets installed.

For the sole purpose of providing an easy way to run existing wxPerl and
wxPython code (and possibly pure wxWidgets code as well). As a
*porting* aid if you will, as hinted in the Using Traditional UNIX
Graphical Environments of the Porting UNIX/Linux Applications to Mac
OS X document, here:

http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix
/index.html

 How many applications built into OS X are built using it? 

I quote you: none, zero, zilch :

 Are you sure? How would you know?

What's that ? Homework ? Oh well, here you go:

import os
import subprocess

def findLinkedWithWX(folder):
  for root, dirs, files in os.walk(folder):
for d in list(dirs):
  if d.endswith('.app'):
dirs.remove(d)
exename, _ = os.path.splitext(d)
exe = '%s/%s/Contents/MacOS/%s' % (root, d, exename)
popen = subprocess.Popen(['otool', '-L', exe], 
 stdout=subprocess.PIPE)
libs = popen.communicate()[0]
if 'libwx' in libs:
  print d

findLinkedWithWX('/Applications')
findLinkedWithWX('/Developer')

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


cross-compiling python: reviewers needed

2006-12-20 Thread Han-Wen Nienhuys

Hello,

I have a small patch for Python SVN that makes it possible to
cross-compile python on Unix to various other Unix targets.
I have successfully built a binary for FreeBSD on Linux.

The patch is available at 

https://sourceforge.net/tracker/?func=detailatid=305470aid=1597850group_id=5470

(file cross.patch)

but it awaits further review.

I'm looking for people willing to try this out, and give further
review to the patch, so it may be applied to SVN.

All you need is a bit of time, and experience in cross-compiling. 

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


IPython 0.7.3 upgrade notes

2006-12-20 Thread Ville Vainio
Something I forgot to emphasize in the announcement, knowing that not
everyone reads the release notes - if you are upgrading from a previous
version of IPython, you must either:

- Delete your ~/ipython (or ~/_ipython) directory OR
- Run %upgrade once IPython starts.

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


Re: IPython 0.7.3 upgrade notes

2006-12-20 Thread Ville Vainio
Ville Vainio wrote:

 Something I forgot to emphasize in the announcement, knowing that not
 everyone reads the release notes - if you are upgrading from a previous
 version of IPython, you must either:

 - Delete your ~/ipython (or ~/_ipython) directory OR
 - Run %upgrade once IPython starts.

(And if you are wondering what all of this is about, due to
c.l.p.announce moderator approval waitn period, see

http://projects.scipy.org/ipython/ipython/wiki/Release/0.7.3

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


Re: IPython 0.7.3 upgrade notes

2006-12-20 Thread Ville Vainio
Ville Vainio wrote:

 Something I forgot to emphasize in the announcement, knowing that not
 everyone reads the release notes - if you are upgrading from a previous
 version of IPython, you must either:

 - Delete your ~/ipython (or ~/_ipython) directory OR
 - Run %upgrade once IPython starts.

And if you are wondering what all of this is about, due to
c.l.p.announce moderator approval wait period, see

http://projects.scipy.org/ipython/ipython/wiki/Release/0.7.3

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


Re: automatically grading small programming assignments

2006-12-20 Thread Slawomir Nowaczyk
On Thu, 14 Dec 2006 21:36:31 -0500
Brian Blais [EMAIL PROTECTED] wrote:

# Paddy wrote:

#  It might turn out to be a poor substitute for the personal touch,
#  especially If they are just starting to program.
# 
# Oh, I didn't mean it to completely replace me grading things, but I
# think it would be useful if there were a lot of little assignments
# that could be done automatically, and then some larger ones that I
# would grade by hand. The little ones could be set up so that they can
# submit as many times as they want, until they get it right.

Well, that sounds like a valid plan, but why would you want to grade the
little ones at all, then?

What I would most likely do is to publish those small assignments
together with a set of tests for each one, and say that they should
write programs and make sure their programs pass the tests.

If you wish, you could publish two sets of tests, the easy and
tricky ones, and have them use easy ones when writing program, and
only run it through the tricky tests when they believe the program is
bug-free. This can be a very valuable experience! (if you can devise the
right tests, of course ;)

If you either require the skills they develop doing small assignments
in the big assignments, or if you check 2-3 small assignments by hand,
you should be able to reduce cheating sufficiently... It's just a matter
of making sure they really *do* write programs and that those programs
*do* pass the tests. 

Or just require students to hand in the small assignments, together with
the testing output, but do not check them at all (not too many will have
the guts to fake the outputs).

Then there is a whole range of ideas about peer review in the education
community, where you could get students to verify one another's
programs... But this can sometimes be tricky.

-- 
 Best wishes,
   Slawomir Nowaczyk
 ( [EMAIL PROTECTED] )

Someone Else's Code - a commonly used synonym for Bad Code

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


Re: python-hosting.com projects: dead?

2006-12-20 Thread greg
Remi wrote:

 We had to do some serious cleanup and we disabled a lot of Trac sites
 that looked abandoned (people left their Trac sites open to spammers
 and our server was crawling under the load caused by these spammers).

Perhaps it would be a good idea to send email to the owners
of these accounts letting them know what you've done and how
to get it re-enabled. Just shutting it down without any word
could be seen as a bit rude.

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


Re: python-hosting.com projects: dead?

2006-12-20 Thread greg
Richard Jones wrote:

 Actually, to clarify the DEFAULT configuration for Trac is to leave it open
 to spam.

That sounds like a really bad choice of default.

A bit like the way Windows comes with all the
let anyone in the world send me a virus
options turned on...

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


Re: tuple.index()

2006-12-20 Thread greg
Nick Maclaren wrote:

 It does explain why you think of lists as homogeneous, but the
 analogy doesn't hold water on closer inspection.  There doesn't seem
 to be ANYTHING in the specification or implementation that assumes
 lists are homogeneous.

Then what do you think is suggested by the fact
that lists have an index() method but tuples don't?

That's how this whole discussion got started --
someone wanted an explanation of why that is so.
The explanation is that tuples and lists were
designed for different use cases.

You don't *have* to use them that way, but if
you use them differently, you're on your own
and can't complain if they don't have all the
features you want.

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


Re: Page layouts in mod_python?

2006-12-20 Thread Bruno Desthuilliers
Graham Dumpleton a écrit :
 Bruno Desthuilliers wrote:
 
Michael a écrit :

Hey everyone,

Is it possible to automatically insert headers/footers using
mod_python?
I will be not be using PSP's, so I cannot use the PSP/include solution.
Furthermore, the header will be dynamic; it won't be a static HTML
page.

In short, I've been looking for a page layout facility using
mod_python.
(Similar to the layout capability in Ruby on Rails.)

mod_python is mainly a librairy exposing the apache API to Python - not
a full-stack db-to-web framework. What you want here is a HTML
templating system. There are quite a lot available in Python - look for
SimpleTAL, Genshi, Myghty, Jinja, Cheetah, etc...
 
 
 Contrary to the above advise, you could actually use mod_python to do
 what you want and you do not need a full stack to do it.

I never said the OP would need a full-stack framework - just that there 
are existing solutions that can solve the problem in a very simple way.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: def index(self):

2006-12-20 Thread Bruno Desthuilliers
Tim Roberts a écrit :
 Bruno Desthuilliers [EMAIL PROTECTED] wrote:
 
Gert Cuykens a écrit :

FWIW, the first version raises an exception (unless of course the name
'index' is already bound in the enclosing scope). And the second won't
probably work as expected with CherryPy.

code
class HelloWorld:
def index(self):
 return Hello world!
index.exposed = True #DOOH!

And the winner is


/code

The whole thing, I guess. While Python is quite easy to get started 
with, there are a few gotchas. You're above snippet should be:

class HelloWorld(object):
def index(self):
return Hello World
index.exposed = True
 
 
 Many people find it more readable to write that as:
 
 class HelloWorld(object):
 @cherrypy.exposed
 def index(self):
return Hello World

So do I. But this breaks compatibility with older Python versions, and 
is perhaps a bit confusing for someone that doesn't seem to really get 
some basic Python stuffs like what 'self' is...

My 2 cents
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tuple.index()

2006-12-20 Thread Nick Maclaren

In article [EMAIL PROTECTED],
greg [EMAIL PROTECTED] writes:
| 
|  It does explain why you think of lists as homogeneous, but the
|  analogy doesn't hold water on closer inspection.  There doesn't seem
|  to be ANYTHING in the specification or implementation that assumes
|  lists are homogeneous.
| 
| Then what do you think is suggested by the fact
| that lists have an index() method but tuples don't?

Eh?  Nothing relevant to homogeneity, to be sure.  See the Library
reference, 2.3.3.  It starts by saying Comparison operations are
supported by all objects. and the first paragraph after the table
says that == is defined to return False for different types (except
numeric and string).  2.3.6 (Mutable Sequence Types) says that index
returns the smallest value such that == returns True.

So index finds a match among compatible types.  That is an old
specification of searching heterogeneous lists that I have been
using for over 30 years - I can't now remember which languages
include it.

What's the problem?

| That's how this whole discussion got started --
| someone wanted an explanation of why that is so.
| The explanation is that tuples and lists were
| designed for different use cases.

The problem is that the homogeneity argument is irrational (which
does NOT necessarily mean either wrong or undesirable), IS NOT
DOCUMENTED IN THE REFERENCES, and Python is not generally irrational.
My mental model of Guido is that he thinks fairly rationally.  Python
isn't Perl or C, after all.

| You don't *have* to use them that way, but if
| you use them differently, you're on your own
| and can't complain if they don't have all the
| features you want.

Which is tantamount to saying that Python doesn't support mutable
heterogeneous sequences, even though they are not locked out.  That
is more than just odd - it is almost unbelievable.  They are a very
basic data structure, after all!


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  [EMAIL PROTECTED]
Tel.:  +44 1223 334761Fax:  +44 1223 334679
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tuple.index()

2006-12-20 Thread greg
Nick Maclaren wrote:

 Nope.  Sorry.  Consider the old model where an I/O list is an ordered
 sequence of strings and agents (effectively procedure calls), with no
 constraints on how those are ordered.  With your specification, that
 is neither heterogenous nor homogenous :-)

I don't see any difficulty. This is a list (homogeneous) of
two-element tuples (heterogeneous).

If you're thinking of representing this as just a flat
list, [str1, agent1, str2, agent2, ...], that's a borked
way of doing it and you deserve whatever philosophical
knots you get into as a result.

 It's a complete delusion, because even the claimed assumption of list
 homogeneity is tantmount to saying that Python doesn't encourage (or,
 arguably, support) ANY way of using mutable heterogenous sequences
 (such as the example above).

It's unfortunate that Python doesn't make the homogeneous/
heterogeneous distinction orthogonal to the mutable/immutable
one. Ideally, yes, there would be mutable and immutable
tuples, and mutable and immutable lists. Perhaps also even
fixed and variable sized versions of these as well.

But that would be eight different data types, which is a
lot of trouble to go to just to give you something that's
precisely tailored to exactly what you want. Some might
say it was overkill.

Python takes a more pragmatic approach, and provides
just two: the tuple, optimised for the case of heterogeneous
*and* fixed size *and* immutable -- and the list, for
everything else.

So it's not really that lists are intended *only* for
homogeneous collections, but for anything that can't be
represented as a tuple for whichever reason.

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


Re: automatically grading small programming assignments

2006-12-20 Thread Paul Boddie
Jeff Rush wrote:

 For another solution, I wonder whether you could make use of the new Abstract
 Syntax Tree (AST) in Python 2.5, where you convert the source of an attempt
 into an abstract data structure, anonymize the method/variable/class names and
 compare the tree against a correct solution.  It would let you quickly handle
 those students who solved it in a conformist way, and then you'd need to
 manually review the rest for creatively solving it another way. ;-)

You could attempt that kind of solution using previous versions of
Python (and the compiler module), but as soon as you want to compare
two different ASTs - and I think that unless there's only one obvious
solution, they won't be identical - then you need to descend into a
world of program transformations that Python doesn't encourage. It's
probably no coincidence that the functional programming people were
probably the only people trying this kind of automatic grading back
when I was a student.

Paul

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


IPython 0.7.3 is out

2006-12-20 Thread Ville Vainio
Hi all,

The IPython team is happy to release version 0.7.3, with a lot of new
enhancements, as well as many bug fixes (including full Python 2.5
support).

We hope you all enjoy it, and please report any problems as usual.


WHAT is IPython?


1. An interactive shell superior to Python's default. IPython has many
features for object introspection, system shell access, and its own
special
command system for adding functionality when working interactively.

2. An embeddable, ready to use interpreter for your own programs.
IPython can
be started with a single call from inside another program, providing
access to
the current namespace.

3. A flexible framework which can be used as the base environment for
other
systems with Python as the underlying language.

4. A shell for interactive usage of threaded graphical toolkits.
IPython has
support for interactive, non-blocking control of GTK, Qt and WX
applications
via special threading flags. The normal Python shell can only do this
for
Tkinter applications.


Where to get it
---

IPython's homepage is at:

http://ipython.scipy.org

and downloads are at:

http://ipython.scipy.org/dist

We've provided:

  - Source download (.tar.gz)
  - A Python Egg
(http://peak.telecommunity.com/DevCenter/PythonEggs).
  - A native win32 installer.

We note that IPython is now officially part of most major Linux and BSD
distributions, so packages for this version should be coming soon, as
the
respective maintainers have the time to follow their packaging
procedures.
Many thanks to Jack Moffit, Norbert Tretkowski, Andrea Riciputi, Dryice
Liu
and Will Maier for the packaging work, which helps users get IPython
more
conveniently.

Many thanks to Enthought for their continued hosting support for
IPython.


Release notes
-

See

http://projects.scipy.org/ipython/ipython/wiki/Release/0.7.3/Features

for notable new features in this release.


Enjoy, and as usual please report any problems.


The IPython team.

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


IPython 0.7.3 upgrade notes

2006-12-20 Thread Ville Vainio
Something I forgot to emphasize in the announcement, knowing that not
everyone reads the release notes - if you are upgrading from a previous
version of IPython, you must either:

- Delete your ~/ipython (or ~/_ipython) directory OR
- Run %upgrade once IPython starts.

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


[ANN] PyInstaller 1.3 released

2006-12-20 Thread Giovanni Bajo
Hello,

PyInstaller 1.3 is out!

Grab latest version at:
http://pyinstaller.python-hosting.com/


Description
---
PyInstaller is a program that converts (packages) Python programs into 
stand-alone executables, under Windows, Linux and Irix. Its main advantages 
over similar tools are that PyInstaller works with any version of Python since 
1.5, it builds smaller executables thanks to transparent compression, it is 
multi-platform (so you can build one-file binaries also under Linux), and use 
the OS support to load the dynamic libraries, thus ensuring full compatibility.


Features

  * Packaging of Python programs into standard executables, that
work on computers without Python installed.
  * Multiplatform: works under Windows, Linux and Irix. (Mac port
in development. See /branches/mac on SVN)
  * Multiversion: works under any version of Python since 1.5.
  * Dual packaging mode:
o Single directory: build a directory containing an
  executable plus all the external binary modules (.dll,
  .pyd, .so) used by the program.
o Single file: build a single executable file, totally
  self-contained, which runs without any external
  dependency.
  * Support for automatic binary packing through the well-known
UPX compressor.
  * Optional console mode (see standard output and standard error
at runtime).
  * Selectable executable icon (Windows only).
  * Fully configurable version resource section in executable
(Windows only).
  * Support for building COM servers (Windows only).


ChangeLog
-
  + Fix bug with user-provided icons disappearing from built executables
when these were compressed with UPX.
  + Fix problems with packaging of applications using PIL (that was broken
because of a bug in Python's import machinery, in recent Python
versions). Also add a workaround including Tcl/Tk with PIL unless
ImageTk is imported.
  + (Windows) When used under Windows XP, packaged programs now have
the correct look  feel and follow user's themes (thanks to the manifest
file being linked within the generated executable). This is especially
useful for applications using wxPython.
  + Fix a buffer overrun in the bootloader (which could lead to a crash)
when the built executable is run from within a deep directory (more than
70-80 characters in the pathname).
  * Bootstrap modules are now compressed in the executable (so that they
are not visible in plaintext by just looking at it with a hex editor).
  * Fixed a regression introduced in 1.1: under Linux, the bootloader does
not depend on libpythonX.X.so anymore.


We've moved
---
PyInstaller has a new home:
http://pyinstaller.python-hosting.com/
(thanks to the guys at webfaction.com for top-notch free hosting!)

We also own a domain name (http://pyinstaller.org) which can be used as a 
permanent redirector to our home.

The mailing list moved as well, it's now at 
http://groups.google.com/group/PyInstaller. Join us for discussion!

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


array, a better shell

2006-12-20 Thread bearophileHUGS
For array.array B means unsigned char, and such arrays accept to be
initialized from (str) strings too, this is quite useful:

 from array import array
 a = array(B, hello)

But it seems such capability isn't shared with the append:

 a.extend(hello)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: an integer is required



I like a lot the Python shell, it helps me in many different
situations. I have tried some Python shells:
- the vanilla one from DOS
- the one from ActivePython IDE
- the one from SPE
- ipython from a DOS shell

But none of them has what I'd like.
ipython tries to be a better shell, but I don't want more complexity
and more commands/tricks to remember, I want something more
interactive, that's simpler and more powerful to use, and not something
(much) more complex. Much less things, but the important ones.
Beside the vanilla one, I end using the SPE one (because it has colours
on Windows too, and it allows you to paste a piece of interactive shell
with the leading , SPE removes them automatically. This is very
handy).

I have also used the shell of Mathematica. It's quite powerful and it
can show graphics too inlined, but globally I don't like it fully
because it makes editing small programs a pain (for me). Even if I
globally don't like the Mathematica shell, it has a capability that I'd
like to have in a basic Python shell too.
(NOTE: often when dealing with GUI subtle details make a *big*
difference, and it's not easy to use words to describe such interaction
details.)
This Mathematica shell allows you to edit small programs (like 1-15
lines of code) as input blocks, and later you can click on them and
edit them. When you press shift-enter inside a block, that small
program runs and its output goes just below it (and not at the end of
the current shell log). All the Input Blocks can be edited and run
again like that (an Input/Output number tag helps to keep things sorted
enough). So it's a cross between a normal stupid shell that's
essentially an I/O + visual log, and a bare-bone text editor that
allows you to edit one script and run it too.
Such capability probably needs a Tk/Wx/Gtk window...

---

(Such interactive sessions can be saved too, and loaded again (they
become complex documents), but such ability isn't necessary into a
bare-bone shell that I am describing now. I am describing something as
simple as possible).

Beside that (new) basic shell capability  I think I can appreciate two
other capabilities:
- Automatically saves the last 20 MBytes of textual input/output log
inside a queue file. Material older than the last 20 MB is removed
from the top.
- Ability to break the computation (or the printing of VERY long
things!) without exiting the shell and the kernel (this is from
Mathematica too).

Bye,
bearophile

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


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Sebastian 'lunar' Wiesner
Fredrik Lundh [EMAIL PROTECTED] schrieb

 Sebastian 'lunar' Wiesner wrote:
 
 No, they aren't! Try this:
 
 you're confusing the shell's is this file executable check with the
 loader's can I execute this file check:

 $ export PATH=.:$PATH
 $ dd if=/dev/zero of=ls count=1
 1+0 records in
 1+0 records out
 $ ls -l ls
 -rw-rw-r--  1 slab slab 512 Dec 20 03:33 ls
 $ chmod a+x ls
 $ ls
 -bash: ./ls: cannot execute binary file

???
Am I blind or is there really no difference between you shell example an
mine?
As far as I can see, you are doing exactly the same thing as I did...
So what are trying to proof?

Sebastian

-- 
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newbie: What are the rules wrt constructing PYDOC keywords

2006-12-20 Thread Steven D'Aprano
On Tue, 19 Dec 2006 12:48:16 -0800, paulsendave wrote:

 Still learning python (2.4) and have instructions that all of our
 python scripts should be SelfDoc'ing via pydoc standards.
 
 One thing that isn't clear to me is how pydoc searches for keywords.  I
 believe that there might be certain rules for putting keywords together
 under the SYNOPSIS and search paths that pydoc -k uses that aren't
 obvious to me.
 
 (Of course, it'd be a good training exercise to read through pydoc.py
 itself and figure it out for myself, and I might just do that, but for
 the moment, there are other priorities.)

I'd love to help you, and I just might do that, but for the moment there
are other priorities.

Honestly, do you really expect to have people do your work for you, for
free, when you all but say I could answer this myself but I'm too lazy?

You might want to read this:

http://catb.org/esr/faqs/smart-questions.html

At least make a bit of an effort first. Or if you can't/won't make an
effort, don't rub people's nose in the fact.

E.g. you might like to tell us what behaviour leads you to believe there
are certain rules. Explain how you think pydoc searches for keywords,
and what behaviour your guess doesn't explain. 



-- 
Steven

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


Re: array, a better shell

2006-12-20 Thread Steven D'Aprano
On Wed, 20 Dec 2006 03:44:25 -0800, bearophileHUGS wrote:

 For array.array B means unsigned char, and such arrays accept to be
 initialized from (str) strings too, this is quite useful:
 
 from array import array
 a = array(B, hello)
 
 But it seems such capability isn't shared with the append:

[snip]

 I like a lot the Python shell, it helps me in many different
 situations. I have tried some Python shells:
 - the vanilla one from DOS
 - the one from ActivePython IDE
 - the one from SPE
 - ipython from a DOS shell
 
 But none of them has what I'd like.


Is there a shortage of bytes, that Usenet posts about completely different
topics have to message-pool?

Did you have any questions, or were you just talking to yourself?

[snip]


 (Such interactive sessions can be saved too, and loaded again (they
 become complex documents), but such ability isn't necessary into a
 bare-bone shell that I am describing now. I am describing something as
 simple as possible).

No you're not. You're describing a quite complicated shell. You're
describing a hypothetical shell with features other actual shells don't
have, so therefore it can't possibly be as simple as possible. Perhaps
what you meant to say was the bare-minimum I consider worth using?



-- 
Steven.

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


Re: tuple.index()

2006-12-20 Thread Nick Maclaren

In article [EMAIL PROTECTED],
greg [EMAIL PROTECTED] writes:
| 
|  Nope.  Sorry.  Consider the old model where an I/O list is an ordered
|  sequence of strings and agents (effectively procedure calls), with no
|  constraints on how those are ordered.  With your specification, that
|  is neither heterogenous nor homogenous :-)
| 
| I don't see any difficulty. This is a list (homogeneous) of
| two-element tuples (heterogeneous).

Not at all.  I didn't say that they came in pairs.  Consider:

[str1, str2, agent1, str3, agent2, agent3, agent4, str4, ...]

See Algol 68 for an example of this.


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


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Sebastian 'lunar' Wiesner wrote:

 Gabriel Genellina [EMAIL PROTECTED] schrieb
 A similar function exists on Linux too. But even if a file has the
 right file format, if it does not have the execute bit set, won't run.
 And you could set that bit on a JPG image too - and nothing good would
 happen, I presume. 
 
 Really? I don't think so. Afaik on Linux executable binary files need an
 ELF header.

There are other executable loaders for `a.out` and `COFF` in the kernel,
and with the `binfmt_misc` module you can make anything with a magic
header executable, including Python scripts/bytecode and even JPEG images.

  http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: array, a better shell

2006-12-20 Thread bearophileHUGS
Steven D'Aprano:
 No you're not. You're describing a quite complicated shell. You're
 describing a hypothetical shell with features other actual shells don't
 have, so therefore it can't possibly be as simple as possible.

You are right, it's not really simple, but:
- It has just the basic functionality that I think is important. Many
more features can be added, I too can list some of them, but I don't
think they are much important.
- It's very simple from the user point of view, because its usage
requires no new commands to remember :-) (beside shift-enter or
something similar to run a block).

Thank you for listening,
bye,
bearophile

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


Re: array, a better shell

2006-12-20 Thread Duncan Booth
[EMAIL PROTECTED] wrote:

 This Mathematica shell allows you to edit small programs (like 1-15
 lines of code) as input blocks, and later you can click on them and
 edit them. When you press shift-enter inside a block, that small
 program runs and its output goes just below it (and not at the end of
 the current shell log). All the Input Blocks can be edited and run
 again like that (an Input/Output number tag helps to keep things sorted
 enough). 

Sounds pretty close to what Idle does:

The Idle shell allows you to enter small programs as input blocks, and edit 
them while entering them. Later you can click on them and bring them back 
to the bottom of the input buffer for further editing (so no confusing 
output appearing out of order), and you can always look back at all earlier 
versions of the block. All the Input Blocks can be edited and run again 
like that.

Your point was?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tricky(?) win32com question - Mark Hammond or other experts please.

2006-12-20 Thread Roger Upole

[EMAIL PROTECTED] wrote
 OK, I've asked this earlier this week with no response. Since then I've
 also received a suggestion from the app developers but that failed with
 the same type error problem. Hopefully Mark Hammond or other experts
 can offer a suggestion as to how to get around this problem. I'm
 foolish enough to think that a solution can be found. Or can someone
 suggest how to pm Mark.

 ---

 I'm using pywin32com to drive a 3rd party app. The app has a VBS based
 API.  In VBS a specific query for data goes like this:

 Plot.QueryBegin datacode, Nothing

 where datacode is a number and Nothing is a VBS type/keyword

 The nominal python equivalent doesn't work. Plot.QueryBegin(datacode,
 None) gives a type mismatch error as follows: com_error: (-2147352571,
 'Type mismatch.', None, 2)

From what I've been able to discover Nothing is not a null, 0, False,
 

 Table 12.2 of
 http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html does not
 mention Nothing in its list of Variant types.

 Please, any clues about how to handle this (apart from running the
 query in VBS). I so much more prefer python.

Try either pythoncom.Missing, pythoncom.Empty, or pythoncom.ArgNotFound.

 Roger



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


Re: Fall of Roman Empire

2006-12-20 Thread Thomas Ploch
Ben Finney schrieb:
 John Machin [EMAIL PROTECTED] writes:
 
 Ben Finney wrote:

  \  ...one of the main causes of the fall of the Roman Empire was |
   `\that, lacking zero, they had no way to indicate successful |
 _o__)   termination of their C programs.  -- Robert Firth |
 An amusing .sig, but it doesn't address the root cause: As they had no
 way of testing for the end of a string, in many cases successful
 termination of their C programs would have been unlikely.
 
 Yet historically proven: the 'imperium' process they were running
 terminated many centuries ago.
 
 Or did it fork and exec a different process?
 

And what about the C-Programs running in the middle of the sun or earth
making them spinning around or having nuclear reactions controlled. I
hope they won't terminate in the near future with exit status != 0
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Fredrik Lundh
Sebastian 'lunar' Wiesner wrote:

 you're confusing the shell's is this file executable check with the
 loader's can I execute this file check:

 $ export PATH=.:$PATH
 $ dd if=/dev/zero of=ls count=1
 1+0 records in
 1+0 records out
 $ ls -l ls
 -rw-rw-r--  1 slab slab 512 Dec 20 03:33 ls
 $ chmod a+x ls
 $ ls
 -bash: ./ls: cannot execute binary file
 
 ???
 Am I blind or is there really no difference between you shell example an
 mine?
 As far as I can see, you are doing exactly the same thing as I did...

no, I'm showing that a local file marked as executable overrides a 
shared one, even if the local file isn't actually an executable.

 So what are trying to proof?

that you're wrong when you claim that the contents of the file matters 
when using the usual Unix conventions to check if a file is executable.

maybe you should read Tim's post and the post he replied to again?

/F

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


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Sebastian 'lunar' Wiesner
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] schrieb

 In [EMAIL PROTECTED], Sebastian 'lunar' Wiesner
 wrote:
 
 Gabriel Genellina [EMAIL PROTECTED] schrieb
 A similar function exists on Linux too. But even if a file has the
 right file format, if it does not have the execute bit set, won't
 run. And you could set that bit on a JPG image too - and nothing
 good would happen, I presume.
 
 Really? I don't think so. Afaik on Linux executable binary files need
 an ELF header.
 
 There are other executable loaders for `a.out` and `COFF` in the
 kernel, and with the `binfmt_misc` module you can make anything with a
 magic header executable, including Python scripts/bytecode and even
 JPEG images.

Yes, I know...
But ELF is actually the most common linker format on Linux systems.
a.out is a legacy format, that is afaik not used by any modern
distribution. Concerning COFF I'm not sure, if there is really a COFF
loader in the kernel. At least I did not find any information about
such a loader in the kernel configuration. It just lists elf, a.out and
binfmt_misc.

But basically you're right. One could even write a loader for JPEG
files. 
But as long as such an loader is not part of a standard linux
distribution, nothing bad happens when you try to execute a JPEG file,
and that's what I wanted to point out.

Sebastian

-- 
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
-- 
http://mail.python.org/mailman/listinfo/python-list


wxGrid: Problem with unicode mathematical symbols

2006-12-20 Thread Massi
Hi everyone, I'm trying to build (on windows environment) a grid in
which every cell contains a mathematical formula, the problem is the
following:
when I try to put in the cells some mathematical symbol (such as those
for belong to, for all or exists) with the method SetCellValue I
always see ∊ as the value of the cells, even if I use both the
unicode wx version and the right unicode strings for the symbols (such
as u'\u2208' for belong to ). In fact if I do (on IDLE):

print u'\u2208'

everything works fine. I can't understand why I am wrong. I also tried
to change the font of the cells in Arial Unicode MS, but the result
was the same.
Have you got any idea about?. Thanks in advance,
Massi

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

Re: array, a better shell

2006-12-20 Thread bearophileHUGS
Duncan Booth:
 Later you can click on them and bring them back
 to the bottom of the input buffer for further editing (so no confusing
 output appearing out of order),

I think that's worse, not better. You end with a messy final document
(log), so finding things into it (during the editing too) is much more
difficult.


 Your point was?

My point is to suggest things that can improve the Python user
experience, and productivity too. I try to help, with the hope to have
something that I like more too.

It's very difficult to describe subtle GUI functionalities using a
texual description (expecially when you aren't using your native
language). If you try the Mathematica shell you may find some
differences I am talking about (even if I don't globally like the
Mathematica shell).
Editing an input block into idle feels different from editing a small
script inside an editor, there are differences that make the user
experience less good.
(And beside that it seems I often have problems running IDLE on Win PCs
with a firewall).

Bye,
bearophile

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


Re: Windows Authetication vs seperate process

2006-12-20 Thread Roger Upole

[EMAIL PROTECTED] wrote:
I was wondering of someone could steer me in the right direction.

 We have a package that we would like to secure so that only specific
 individuals can access specific portions of the application.  Our
 wxPython application will revolve around updating a central database
 with information submitted from the app.  We will eventually have a web
 front end fo rsome aspects of the app.

 With several packages I have seen options to Use Windows
 Authentication, which seems to mean that If the user has
 authenticated and signed onto Windows, then our application will use
 their windows userid and we will just focus on the the tasks within our
 application the user is authorized to perform

 Does anyone have any experience using this type of authentication
 scheme ?

 Any related tips or suggestions ?

 I have found a few wikipedia entries, but they seem to be more related
 to webpages, etc.

 Thanks.


The pywin32 package includes the functions needed to do this type of
authentication.  See \win32\Demos\security\sspi for some examples that
work out of the box with NTLM.

 Roger




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


Re: [ANN] PyInstaller 1.3 released

2006-12-20 Thread Han-Wen Nienhuys
Giovanni Bajo escreveu:
 Hello,
 
 PyInstaller 1.3 is out!
 
 Grab latest version at:
 http://pyinstaller.python-hosting.com/
 
 
 Description
 ---
 PyInstaller is a program that converts (packages) Python programs into
 stand-alone executables, under Windows, Linux and Irix. Its main
 advantages over similar tools are that PyInstaller works with any
 version of Python since 1.5, it builds smaller executables thanks to
 transparent compression, it is multi-platform (so you can build one-file
 binaries also under Linux), and use the OS support to load the dynamic
 libraries, thus ensuring full compatibility.

that sounds really cool. Is it possible to use this in cross-compiling mode? Ie.
build a standalone .exe for windows on a linux machine?

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


Re: tuple.index()

2006-12-20 Thread Paul Boddie
Nick Maclaren wrote:

 Which is tantamount to saying that Python doesn't support mutable
 heterogeneous sequences, even though they are not locked out.  That
 is more than just odd - it is almost unbelievable.  They are a very
 basic data structure, after all!

What a fuss about something so intangible! :-) If I were you, I'd not
worry about taking what people say with regard to the philosophy as a
starting point. Instead, it may be more illustrative to consider things
from the ground up...

  * You can put any combination of things into both tuples and lists.
  * Tuples are immutable, lists are mutable.
  * You can test both tuples and lists for element membership
(x in seq).
  * You can iterate over both tuples and lists.

The contentious issue is why you can't ask where something is in a
tuple (the position of an element) whereas you can in a list or even in
a string (albeit only with substrings in that particular case). This is
where you have to consider how you'd use an immutable sequence like a
tuple rather than a mutable sequence like a list.

With a tuple, since you can't append to it, you already need to have
decided its size and its contents (mutable elements notwithstanding)
when you create it. Although it's possible to have thousands of
elements in a tuple, you would in most situations need to build such
long tuples up either by concatenating existing ones - this is not
likely to be particularly efficient due to the need to construct a new
tuple for each concatenation of existing ones - or by converting a list
into a tuple (questioning the need for a tuple, anyway). So it's
unlikely that you'd lightly consider using tuples as an ad-hoc sequence
for recording long collections of objects, or that the structure of any
tuple you've created is consequently going to be unknown to your
program. Even if you were dealing with totally unknown tuples from
other sources, the need to query the location of specific elements
would probably be much less than just iterating over the tuple or
asking whether something is present in it.

Of course, one can still argue that querying for the presence of an
element is no real substitute for knowing its position. In a program
where you define the structure of a tuple in such a way that it makes
little sense for a particular element to appear in more than one place
- which is where the heterogeneous assertion comes in - knowing the
presence of an element is as good as knowing its position (since the
program has knowledge of the position implicitly). In a program where
you don't define the structure in such a way, the problem situation
seems to be as narrow as needing short tuples (as opposed to lists,
possibly for use as dictionary keys, for example) whose elements'
locations are efficiently discoverable, and where such location
information is significantly useful for other purposes. Since tuples
are immutable, you can't replace those elements using such location
information, leaving fewer and fewer compelling reasons for needing
that information in the first place, I would have thought.

Perhaps the notion of heterogeneous is best defined in the most general
case as a selection of objects unlikely to be considered equal or
equivalent, in such a way that the standard test for presence (x in
seq) employs such a measure of equality and can suggest (with
contextual information) the location of an object by just knowing
whether it is present.

Paul

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


RE: Is htmlGen still alive?

2006-12-20 Thread Klaus Muller
Thank you for this input. I was primarily looking for a download site.

I downloaded HyperText and definitely will give it a try. It looks good.

Klaus

 -Original Message-
 From: Gabriel Genellina [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, December 19, 2006 8:49 PM
 To: [EMAIL PROTECTED]
 Cc: python-list@python.org
 Subject: Re: Is htmlGen still alive?
 
 At Monday 18/12/2006 17:37, [EMAIL PROTECTED] wrote:
 
 Does anybody know whether htmlGen, the Python-class library for 
 generating HTML, is still being maintained? Or from where it can be 
 downloaded? The Starship site where it used to be hosted is dead.
 
 *active* in what sense? HTML std doesn't change all days, and 
 being a python only library, the only changes would be due to 
 compatibility issues or adopting new language features of new 
 python versions.
 BTW, I like HyperText more than htmlgen.
 
 
 --
 Gabriel Genellina
 Softlab SRL 
 
 
   
 
   
   
 __ 
 Pregunta. Respondi. Descubrm. 
 Todo lo que quermas saber, y lo que ni imaginabas, 
 esta en Yahoo! Respuestas (Beta). 
 !Probalo ya! 
 http://www.yahoo.com.ar/respuestas 
 
 

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


Re: What am I supposed to do with an egg?!

2006-12-20 Thread F. GEIGER

[EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
 Type sudo easy_install myeggfile.egg.

Sorry for not being clear. I did exec easy_install - no errors so far. But 
the egg was still there. I'd expected, that it was converted into .py-files 
somehow, which could be imported by my modules.

Kind regards
Morpheus


 If that gives you an error, then you don't have easy_install installed.
 Install it this way:

 sudo apt-get install python-setuptools

 On Dec 19, 3:44 pm, Morpheus [EMAIL PROTECTED] wrote:
 On Windows I'm used to install packages by setup.py install. So did I 
 with
 Fibranet nanothreads - a few seconds and it was installed.

 On Linux (ubuntu 6.06) all I could get at is an egg file. I found out 
 that
 I have to exec easy_install, which didn't much help here (seems to me, at
 least - sorry, Linux newbie).

 So, what am I supposed to do here now?

 Kind regards
 Morpheus
 


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


Re: regexp

2006-12-20 Thread Thomas Ploch
Mark Schoonover schrieb:
 
 You have to pay for this one, but I do like Komodo just for the regex
 feature. I'm rather new to Python, coming over from 10 years of Perl, and
 it's nice to have Komodo stay consistant. Can't wait for 4.0, so I can get
 back to having VI key commands Back into Learning Python, and DIP...

Yes, I love that, too. The Komodo Rx Toolkit is really good for people
who are new to regular expressions just to try them out, to get to know
grouping, to see how MULTILINE and other flags work.
I can recommend this to anyone who is new to regexes.

Thomas

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


Re: array, a better shell

2006-12-20 Thread Roland Puntaier
I have also used the shell of Mathematica. It's quite powerful and it
can show graphics too inlined, but globally I don't like it fully
because it makes editing small programs a pain (for me)...

I use Vim to edit python code and can execute any selection (F3) or single 
lines (F2) 
whenever I want to (Vim must be built to include the python interpreter).

Here is the according Vimrc code

pyout if present must be right below
r replaces, p prints, symb sets the start
py  EOL 
def PrintCurrentLine(*args): 
  cur_str = vim.current.line 
  action, symb = None, None 
  for i in args: 
if i in [r,p]: action = i 
else:  symb   = i 
  try:start = cur_str.rindex(symb)+len(symb) 
  except: start = 0 
  eval(compile(pyoutres=+cur_str[start:],'string','exec'),globals()) 
  result = eval(pyoutres,globals()) 
  if action == r: 
vim.current.line = cur_str[:start]+str(result) 
  else: 
iPy=PyOutput()
if iPy != -1:
  resS=cur_str+==+'\n'+str(result)+'\n'
  resL=resS.split('\n')
  vim.buffers[iPy].range(0,0).append(resL)
  vim.command(wincmd b)
  vim.command(normal gg)
  vim.command(wincmd p)
else:
  print result
EOL 
command -narg=* Pyl python PrintCurrentLine(f-args) 
map F2 :py PrintCurrentLine()CR

python  EOL 
def EvaluateCurrentRange(): 
  c_r=vim.current.range
  i=0
  while c_r[0].startswith(' '*(i+1)):
i+=1
  rngstr='\n'.join([ln[i:] for ln in c_r])
  eval(compile(rngstr,'string','exec'),globals()) 
EOL 
map F3 :py EvaluateCurrentRange()CR
-- 
http://mail.python.org/mailman/listinfo/python-list


Regexp Neg. set of chars HowTo?

2006-12-20 Thread durumdara
Hi!

I want to replace some seqs. in a html.
Let:
a-
b
= ab

but:
xxx -
b
must be unchanged, because it is not word split.

I want to search and replace with re, but I don't know how to neg. this 
set ['\ \n\t'].

This time I use full set without these chars, but neg. is better and 
shorter.

Ok, I can use [^\s], but I want to know, how to neg. set of chars.
sNorm1= '([^[\ \t\n]]{1})\-\br\ \/\\n' - this is not working.

Thanks for the help:
dd

sNorm1= '([%s]{1})\-\br\ \/\\n'
c = range(0, 256)
c.remove(32)
c.remove(13)
c.remove(10)
c.remove(9)
s = [\\%s % (hex(v).replace('00x', '')) for v in c]
sNorm1 = sNorm1 % (.join(s))
print sNorm1

def Normalize(Text):

rx = re.compile(sNorm1)
def replacer(match):
return match.group(1)
return rx.sub(replacer, Text)

print Normalize('a -br /\nb')
print Normalize('a-br /\nb')
sys.exit()

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


Re: What am I supposed to do with an egg?!

2006-12-20 Thread Duncan Booth
F. GEIGER [EMAIL PROTECTED] wrote:

 Sorry for not being clear. I did exec easy_install - no errors so far.
 But the egg was still there. I'd expected, that it was converted into
 .py-files somehow, which could be imported by my modules.

The .egg file should have been copied into your site-packages. Python can 
import directly from a .egg file (it is a zip archive containing .py 
files), or you can give easy_install an --always-unzip argument in which 
case it creates a folder with the same name (including the .egg extension) 
in site-packages and unzips the egg there.

Forcing an unzip can be useful if you want to use tools like pydoc which 
don't understand imports from zip files.

If you run python interactively and print sys.path then you should see 
any egg files you have installed have been added to the path.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: trouble getting google through urllib

2006-12-20 Thread BJörn Lindqvist
   Google doesnt like Python scripts. You will need to pretend to be a
   browser by setting the user-agent string in the HTTP header.
  
  and possibly also run the risk of having your system blocked by Google if
  they figure out you are lying to them?

 It is possible. I wrote a 'googlewhack' (remember them?) script a while
 ago, which pretty much downloaded as many google pages as my adsl could
 handle. And they didn't punish me for it. Although apparently they do
 issue short term bans on IP's that abuse their service.

For Google, that load must be piss in the ocean. I bet for Google to
even notice the abuse, it must be something really, really severe.

-- 
mvh Björn
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: array, a better shell

2006-12-20 Thread Neil Cerutti
On 2006-12-20, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 For array.array B means unsigned char, and such arrays accept to be
 initialized from (str) strings too, this is quite useful:

 from array import array
 a = array(B, hello)

 But it seems such capability isn't shared with the append:

 a.extend(hello)
 Traceback (most recent call last):
   File stdin, line 1, in module
 TypeError: an integer is required

Try:

 a.fromstring(hello)

-- 
Neil Cerutti
I have opinions of my own -- strong opinions -- but I don't always agree with
them. --George W. Bush
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] PyInstaller 1.3 released

2006-12-20 Thread Robin Becker
Giovanni Bajo wrote:
 Hello,
 
 PyInstaller 1.3 is out!
 
 Grab latest version at:
 http://pyinstaller.python-hosting.com/
..

I just tried this on something which we currently use py2exe+nsis to package 
and 
it certainly seems to produce a small exe, but when run I see a cryptic message 
on two message boxes

! msvcr71.dll

! could not be extracted

the program then exits.



When run with -X I saw output from the upx process
Ultimate Packer for eXecutables
 Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
UPX 2.03w   Markus Oberhumer, Laszlo Molnar  John ReiserNov 7th 2006

 File size Ratio  Format  Name
   --   ---   ---
 348160 -165888   47.65%win32/pe MSVCR71.dll

Packed 1 file.

So I'm just guessing there might be a case sensitivity issue in the unpacking 
somewhere.
-- 
Robin Becker

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


Re: python poetry?

2006-12-20 Thread BartlebyScrivener
Michael Spencer wrote:

 I wrote the following in response to Steve Holden's limerick challenge a
 couple of years ago:
 
Thanks! I found some of these searching the clp google group.

rd

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


Re: python-hosting.com projects: dead?

2006-12-20 Thread dwhall
My project was temporarily disabled as well even though I had taken
measures to block spam and had committed to svn and edited the trac
wiki one day before.  I was a bit concerned that maybe webfaction had
lost my trac and svn during their house cleaning.  But I emailed Remi
and he had it going again promptly.  They provide a great service for
free and they give back to the Python community.  They deserve our
thanks and our patronage.

With regard to how they handled it, I think they chose an effective
method.  Why should they support projects (for free) that aren't
active?  So just disable the project to see if anyone cares enough to
find out why it's gone.  Ever so slightly draconian, but good for
keeping a clean house.  I'm glad they have done this cleaning work, the
server seems much more responsive now; no more errors from trac.

!!Dean


[EMAIL PROTECTED] wrote:
 Fredrik Lundh wrote:
  [EMAIL PROTECTED] wrote:
 
   my svn repository and tickets again. I'm sure you can understand why I
   was dismayed by this and why, unfortunately, I'll never be comfortable
   trusting my data to them again.
 
  not really, but maybe I've just worked with computers and human beings
  long enough not to treat every little hiccup as if it were the end of
  the world as we know it.

 You're misreading me very badly, or I'm expressing myself very poorly.
 Either way, you've inferred some kind of spittle-flecked freakout where
 I did not mean to imply one. 
 
 JP

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


Re: trouble getting google through urllib

2006-12-20 Thread Fredrik Lundh
BJörn Lindqvist wrote:

 For Google, that load must be piss in the ocean. I bet for Google to
 even notice the abuse, it must be something really, really severe.

like, say, business?

http://scripting.wordpress.com/2006/12/19/scripting-news-for-12192006/#comment-25891

/F

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


Re: Any easy-to-use email send module?

2006-12-20 Thread Larry Bates
oyster wrote:
 I find that the existing email moudle is some hard for me to
 understand, especially the part of how to set the CC, BCC and attach
 the files. Is there any more easy one like this p-code?
 
 import easyemail
 smtpserver=easyemail.server('something')
 smtpserver.login('[EMAIL PROTECTED]', pwd)
 newletter=smtpsever.letter(smtpserver)
 newletter.sendto=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
 newletter.sendcc=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
 newletter.sendbcc=['[EMAIL PROTECTED]', '[EMAIL PROTECTED]']
 newletter.body='this is the body\nline 2'
 newletter.att=['c:/file1.txt', 'd:/program files/app/app.exe']
 
 if (newletter.send()==True):
print 'send ok'
 smtpserver.close()
 
 Thanx.
I'm not entirely sure where I got this code (Google search
years ago) and I've extended it a little, but you are welcome
to use it and it is very close to what you outlined above.
I had to strip out a bunch of custom logging that I include
in my version, but it think this will either work or at least
be close enough to save you some time.

-Larry


import string,sys,types,os,tempfile,time
import smtplib
import poplib
import mimetypes,mimetools,MimeWriter
class SmtpWriter:
def __init__(self, server=localhost, dest=None, src=None,
 userid=None, password=None):

self.__server = server
self.__dest   = dest
self.__src= src
self.__userid = userid
self.__password=password
self.__debugLevel = 0
return

def Debug(self,level):
 self.__debugLevel = level


def Message(self,sender=,
 subject=,
 recipients=[],
 body=,
 attachments=[]):


if self.__debugLevel  2:
sys.stderr.write(SmtpWriter: Building RFC822 message From: %s;  \
 Subject: %s; (Length=%d with %d attachments)\n % 
\
 (sender, subject, len(body), len(attachments)))

sys.stderr.flush()

tempFileName = tempfile.mktemp()
tempFile = open(tempFileName,'wb')
message = MimeWriter.MimeWriter(tempFile)
message.addheader(From,sender)
message.addheader(To, reduce(lambda a,b: a + ,\n + b, 
recipients))
message.addheader(Subject, subject)
message.flushheaders()
if len(attachments) == 0:
fp = message.startbody('text/plain')
fp.write(body)
else:
message.startmultipartbody('mixed')
submessage = message.nextpart()
fp = submessage.startbody('text/plain')
fp.write(body)
for attachFile in attachments:
if type(attachFile) == types.StringType:
fileName = attachFile
filePath = attachFile

elif type(attachFile) == types.TupleType and len(attachFile) == 
2:
filePath, fileName = attachFile
else:
raise Attachments Error: must be pathname string or
path,filename tuple

submessage = message.nextpart()
submessage.addheader(Content-Disposition, attachment;
filename=%s % fileName)
ctype,prog = mimetypes.guess_type(fileName)
if ctype == None:
ctype = 'unknown/unknown'

if ctype == 'text/plain':
enctype = 'quoted-printable'
else:
enctype = 'base64'

submessage.addheader(Content-Transfer-Encoding,enctype)
fp = submessage.startbody(ctype)
afp = open(filePath,'rb')
mimetools.encode(afp,fp,enctype)

message.lastpart()

tempFile.close()

# properly formatted mime message should be in tmp file

tempFile = open(tempFileName,'rb')
msg = tempFile.read()
tempFile.close()
os.remove(tempFileName)
#print about to try to create SMTPserver instance
server=None

#
# See if I can create a smtplib.SMTP instance
#
try: server = smtplib.SMTP(self.__server)
except:
if self.__debugLevel  2:
emsg=SmtpWriter.Message-Unable to connect to  \
 SMTP server=%s % self.__server
sys.stderr.write(emsg)
sys.stderr.flush()

raise RuntimeError(emsg)

if self.__debugLevel  2: server.set_debuglevel(1)
#
# If server requires authentication to send mail, do it here
#
if self.__userid is not None and self.__password is not None:
#
# There are two possible ways to authenticate: direct or indirect
# direct - smtp.login
# indirect - smtp after pop3 auth
#
try: response=server.login(self.__userid, self.__password)
except:
if 

Stani's Python Editor - questions

2006-12-20 Thread Laszlo Nagy

  Hello,

I was trying to get answers for these. SPE homepage was down. Then I 
found it on berlios 
(http://developer.berlios.de/forum/forum.php?forum_id=12695) but no one 
answered since 5 days. In fact nobody seems to write in anything to that 
forum, I presume it is dead. I have no other choice than ask it here. I 
apologize in advance, they may be silly questions.

1. How can I navigate between opened files? Usually I open 10 or more 
files at the same time. There is no way to quickly scroll the tabs and 
select the one that I want. Tabs simply run out of my screen.
2. I tried to use the Browser for navigation but it tells me file is 
already open and it won't switch to the file. Annoying.
3. I also tried to go to the file using Ctrl+Enter (when the name of the 
file is written under the cursor). The same problem: it tells file is 
already open, and it will not switch to the (already opened) file.
4. While running a program from inside SPE, the output window display 
everything in HTML, including the stdout of the program. I have a 
program that produces a very nice output when I run it from a terminal. 
But it is unbelievable what it looks like when I run it from SPE. :-) 
Especially if you print messages like class __main__.A they will 
silently disappear from the output screen because they look like an 
invalid HTML tag. Frustrating.
5. There should be a an option to clear the output panel before running 
the program anyway. I see no way to clear it at all.
6. When I create a new file and select File/Save as, the dialog window 
comes up. It is so small that I cannot see the names of the shortest 
files and it is not resizeable.
7. Whenever I open a file or start a program inside SPE, I get a Failed 
to display HTML document in ISO-8859-1 encoding error message.
8. The Explore panel on the left comes up for every file that I open. 
I do not want it to come up by default, because I have screen resolution 
problems.

I did not find any options/preferences to change the above things. Some 
of the above might be new feature requests. I recently switched from 
DrPython to SPE. SPE has more functions and it could be much much better 
than DrPython, but it has big problems. For example, I like that SPE 
saves the workspace automatically for me. But it takes two minutes to 
start up SPE, because I have to press the OK button on the ISO8859-1 
message for each file that is re-opened. I very like the Browser window, 
but I cannot use it for navigation. I like the new style save file 
dialog, but I cannot use it because it is small. I like the code 
completion. (dot) :-)

Thanks,

   Laszlo

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


Re: Fall of Roman Empire

2006-12-20 Thread Chris Mellon
On 12/20/06, Ben Finney [EMAIL PROTECTED] wrote:
 John Machin [EMAIL PROTECTED] writes:

  Ben Finney wrote:
 
\  ...one of the main causes of the fall of the Roman Empire was |
 `\that, lacking zero, they had no way to indicate successful |
   _o__)   termination of their C programs.  -- Robert Firth |
 
  An amusing .sig, but it doesn't address the root cause: As they had no
  way of testing for the end of a string, in many cases successful
  termination of their C programs would have been unlikely.

 Yet historically proven: the 'imperium' process they were running
 terminated many centuries ago.

 Or did it fork and exec a different process?


According to the C standard (16AD version), access past the end of an
imperial era results in undefined behavior.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MySQLdb, lots of columns and newb-ness

2006-12-20 Thread Ant


On Dec 20, 5:20 am, Andrew Sackville-West [EMAIL PROTECTED]
wrote:
   values = , .join([escapeAndQuote(f[:-2]) for f in fields])

Obviously this is the appropriate choice since this is a database app.
In general the strip() group of string methods do what you want in a
safe way - assuming you don't care about whitespace:

 s =test   \r\n
 s.strip()
'test'
 s.rstrip()
'   test'
 s.lstrip()
'test   \r\n'

If you are concerned about whitespace:
 s.strip(\n\r)
'   test   '

strips any \n's or \r's from the ends of the line.

This way it doesn't matter what your line endings are -  you won't be
surprised by missing characters if the data dump changes for any
reason.

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


Support of IPv6 extension headers

2006-12-20 Thread cychong
Hi,

There is no probleming in programming the basic IPv6 socket program
with the python.
Then how about the IPv6 extension header? The RFC 2292 and man pages
from the unix/linux advise
to use the sendmsg to send the packet with the extension header.
Does python support the extension header processing?

Googling told me that there is no one to try this one with the
python.Is it true?

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


Re: Support of IPv6 extension headers

2006-12-20 Thread Jean-Paul Calderone
On 20 Dec 2006 07:07:02 -0800, cychong [EMAIL PROTECTED] wrote:
Hi,

There is no probleming in programming the basic IPv6 socket program
with the python.
Then how about the IPv6 extension header? The RFC 2292 and man pages
from the unix/linux advise
to use the sendmsg to send the packet with the extension header.
Does python support the extension header processing?

Python doesn't expose sendmsg.  There are several third-party
modules which do, though.  Googling for python sendmsg turns
up some useful links.

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


Re: update attribute - (newbie)

2006-12-20 Thread Gabriel Genellina

At Tuesday 19/12/2006 11:49, Larry Bates wrote:


 I would like to have it that when I ask for p, method _get_p is always
 called so that attribute can be updated. How can I have this
 functionality here? thanks

Something like this?

class A:
def __init__(self):
self.t=4
return

def __getattr__(self, name):
if name == 'p': return self.t
else: return self.__dict__[name]


__getattr__ is called *after* normal lookup has failed, so using 
__dict__ here is useless (and wrong, because this method should raise 
AttributeError but will raise KeyError instead)

A property is more convenient in this case.


--
Gabriel Genellina
Softlab SRL 







__ 
Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas 

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

Re: cross-compiling python: reviewers needed

2006-12-20 Thread David Boddie
Han-Wen Nienhuys wrote:

 I have a small patch for Python SVN that makes it possible to
 cross-compile python on Unix to various other Unix targets.
 I have successfully built a binary for FreeBSD on Linux.

 The patch is available at
 https://sourceforge.net/tracker/?func=detailatid=305470aid=1597850group_id=5470

 (file cross.patch)

 but it awaits further review.

 I'm looking for people willing to try this out, and give further
 review to the patch, so it may be applied to SVN.

 All you need is a bit of time, and experience in cross-compiling.

For various reasons, I don't have the time or resources to really look
at your patch in any detail. I was only able to quickly look through it
and see how you did certain things, such as specifying a Python build
interpreter and splitting up pgen's build rules. I modified the build
system in a similar way, so it was reassuring to see similar solutions.

Some comments:

I noticed that you define a CROSS_COMPILING environment variable so
that you know when to use the right tools. Is this a standard variable
name in other projects that allow cross-compilation?

You rely on an existing Python installation on the build machine.
Does this influence the configuration process, or the availability of
non-pure Python extension modules?

Does the configuration process still cause the tests to be built for
the build machine? This seems like a redundant step: ideally, the
tests would be run on the target machine in a separate step.


The above points are only observations, though. The patch looks like a
good first step towards a more configurable build system for Python.
It would be even better if, in the future, separate patches could
enable custom builds as well. This would, for example, allow minimal
Python distributions to be made by stripping out lots of modules that
are unavailable or unsuitable for use on embedded hardware.

David

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


Re: Fall of Roman Empire

2006-12-20 Thread Thomas Ploch
 Ben Finney schrieb:
 John Machin [EMAIL PROTECTED] writes:

 Ben Finney wrote:

  \  ...one of the main causes of the fall of the Roman Empire was |
   `\that, lacking zero, they had no way to indicate successful |
 _o__)   termination of their C programs.  -- Robert Firth |
 An amusing .sig, but it doesn't address the root cause: As they had no
 way of testing for the end of a string, in many cases successful
 termination of their C programs would have been unlikely.
 Yet historically proven: the 'imperium' process they were running
 terminated many centuries ago.

 Or did it fork and exec a different process?


I rather stay with the metaphysics:


#include metaphysics.h

static metaPower God;

universe *makeUniverse(metaPower God)
{
if (!God) {
printf(Oops, no God available at the moment.Try again later!);
return NULL;
}

universe *everything;

if (!(everything = malloc(sizeof(universe {
God.mood = REALLY_BORED;
printf(God has no time to create a universe.);
return NULL;
} else {
return universe;
}
}


 :-)

Sorry, somehow had to do this. Please slap me (i like it, don't worry)
if it's totally stupid


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


Re: Fall of Roman Empire

2006-12-20 Thread Felix Benner
Thomas Ploch schrieb:
 Ben Finney schrieb:
 John Machin [EMAIL PROTECTED] writes:

 Ben Finney wrote:

  \  ...one of the main causes of the fall of the Roman Empire was |
   `\that, lacking zero, they had no way to indicate successful |
 _o__)   termination of their C programs.  -- Robert Firth |
 An amusing .sig, but it doesn't address the root cause: As they had no
 way of testing for the end of a string, in many cases successful
 termination of their C programs would have been unlikely.
 Yet historically proven: the 'imperium' process they were running
 terminated many centuries ago.

 Or did it fork and exec a different process?

 
 I rather stay with the metaphysics:
 
 
 #include metaphysics.h
 
 static metaPower God;
 
 universe *makeUniverse(metaPower God)
 {
 if (!God) {
 printf(Oops, no God available at the moment.Try again later!);
 return NULL;
 }
 
 universe *everything;
 
 if (!(everything = malloc(sizeof(universe {
 God.mood = REALLY_BORED;
 printf(God has no time to create a universe.);
 return NULL;
 } else {
 return universe;
 }
 }
 
 
  :-)
 
 Sorry, somehow had to do this. Please slap me (i like it, don't worry)
 if it's totally stupid
 
 

s totally stupid! You forgot the main function! (not to mention you
returned universe instead of everything)

static int main(int argc, char **argv) {
char *god_name;
if (argc)
god_name = argv[1];
else
god_name = YHWH;
metaPower God = getGodByName(god_name);
universe *everything = makeUniverse(God);
while (simulatePhysics(everything));
return 0;
}
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fall of Roman Empire

2006-12-20 Thread Thomas Ploch
Felix Benner schrieb:
 Thomas Ploch schrieb:
 Ben Finney schrieb:
 John Machin [EMAIL PROTECTED] writes:

 Ben Finney wrote:

  \  ...one of the main causes of the fall of the Roman Empire was |
   `\that, lacking zero, they had no way to indicate successful |
 _o__)   termination of their C programs.  -- Robert Firth |
 An amusing .sig, but it doesn't address the root cause: As they had no
 way of testing for the end of a string, in many cases successful
 termination of their C programs would have been unlikely.
 Yet historically proven: the 'imperium' process they were running
 terminated many centuries ago.

 Or did it fork and exec a different process?

 I rather stay with the metaphysics:


 #include metaphysics.h

 static metaPower God;

 universe *makeUniverse(metaPower God)
 {
 if (!God) {
 printf(Oops, no God available at the moment.Try again later!);
 return NULL;
 }

 universe *everything;

 if (!(everything = malloc(sizeof(universe {
 God.mood = REALLY_BORED;
 printf(God has no time to create a universe.);
 return NULL;
 } else {
 return universe;
 }
 }


  :-)

 Sorry, somehow had to do this. Please slap me (i like it, don't worry)
 if it's totally stupid


 
 s totally stupid! You forgot the main function! (not to mention you
 returned universe instead of everything)

Argh, I need some serious slapping (but I changed everything and
universe, and just forgot to change it all the way through (...good that
I am _not_ God)

 static int main(int argc, char **argv) {
   char *god_name;
   if (argc)
   god_name = argv[1];
   else
   god_name = YHWH;
   metaPower God = getGodByName(god_name);
   universe *everything = makeUniverse(God);
   while (simulatePhysics(everything));
   return 0;
 }

You forgot to check if God wasn't too bored. ;-)

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


Re: Any easy-to-use email send module?

2006-12-20 Thread ina
I put this together for some automated testing I do with an email
system.  I hope it is of help to you.

It dosn't do cc and bcc In this version but it would be simple to add
to the eMessage headder.

http://phlik.ishpeck.net/index.php?P=b1114201575phlik

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


[ANNOUNCE] Thirty-fifth release of PythonCAD now available

2006-12-20 Thread Art Haas
Hi.

I'm pleased to announce the thirty-fifth development release of PythonCAD,
a CAD package for open-source software users. As the name implies,
PythonCAD is written entirely in Python. The goal of this project is
to create a fully scriptable drafting program that will match and eventually
exceed features found in commercial CAD software. PythonCAD is released
under the GNU Public License (GPL).

PythonCAD requires Python 2.2 or newer. The interface is GTK 2.0
based, and uses the PyGTK module for interfacing to GTK. The design of
PythonCAD is built around the idea of separating the interface
from the back end as much as possible. By doing this, it is hoped
that both GNOME and KDE interfaces can be added to PythonCAD through
usage of the appropriate Python module. Addition of other PythonCAD 
interfaces will depend on the availability of a Python module for that
particular interface and developer interest and action.

The thirty-fifth release contains several improvements dealing
with the storage and adjustment of user preferences and image settings.
The global user preferences are now saved into a file kept in the
user home directory, so the settings are now preserved between
PythonCAD sessions. Individual drawing settings can be examined and
adjusted via a new set of menus and dialogs. These new dialogs are
more complete than the single dialog previously used as well as
easier to use. In addition to the preference and setting changes, a
variety of bug fixes and miscellaneous code improvements are also
present in this new release.

A mailing list for the development and use of PythonCAD is available.
Visit the following page for information about subscribing and viewing
the mailing list archive:

http://mail.python.org/mailman/listinfo/pythoncad

Visit the PythonCAD web site for more information about what PythonCAD
does and aims to be:

http://www.pythoncad.org/

Come and join me in developing PythonCAD into a world class drafting
program!

Art Haas
-- 
Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fall of Roman Empire

2006-12-20 Thread Georg Brandl
Felix Benner schrieb:

 Sorry, somehow had to do this. Please slap me (i like it, don't worry)
 if it's totally stupid
 
 
 
 s totally stupid! You forgot the main function! (not to mention you
 returned universe instead of everything)
 
 static int main(int argc, char **argv) {
   char *god_name;
   if (argc)
   god_name = argv[1];
   else
   god_name = YHWH;
   metaPower God = getGodByName(god_name);
   universe *everything = makeUniverse(God);
   while (simulatePhysics(everything));
   return 0;
 }

Well, I'd expect God to be more clever as to do it that way.
Could you imagine toying around with your universe in C?

No, it must have been

static PyObject *
create_universe(char *god_name) {
PyObject *universe;
universe = PyObject_New(universetype, PyUniverse_Type);
if (!universe) {
PyErr_SetString(PyExc_CreationError,
Out of spacetime, or BDFL is too busy hacking 
on web-based collaboration tools);
return NULL;
}
universe-un_god = PyGod_FromName(god_name);
universe-un_size = 0;
universe-un_expand_rate = COSMOLOGICAL_CONSTANT;
return universe;
}

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


perl better than python for users with disabilities?

2006-12-20 Thread Dan Jacobson
Can I feel even better about using perl vs. python, as apparently
python's dependence of formatting, indentation, etc. vs. perl's
(){}; etc. makes writing python programs perhaps very device
dependent. Whereas perl can be written on a tiny tiny screen, and can
withstand all kinds of users with various disabilities, etc.?
Also perl is easier to squeeze into makefiles.

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


Re: merits of Lisp vs Python

2006-12-20 Thread Anders J. Munch
jayessay wrote:
   Please note: GC is not part of CL's definition.  It is likely not part
 of any Lisp's definition (for reasons that should be obvious), and for
 the same reasons likely not part of any language's definition.  

Really?  So how do you write a portable program in CL, that is to run 
for unbounded lengths of time?

- Anders

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


Re: Fall of Roman Empire

2006-12-20 Thread Sion Arrowsmith
Ben Finney  [EMAIL PROTECTED] wrote:
John Machin [EMAIL PROTECTED] writes:
 Ben Finney wrote:
   \  ...one of the main causes of the fall of the Roman Empire was |
`\that, lacking zero, they had no way to indicate successful |
  _o__)   termination of their C programs.  -- Robert Firth |
 [ ... ] in many cases successful
 termination of their C programs would have been unlikely.
Yet historically proven: the 'imperium' process they were running
terminated many centuries ago.

Or did it fork and exec a different process?

Pretty much. Except they would argue that the child process
(Byzantium) never exec'd.

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  Frankly I have no feelings towards penguins one way or the other
  \X/  |-- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

tkFileDialog closes main application

2006-12-20 Thread mdmdmd
Hello,

I wish to collect 4 files from a user.  So I have decided to use 
tkFileDialog askopenfilename.  My problem is that after a few file 
selections the root window is destroyed (the whole program just dissappears)

I have created a simple example and was able to reproduce the same thing 
with this.  I've just started using tkinter so I have no idea what I may 
be doing wrong.  If anyone has any ideas please let me know.

If you run the following code, just click the Browse button, and select 
a file.  Do this repeatedly and for me after the sixth or seventh time 
the window shuts down.

BTW, I'm using python 2.4 on Windows XP.  Thank you for any help.



from Tkinter import *
import Pmw
import tkFileDialog
import os.path

filepath = 'C:\\Documents and Settings\\admin\\Desktop\\'

class App(Frame):
 def __init__(self,master):
 Frame.__init__(self, master, bg='gray')
 self.enttxt = StringVar()

 lbl = Label(self,text='File 1:')
 lbl.grid(row = 0,column = 0,sticky = W,padx = 5,pady = 5)

 self.e1 = Entry(self,textvariable = self.enttxt,width = 50)
 self.e1.grid(row = 0,column = 1,columnspan = 3,sticky = W,padx 
= 5,pady = 5)

 btn = Button(self,text='Browse ...',width = 12,
  command = self.browse)
 btn.grid(row = 0,column = 4,sticky=W,padx=5,pady=5)

 def browse(self):
 fileformats = [('Text File ','*.csv'),
('All Files ','*.*')]

 retval = tkFileDialog.askopenfilename(title='Choose File',
   initialdir=filepath,
   filetypes=fileformats,
   parent = self)
 if retval:
 self.enttxt.set(os.path.abspath(retval))

def main():
 root = Tk()
 root.withdraw()
 root.title('test')
 root.configure(bg='gray')
 app = App(root)
 app.pack()
 root.update()
 root.deiconify()

 root.mainloop()


if __name__ == '__main__':
 main()
-- 
http://mail.python.org/mailman/listinfo/python-list


your opinion about psycopg vs pygresql

2006-12-20 Thread Martin P. Hellwig
Hi all,

I'm playing a bit with PostgreSQL, in which I've set me the target to 
create a python script which with user input creates a new user role and 
a database with that owner (connecting to template1 since I know that at 
least that db exists).

Ok so I installed PostGreSQL and pygresql since it looked like that this 
is endorsed by PG, I had some trouble with the DB-API2 (complains about 
there is already a connection to template1, even when I closed and 
deleted the connector) so I solved it by using the pg api.

But I was intrigued by this problem and started googling and by that 
time I've noticed that python projects like Django seem to favor the 
psycopg module.

So I installed that one (the 1.1 version, since Django uses that too) 
and it looked like it has the same problem of creating a user after a 
database, I'm sure that there is a user error in there somewhere :-)

However, given the choice, what in your opinion would be the reason why 
someone would chose one over the other? Now I know this could easily get 
into a flamewar, so if you comment (but please do so) I'll still 
investigate that, since at this moment I don't even have a clue how they 
differ and on what reason, why does PostgreSQL seem to favour pygresql 
and Pythoneers psycopg?

Thanks in advance.

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


Re: perl better than python for users with disabilities?

2006-12-20 Thread Martin P. Hellwig
Dan Jacobson wrote:
 Can I feel even better about using perl vs. python, as apparently
 python's dependence of formatting, indentation, etc. vs. perl's
 (){}; etc. makes writing python programs perhaps very device
 dependent. Whereas perl can be written on a tiny tiny screen, and can
 withstand all kinds of users with various disabilities, etc.?
 Also perl is easier to squeeze into makefiles.
 
Quite punny title though I assume you are really serious and mean people 
with a physical disability, I won't comment any further on this subject 
:-), if I already offended anyone, please excuse me, since I'm original 
from Germany I'm not supposed to be funny.

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


Re: perl better than python for users with disabilities?

2006-12-20 Thread Michele

What about indenting with a single space?
This does not seem a problem to me, even on tiny tiny screens =)

On 12/20/06, Dan Jacobson [EMAIL PROTECTED] wrote:


Can I feel even better about using perl vs. python, as apparently
python's dependence of formatting, indentation, etc. vs. perl's
(){}; etc. makes writing python programs perhaps very device
dependent. Whereas perl can be written on a tiny tiny screen, and can
withstand all kinds of users with various disabilities, etc.?
Also perl is easier to squeeze into makefiles.

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

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

Re: perl better than python for users with disabilities?

2006-12-20 Thread Thomas Ploch
Martin P. Hellwig schrieb:
 Quite punny title though I assume you are really serious and mean people 
 with a physical disability, I won't comment any further on this subject 
 :-), if I already offended anyone, please excuse me, since I'm original 
 from Germany I'm not supposed to be funny.

Argh, I am writing to President Horst Köhler to take away your German
citizenship. You _need_ to stay true to German attributes (like not
being funny, what you have been...)! This is the last warning!

:-D

Regarding the topic:

I can't see where Perl should be more accessible than Python.

Thomas

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


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Fredrik Lundh
Paul Arthur wrote:

 no, I'm showing that a local file marked as executable overrides a 
 shared one, even if the local file isn't actually an executable.
 
 Only if you have your system set up badly.  The current directory should
 not be in the search path, and it especially shouldn't have higher
 priority than the regular bin locations.

and the award for completely missing the context of this subthread goes 
to...

/F

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


Re: merits of Lisp vs Python

2006-12-20 Thread Rob Thorpe
Anders J. Munch wrote:
 jayessay wrote:
Please note: GC is not part of CL's definition.  It is likely not part
  of any Lisp's definition (for reasons that should be obvious), and for
  the same reasons likely not part of any language's definition.

 Really?  So how do you write a portable program in CL, that is to run
 for unbounded lengths of time?

You can't.

The thing about the spec not defining GC is almost a bit of humour.
No-one would use an implementation with no GC.

The issue with specifying it is: How would you do it?  The memory used
by a program is an aspect of the language implementation and the system
the program is running on, so how can it be defined in a useful way?

You could say for example Storage allocated for an object is released
when the object is no longer visible and memory usage is high.  But
how do you define how high memory usage should be?  You could say when
memory is almost exhausted, even that is difficult to define.  Then you
could have the situation where someone creates a lisp compiler than
emits FPGA netlists, how do you check something like this?

None of this would be in the spirit of the spec, which doesn't even
define memory AFAIK.  The spec deals entirely in matters of the
language and it's appearance to the programmer.  For what it's worth I
think the C spec is the same, and says nothing about actual memory
usage.

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


PIL broken on win32?

2006-12-20 Thread Chris Mellon
PIL 1.1.5  and 1.1.6 both seem to be broken, in different ways, on win32.

1.1.5 will load and access images, but ImageDraw fails:
i = Image.open(good.jpg)
d = ImageDraw.Draw(i)
d.line((10,10,20,20))
Traceback (most recent call last):
  File input, line 1, in ?
  File C:\Python24\Lib\site-packages\PIL\ImageDraw.py, line 199, in line
self.draw.draw_lines(xy, ink, width)
TypeError: function takes exactly 2 arguments (3 given)

1.1.6 is just broken in general - any access to image data fails:
i = Image.open(good.jpg)
d = i.getdata()
Traceback (most recent call last):
  File input, line 1, in ?
  File C:\Python24\Lib\site-packages\PIL\Image.py, line 860, in getdata
self.load()
  File C:\Python24\Lib\site-packages\PIL\ImageFile.py, line 217, in load
return Image.Image.load(self)
  File C:\Python24\Lib\site-packages\PIL\Image.py, line 599, in load
return self.im.pixel_access(self.readonly)
AttributeError: pixel_access


These are the binary distributions for Python 2.4 off the effbot
download at http://effbot.org/downloads/#PIL

I tried with Python 2.5 quickly too - both 1.1.5 and 1.1.6 failed at
the same function that 1.1.5 for 2.4 failed at, but with a
SystemError: new style getargs format but argument is not a tuple
exception.
-- 
http://mail.python.org/mailman/listinfo/python-list


Does any one know of any good folder/directory modules

2006-12-20 Thread moishyyehuda
Hi

Does any one know of any good folder/directory modules. I need to be
able to see what files and directories are in a folder, I also need to
be able to see the size of the directory content.

Thanks

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


error with IDLE on debian

2006-12-20 Thread altern
Hi

when i try to run IDLE on my debian laptop I get this error.

$ idle
Traceback (most recent call last):
   File /usr/bin/idle, line 5, in ?
 main()
   File idlelib/PyShell.py, line 1359, in main
   File idlelib/FileList.py, line 44, in new
   File idlelib/PyShell.py, line 105, in __init__
   File idlelib/EditorWindow.py, line 111, in __init__
   File /usr/lib/python2.4/lib-tk/Tkinter.py, line 2764, in __init__
 Widget.__init__(self, master, 'text', cnf, kw)
   File /usr/lib/python2.4/lib-tk/Tkinter.py, line 1865, in __init__
 self.tk.call(
_tkinter.TclError: expected integer but got `100

I am not sure about what could cause the problem because I didnt use my 
laptop for python programming for couple of weeks. Before that it worked 
fine. And on that period i might have installed few things.

I am running Debian unstable with python 2.2.4, tcl8.4, tk8.4, python-tk 
24.4-1 and IDLE 2.4.4-2. I already tried to reinstall IDLE, tk and tcl 
and python-tk but that did not solve anything, i keep getting the same 
error.

any ideas?

thanks

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


Re: merits of Lisp vs Python

2006-12-20 Thread [EMAIL PROTECTED]

Anders J. Munch wrote:
 jayessay wrote:
Please note: GC is not part of CL's definition.  It is likely not part
  of any Lisp's definition (for reasons that should be obvious), and for
  the same reasons likely not part of any language's definition.

 Really?  So how do you write a portable program in CL, that is to run
 for unbounded lengths of time?

 - Anders

Write it, and depend on the implementation to do its job well, and
complain to the implementors if it doesn't.

How do you write a portable program in C that is to run for unbounded
lengths of time? Even if you religiously call free() on every
malloc()'d block, you could eventually fragment memory enough that the
allocator might eventually fail. You can exceed the VM capacity. The OS
could decide to crash periodically. The power supply could fail, the
sun could progress to the red giant phase...

The real answer is that these are not issues for the language
definition, but for the implementor.

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


Re: Does any one know of any good folder/directory modules

2006-12-20 Thread Thomas Ploch
[EMAIL PROTECTED] schrieb:
 Hi
 
 Does any one know of any good folder/directory modules. I need to be
 able to see what files and directories are in a folder, I also need to
 be able to see the size of the directory content.
 
 Thanks
 

You should have a look here:

http://docs.python.org/lib/os-file-dir.html#os-file-dir

Thomas


(This could have been done by yourself, but I am in a christmasly mood)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL broken on win32?

2006-12-20 Thread Fredrik Lundh
Chris Mellon wrote:

 PIL 1.1.5  and 1.1.6 both seem to be broken, in different ways, on win32.
 
 1.1.5 will load and access images, but ImageDraw fails:
 i = Image.open(good.jpg)
 d = ImageDraw.Draw(i)
 d.line((10,10,20,20))
 Traceback (most recent call last):
   File input, line 1, in ?
   File C:\Python24\Lib\site-packages\PIL\ImageDraw.py, line 199, in line
 self.draw.draw_lines(xy, ink, width)
 TypeError: function takes exactly 2 arguments (3 given)
 
 1.1.6 is just broken in general - any access to image data fails:
 i = Image.open(good.jpg)
 d = i.getdata()
 Traceback (most recent call last):
   File input, line 1, in ?
   File C:\Python24\Lib\site-packages\PIL\Image.py, line 860, in getdata
 self.load()
   File C:\Python24\Lib\site-packages\PIL\ImageFile.py, line 217, in load
 return Image.Image.load(self)
   File C:\Python24\Lib\site-packages\PIL\Image.py, line 599, in load
 return self.im.pixel_access(self.readonly)
 AttributeError: pixel_access

looks like you're using a 1.1.5 core DLL with 1.1.6.  look for multiple 
copies of _imaging.pyd under c:\python24.

/F

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


Re: merits of Lisp vs Python

2006-12-20 Thread Pascal Bourguignon
Rob Thorpe [EMAIL PROTECTED] writes:

 Anders J. Munch wrote:
 jayessay wrote:
Please note: GC is not part of CL's definition.  It is likely not part
  of any Lisp's definition (for reasons that should be obvious), and for
  the same reasons likely not part of any language's definition.

 Really?  So how do you write a portable program in CL, that is to run
 for unbounded lengths of time?

 You can't.

You can.  Just use reversible operations.

Or use pre-allocated objects. Yes, that means that you implement your
own memory management or garbage collector, but this would be portable.

-- 
__Pascal Bourguignon__ http://www.informatimago.com/

Do not adjust your mind, there is a fault in reality
 -- on a wall many years ago in Oxford.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Sebastian 'lunar' Wiesner
Fredrik Lundh [EMAIL PROTECTED] schrieb

 Paul Arthur wrote:
 
 no, I'm showing that a local file marked as executable overrides a
 shared one, even if the local file isn't actually an executable.
 
 Only if you have your system set up badly.  The current directory
 should not be in the search path, and it especially shouldn't have
 higher priority than the regular bin locations.
 
 and the award for completely missing the context of this subthread
 goes to...

Nevertheless his comment was absolutely correct...

-- 
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: perl better than python for users with disabilities?

2006-12-20 Thread Georg Brandl
Thomas Ploch schrieb:
 Martin P. Hellwig schrieb:
 Quite punny title though I assume you are really serious and mean people 
 with a physical disability, I won't comment any further on this subject 
 :-), if I already offended anyone, please excuse me, since I'm original 
 from Germany I'm not supposed to be funny.
 
 Argh, I am writing to President Horst Köhler to take away your German
 citizenship. You _need_ to stay true to German attributes (like not
 being funny, what you have been...)! This is the last warning!

I don't think he'd have the time for that. I heard he's busy planning
his lawsuit to enforce his claim for more pension.

 Regarding the topic:
 
 I can't see where Perl should be more accessible than Python.

Well, not really. But your $, @, %, {, }, ! etc. keys should be
accessible very fast if you want to write Perl.

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


Re: Need Simple Way To Determine If File Is Executable

2006-12-20 Thread Fredrik Lundh
Sebastian 'lunar' Wiesner wrote:

 no, I'm showing that a local file marked as executable overrides a
 shared one, even if the local file isn't actually an executable.
 
 Only if you have your system set up badly.  The current directory
 should not be in the search path, and it especially shouldn't have
 higher priority than the regular bin locations.
 
 and the award for completely missing the context of this subthread
 goes to...
 
 Nevertheless his comment was absolutely correct...

nope.  a Unix system uses the same flag to determine if a file is 
executable no matter how I've set up my path.

/F

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


Re: What am I supposed to do with an egg?!

2006-12-20 Thread Morpheus
On Wed, 20 Dec 2006 13:35:26 +, Duncan Booth wrote:

 F. GEIGER [EMAIL PROTECTED] wrote:
 
 Sorry for not being clear. I did exec easy_install - no errors so far.
 But the egg was still there. I'd expected, that it was converted into
 .py-files somehow, which could be imported by my modules.
 
 The .egg file should have been copied into your site-packages. Python can 
 import directly from a .egg file (it is a zip archive containing .py 
 files), or you can give easy_install an --always-unzip argument in which 
 case it creates a folder with the same name (including the .egg extension) 
 in site-packages and unzips the egg there.

Thanx a lot! sudo python setup.py easy_install --always-unzip . did the
trick

Kind regards
Morpheus


 
 Forcing an unzip can be useful if you want to use tools like pydoc which
 don't understand imports from zip files.
 
 If you run python interactively and print sys.path then you should see
 any egg files you have installed have been added to the path.

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


Re: MySQLdb, lots of columns and newb-ness

2006-12-20 Thread Andrew Sackville-West
On Wed, Dec 20, 2006 at 07:00:38AM -0800, Ant wrote:
 
 
 On Dec 20, 5:20 am, Andrew Sackville-West [EMAIL PROTECTED]
 wrote:
values = , .join([escapeAndQuote(f[:-2]) for f in fields])
 
 Obviously this is the appropriate choice since this is a database app.
 In general the strip() group of string methods do what you want in a
 safe way - assuming you don't care about whitespace:
 
  s =test   \r\n
  s.strip()
 'test'

perfect!

[...]
 
 This way it doesn't matter what your line endings are -  you won't be
 surprised by missing characters if the data dump changes for any
 reason.

well, no great chance of the data dump changing, but its a good
point. 

thanks
A


signature.asc
Description: Digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Boost Python tutorial needs MSVC?

2006-12-20 Thread Max Wilson
Hi,

Has anyone here built Boost.Python modules under MinGW? I'm trying to
build the Boost.Python tutorial under MinGW and getting an error that
says it depends on MSVC, which puzzles me because Boost built using
g++. Here's some of my output:

[EMAIL PROTECTED] /c/Boost/libs/python/example/tutorial
$ bjam -sTOOLS=mingw -d+2
...found 1508 targets...
...updating 32 targets...
vc-C++
bin\boost\libs\python\build\boost_python.dll\vc-7_1\debug\threading-multi\numeric.obj
'C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\bin\VCVARS32.BAT' is not recognized as an internal or
external command,
operable program or batch file.

CALL C:\Program Files\Microsoft Visual Studio .NET
2003\VC7\bin\VCVARS32.BAT nul
C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\bin\cl
/Zm800 -nologo /EHsc -c  -DBOOST_PYTHON_DYNAMIC_LIB
-DBOOST_PYTHON_SOURCE /Z7 /Od /Ob0 /EHsc /GR /MDd /Op /wd4675
/Zc:forScope /Zc:wchar_t -Ibin\boost\libs\python\build  -Ic:\Boost
-Ic:\Python24\include
-Fobin\boost\libs\python\build\boost_python.dll\vc-7_1\debug\threading-multi\numeric.obj
-Tpc:\Boost\libs\python\build\../src/numeric.cpp

[etc.]

1. I'm using the standard Python.org windows Python interpreter for
Python 2.4.3 (Enthought edition), and mingw g++ 3.4.5.
2. PYTHON_ROOT and PYTHON_VERSION have been set to /c/Python24 and 2.4
respectively.
3. I'm running the unmodified Jamfile/Jamrules straight from the Boost
subdirectory, and as you can see I'm using the sTOOLS=gcc option.
4. So why is it looking for Visual Studio and how do I stop it?

Any ideas much appreciated.

-Max Wilson

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


TypeError: cannot concatenate 'str' and 'NoneType' objects

2006-12-20 Thread thompson . marisa
Hi.

I'm extremely new to Python and programming as a whole.  I have written
a python script with the assistance of ESRI ArcGIS 9.2, which uses
Python 2.4.1, however, it gives me this error when I try to run it.
I've already posted at ESRI support, and I was hoping that Python
people could help me more.

I hope there is something simple I could do to be able to define the
object that it thinks is NoneType.  Please when someone responds,
please treat me as an absolute novice.

Thank you,
Marisa

Here is my code:

#
---
# towntab92.py
# Created on: Wed Dec 20 2006 11:09:59 AM
#   (generated by ArcGIS/ModelBuilder)
# Created by Marisa Thompson
#
---

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Check out any necessary licenses
gp.CheckOutExtension(spatial)

# Load required toolboxes...
gp.AddToolbox(C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial
Analyst Tools.tbx)

# Define workspace
gp.workspace = F:/Marisa/inputfolder

# Define Variables
raster = F:/Marisa/outputfolder_72/mss-72-spf.img

#Get list of Town Shapefiles
Townshp = gp.ListFeatureClasses (*)

#Store path to output folder
outputPath = F:/Marisa/outputfolder_72

# Begin going through the loop
Townshp = Townshps.next()
while Townshps !=:
#Set the output name to be the same as input
outName = outputPath + / + Townshp + land + .img
Output_table = outputPath + / + Townshp + table + .dbf
#For each extract by Mask
gp.ExtractbyMask_sa (raster, Townshp, outName)
#For each tabluate area
gp.TabulateArea_sa (Townshp, RITOWN5K_, outName, VALUE,
Output_table, 98.425)
Townshp = Townshps.next()

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


Re: Boost Python tutorial needs MSVC?

2006-12-20 Thread Max Wilson
Cancel that--I found the answer.
http://groups.google.com/group/boost-list/browse_frm/thread/5a17077679a33dca/7360f2038d6e6cca?lnk=gstq=bjam+mingwrnum=3#7360f2038d6e6cca

Short answer: bjam.exe should not be in /bin or /usr/bin because MinGW
treats programs in there differently. In my case I simply copied
bjam.exe to my working directory, for now.

-Max Wilson

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


  1   2   >