[ANN] ConfigObj update - v3.2.5

2005-02-15 Thread fuzzyman
ConfigObj has had another update - now version 3.2.5

This update includes 3 bugfixes and several new features. Because of
the bugfixes it's reccomended for all users. New features include -
lines can now be broken over two or more lines, initial and final
comments in a config file are preserved (or can be set) when using the
write method, we can now read/write config files directly to and from a
StringIO object, and empty values are now valid (like 'value=' as per
ini files).

Homepage : http://www.voidspace.org.uk/python/configobj.html
For downloading, see the download section of the homepage.


What is ConfigObj
==

A python module (class) for ultra simple reading and writing of simple
config files, including config files with sections. Designed to allow
the greatest flexibility in the config files it will read (and your
users will create).

Many flexible features - but you don't need to use them !


What's New ?
=

The last announced release was 3.2.3, changes since then include :

   2005/02/15Version 3.2.5
   Changes so that ConfigObj can work with StringIO instances, by Wayne
Wiitanen
   (for a project that receives a configuration file over a socket
as a string.
   It is used as the source text for a StringIO object)
   Lines can be extended across more than one line, with the '\'
character
   (must be final character on line - it escapes the newline)
   Empty values can be written 'value=' (like the ini file - but read
only currently)
   Errors whilst parsing now report the line they occurred in
   Duplicate keys and sections are now reported as errors (bug fix)
   isflatfile can now handle '[' inside '\*.. *\' comments (bug fix)
   Fixed bug in handling of final line of '\*.. *\' comments
   If the first and last non empty lines of a config file are comments
they will be preserved as config.initial_comment and self.final_comment
  These are written out when the write method is called (but not
the writein method)
  New list attributes self.initial_comment and self.final_comment
   self.sectionfile is always set to the opposite of self.flatfile
 2005/01/07Version 3.2.4
   Use absolute paths for stored filename. Avoids problems when cwd is
changed.


There have also been a few other improvements to voidspace modules.
Hopefully I'll soon be announcing upgrades to approx,
approxClientproxy, and downman.py.

There is now more detailed information on customizing Movable Python
distributions. See http://www.voidspace.org.uk/python/movpy

Regards,


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

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

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


Re: calculate with date

2005-02-15 Thread Fredrik Lundh
Detlef Jockheck wrote:

 I have a date-string given in format dd.mm.. Now I would like to add  
 100 days. How can this 
 be solved in python?

 from datetime import date, timedelta
 d = date(2005, 2, 15)
 d
datetime.date(2005, 2, 15)
 d + timedelta(days=100)
datetime.date(2005, 5, 26)

more here:

http://docs.python.org/lib/module-datetime.html

/F 



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


Re: calculate with date

2005-02-15 Thread Robert Kern
Detlef Jockheck wrote:
Hi,
I have a date-string given in format dd.mm.. Now I would like to 
add  100 days. How can this be solved in python?
import datetime
def add100days(datestring):
day, month, year = [int(x) for x in datestring.split('.')]
date0 = datetime.date(year, month, day)
date1 = date0 + datetime.timedelta(days=100)
newdatestring = '%.2d.%.2d.%.4d' % (date1.day, date1.month,
date1.year)
return newdatestring
You may want to do the details differently, but datetime is the module 
that you want to use.

--
Robert Kern
[EMAIL PROTECTED]
In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die.
  -- Richard Harter
--
http://mail.python.org/mailman/listinfo/python-list


Re: deepcopy chokes with TypeError on dynamically assigned instance method

2005-02-15 Thread Kanenas
On Sun, 13 Feb 2005 12:01:42 +1000, Nick Coghlan
[EMAIL PROTECTED] wrote:

 True.  It wouldn't cause a problem within my __init__, since the 
 attribute is reassigned after the deepcopy, though should anyone else 
 deepcopy an instance...  Definitely better that the deepcopy throws the 
 TypeError.  But why shouldn't we be able to copy a non-method function?

I honestly don't know, although I'm hard-pressed to see how doing so would 
ever 
be *useful*. Duplicating *parts* of a function would seem to make sense (to 
build a new function which is similar, but not identical), but duplicating the 
whole thing seems rather pointless. Although I guess you could just pickle it 
and then unpickle the result to make a copy :)

It's not so much that copying a function is useful as it would be nice
if copy and deepcopy didn't fail on plain functions, as there are
cases where objects would need to store references to such functions.
Imagine classes implementing operations on functions such as numeric
differentiation and integration (while symbolic differentiation 
integration would probably be better for production code, the example
still stands).  As it is, a little extra work would be needed to
support deepcopying such classes.  And it's always nice to avoid work.

Thanks for your help and feedback on this.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: check if object is number

2005-02-15 Thread Antoon Pardon
Op 2005-02-11, Steven Bethard schreef [EMAIL PROTECTED]:
 George Sakkis wrote:
 Steven Bethard [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
Is there a good way to determine if an object is a numeric type?
 
 In your example, what does your application consider to be numeric?

 Well, here's the basic code:

 def f(max=None):
  ...
  while max is None or n = max:
  ...
  # complicated incrementing of n

 So for 'max', technically all I need is = support.  However, the code 
 also depends on the fact that after incrementing 'n' enough, it will 
 eventually exceed 'max'.  Currently, ints, longs, floats, and Decimals 
 will all meet this behavior.

Actually no, floats don't meet this behaviour or more specifically
floats don't guarantee this behaviour. It depends of course on
your implementation of f, but it is possible with floats to keep
incrementing and never reach a maximum.

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


StringIO objects sharing a buffer

2005-02-15 Thread Thomas Lotze
Hi,

I want to implement a tokenizer for some syntax. So I thought I'd subclass
StringIO and make my new class return tokens on next().

However, if I want to read tokens from two places in the string in turns,
I'd either need to do some housekeeping of file pointers outside the
tokenizer class (which is ugly) or use two tokenizers on the same data
buffer (which seems impossible to me using my preferred approach as a
file-like object has exactly one file pointer).

Is there a way for multiple StringIO objects to share a buffer of data, or
do I have to give up on subclassing StringIO for this purpose? (An
alternative would be a tokenizer class that has a StringIO instead of
being one and do the file pointer housekeeping in there.)

-- 
Thomas


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


MDaemon Warning - virus found: Mail System Error - Returned Mail

2005-02-15 Thread press . xpress

*** WARNING **
Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado 
un fichero anexo(s) infectado(s).  Por favor revise el reporte de abajo.

AttachmentVirus name   Action taken
--
transcript.zipEmail-Worm.Win32.Mydoom.m Removed


**


The original message was received at Tue, 15 Feb 2005 09:58:46 +0100
from 125.124.237.58

- The following addresses had permanent fatal errors -
python-list@python.org



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

[ANN] IPython 0.6.11 is out.

2005-02-15 Thread Fernando Perez
Hi all,

I'm glad to announce the release of IPython 0.6.11.  IPython's homepage is at:

http://ipython.scipy.org

and downloads are at:

http://ipython.scipy.org/dist

I've provided RPMs (for Python 2.3 and 2.4, built under Fedora Core 3), plus
source downloads (.tar.gz).  We now also have a native win32 installer which
should work correctly for both Python 2.3 and 2.4.

NOTE: Win32 users who grabbed the 0.6.11 which I put in testing last week
should still update, since today's release is actually quite different, and it
has a few win32-specific fixes (plus the big new backgrounding feature).

Debian, Fink and BSD packages for this version should be coming soon, as the
respective maintainers (many thanks to Jack Moffit, Andrea Riciputi and Dryice
Liu) have the time to follow their packaging procedures.

Many thanks to Enthought for their continued hosting support for IPython, and
to all the users who contributed ideas, fixes and reports.


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.


Release notes
-

As always, the NEWS file can be found at http://ipython.scipy.org/NEWS, and
the full ChangeLog at http://ipython.scipy.org/ChangeLog.

* A new subsystem has been added to IPython for background execution (in a
separate thread) of commands and function calls.  This system is by no means
perfect, and some of its limitations are unavoidable due to the nature of
python threads.  But it can still be useful to put in the background
long-running commands and regain control of the prompt to continue doing other
things.  The new jobs builtin has extensive docstrings, and the new %bg magic
complements it.  Please type %bg? and jobs? for further details.

The user-level API of this system is brand new, so I am very open to
suggestions and comments.  While a threads-based model has limitations, this
is also a testbed for future integration into ipython of other models of
background execution, including parallel processing both on local
(multiprocessor/multicore) machines and on remote clusters.  So please
consider this an exploratory feature where we can test these ideas and better
understand what works and what doesn't.

This system was inspired by discussions with Brian Granger [EMAIL PROTECTED]
and the BackgroundCommand class described in the book Python Scripting for
Computational Science, by H. P. Langtangen:

http://folk.uio.no/hpl/scripting

(although ultimately no code from this text was used, as IPython's system is a
separate implementation).

* Tab completion now shows all possible completions, both for python names and
files/directories.  This is different from the old behavior, but in practice
much more convenient (thanks to John Hunter for the request).

* The readline_omit__names rc option now allows you to fine-tune the behavior
of tab-completion.  You can filter out names starting with one underscore or
two separately.  If set to 1, you only filter double-underscore names (like
before), but if set to 2, you also filter out single-underscore names.  Thanks
to a patch by Brian Wong [EMAIL PROTECTED].

* Improvements for win32 users continue.  The installer bug for 2.4 has been
fixed by the Python team, so the provided binary installer should now complete
without problems (let me know otherwise).  Just in case, a manual
post-installer for win32 still ships with the .tar.gz sources, though it
should never be needed.

Gary Bishop also squashed a number of readline bugs, so if you update to his
most recent release from

http://sourceforge.net/projects/uncpythontools

you should benefit from fully correct source highlighting under Win32.  Thanks
to Vivian De Smedt, autoindent now also works under win32.

As far as I know, at this point (for the first time ever, fingers crossed...),
all of ipython's features exist in a win32 environment.  Many thanks to all
the patient users who have helped with this task.

I would appreciate reports of any problems from Win32 users.

* Fix issue28 in the bug tracker by disabling the startup output traps.  This
subsystem, while nice when it works (it organizes startup error messages
neatly) can lead to mysterious, impossible to debug problems during
initialization.

* Fix 'ed -p' not working when the previous call produced a syntax error.

* Fix crash when inspecting classes without constructor.

* Other small fixes and cleanups.


Enjoy, and as usual please report any problems.

Regards,

Fernando.

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


Copying data between file-like objects

2005-02-15 Thread Thomas Lotze
Hi,

another question: What's the most efficient way of copying data between
two file-like objects?

f1.write(f2.read()) doesn't seem to me as efficient as it might be, as a
string containing all the contents of f2 will be created and thrown away.
In the case of two StringIO objects, this means there's a point when the
contents is held in memory three times.

Reading and writing a series of short blocks to avoid a large copy buffer
seems ugly to me, and string objects will be created and thrown away all
the time. Do I have to live with that?

(In C, I would do the same thing, only without having to create and throw
away anything while overwriting a copy buffer, and being used to doing
everything the pedestrian way, anyway.)

-- 
Thomas


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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread David Fraser
Pat wrote:
Actually, no.  We ran into some issues with Python 2.4 that caused us
to return to Python 2.3.5.  But I would really like to upgrade to
Python 2.4.  So I started researching the subject before I did
anything.
If you are telling me that minGW can compile extensions that are
compatible with the Python 2.4 that uses msvcr71.dll, then that is good
news indeed.  Is there anything that needs to be configured or patched
to make this happen?  And how does minGW know which dll to link?  What
if I have both versions of Python installed - 2.3.5 and 2.4?  Is there
an easy way to detect this and switch between the two dlls?
If I'm asking questions already answered elsewhere, I'd love a link to
that resource, if you have it.
I use MinGW myself to compile extensions for Python 2.3.x so you should 
have no problems there. And it seems like from the rest of the thread 
that it works for Python 2.4 as well.
But please just download it, try it out, and report any problems in a 
separate thread here - I'm sure you'll find people more than willing to 
help. The actual error messages etc will yield more valuable discussion 
than any speculation now - or you might find it just working

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


How to implement a file lock ??

2005-02-15 Thread ionel
is there a cross-platform library or module for file locking?
or at least a win32 implementation.

i'm trying to get a lock on some file in a cgi script. ( i got my data
erased a few times :P )


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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Duncan Booth
Ilias Lazaridis wrote:

 In accordance with section 10 of the GPL, Red Hat, Inc. permits
 programs whose sources are distributed under a license that complies
 with the Open Source definition to be linked with libcygwin.a without
 libcygwin.a itself causing the resulting program to be covered by the
 GNU GPL. 
 
 If I understand this right, I cannot produce commercial software with 
 the cygwin toolset.
 

Contrariwise. You can produce commercial software, and it doesn't have to 
be GPL licensed. However if you want to distribute it (and much, possibly  
most, commercial software is never distributed) you have to choose between 
making it open-source, or buying a commercial license for cygwin. You do 
realise that you can produce open-source software commercially?

If you want to make your program closed source then to distribute it you 
have to pay for the cygwin license, which all seems pretty fair to me. You 
have a problem with that?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to implement a file lock ??

2005-02-15 Thread Fredrik Lundh
ionel [EMAIL PROTECTED] wrote:

 is there a cross-platform library or module for file locking?
 or at least a win32 implementation.

for windows, see the third example on this page:

http://www.effbot.org/librarybook/msvcrt.htm

for unix, see:

http://www.effbot.org/librarybook/fcntl.htm

/F 



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


Re: os.rename() doesn't work w/unicode??

2005-02-15 Thread fanbanlo
Serge Orlov wrote:
fanbanlo wrote:
C:\MP3\001.txt - 0.txt
C:\MP3\01. ??? - (???).mp3 - 1.mp3
Traceback (most recent call last):
 File
C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py,
line 310, in RunScript
   exec codeObject in __main__.__dict__
 File C:\MP3\!RenameNum.py, line 40, in ?
   renameFiles(os.path.dirname(sys.argv[0]))
 File C:\MP3\!RenameNum.py, line 26, in renameFiles
   os.rename(os.path.join(path, filenames), new_filename)
OSError: [Errno 22] Invalid argument

os.rename works with unicode, you're getting this error because
question marks are not allowed in file names on Windows.
  Serge.

The filename is supposed to be in Chinese, on NTFS (WinXP).  However, 
when i print it, they are all '???', and that caused os.rename() to break.

How to force os.walk to return a list of unicode filename?
--
http://mail.python.org/mailman/listinfo/python-list


Re: [PATCH] allow partial replace in string.Template

2005-02-15 Thread Nick Coghlan
Stefan Behnel wrote:

Nick Coghlan wrote
a) Patches are more likely to be looked at if placed on the SF patch 
tracker.

see your own b), I wanted to discuss them first.
Fair enough.
Still, when I first tried out the Template class, I immediately stumbled 
over the fact that the substitute methods always return strings, and 
never Template objects. While it makes sense for their primary purpose, 
it totally restricts the usage of this module to one-show operations.
Except that it is easy to turn a string into a template using a 
constructor. . .
However, now that I think more about your 'partial_substitute' method it does 
make sense as an alternative constructor:

  @classmethod
  def from_template(*args, **kwds):
cls, orig = args[:2]
return cls(orig.safe_substitute(*args[2:], **kwds))
Usable as:
  new_templ = Template.from_template(orig_templ, *args, **kwds)
Versus:
  new_templ = Template(orig_templ.safe_substitute(*args, **kwds))
Mutating the template in place seems questionable. Rebinding the name with the 
above constructor would be more appropriate, IMO.

Hmm - I'm unconvinced, but it's probably still worth posting a patch and sending 
it in Barry Warsaw's direction.

Cheers,
Nick.
--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list


Re: os.rename() doesn't work w/unicode??

2005-02-15 Thread Neil Hodgson
fanbanlo:

 The filename is supposed to be in Chinese, on NTFS (WinXP).  However,
 when i print it, they are all '???', and that caused os.rename() to break.

 How to force os.walk to return a list of unicode filename?

   The convention in the unicode file name support is that calls with
unicode arguments return unicode results:

 h = e:\\unicode
 import os
 for p,d,f in os.walk(h):
... print p, !, d, !, f
...
e:\unicode ! [] ! ['ko.py', 'abc', 'ascii', 'Gr\xfc\xdf-Gott', 'uni.py',
'Ge??-sa?', '', '??', '???', 'G\xdf', '???',
'unilin.py']
 for p,d,f in os.walk(unicode(h, latin1)):
... print p, !, d, !, f
...
e:\unicode ! [] ! [u'ko.py', u'abc', u'ascii', u'Gr\xfc\xdf-Gott',
u'uni.py', u'\u0393\u03b5\u03b9\u03ac-\u03c3\u03b1\u03c2',
u'\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435',
u'\u05d4\u05e9\u05e7\u05e6\u05e5\u05e1', u'\u306b\u307d\u3093',
u'\u66e8\u05e9\u3093\u0434\u0393\xdf', u'\u66e8\u66e9\u66eb', u'unilin.py']

   Neil


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


Wow!, This chick is HOT! w?=ge/

2005-02-15 Thread Eve
  .
--

Want to get laid tonight??  Find local girls now

http://www.youandmeswing.com/index.php?ref_id=130


--






aY]O%;h%k
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [NewBie] Tut0r Thing

2005-02-15 Thread administrata
Daniel Yoo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]...
 : if you're talking about the tutor at python.org mailing list, it's a 
 mailing list
 : that you send mail to and get mails from, as explained on the tutor mailing
 : list page:
 
 :http://mail.python.org/mailman/listinfo/tutor
 
 
 Hello,
 
 Also, from the odd spelling of the subject line, I suspect that the
 original poster thinks that we're some kind of cracking group.
 
 
 I hope not, but just to make sure it's clear: when we in the Python
 community talk about hacking, we usually mean it in the constructive
 sense: we like building software systems and helping people learn how
 to program.
 
 ESR has a good summary here:
 
 http://www.catb.org/~esr/faqs/hacker-howto.html#what_is
 
 I always feel silly about bringing this up, but it has to be said,
 just to avoid any misunderstanding.
 
 
 Best of wishes to you.

I'm not clever to hack though, :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to implement a file lock ??

2005-02-15 Thread Alan Kennedy
[ionel]
is there a cross-platform library or module for file locking?
or at least a win32 implementation.
i'm trying to get a lock on some file in a cgi script. ( i got my data
erased a few times :P )
portalocker - Cross-platform (posix/nt) API for flock-style file locking.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
HTH,
--
alan kennedy
--
email alan:  http://xhaus.com/contact/alan
--
http://mail.python.org/mailman/listinfo/python-list


Delivery Status Notification (Failure)

2005-02-15 Thread administrata
Hello. I was about to use tutor-mailing But, When i send to
tutor@python.org

reply is...

This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

   [EMAIL PROTECTED]

and the header...

From: Sm0kin'_Bull . [EMAIL PROTECTED] 
To: tutor@python.org 
Subject: [Tutor] . 
Sent: Tuesday, February 15, 2005 7:57 PM 
MIME-Version: 1.0 
X-Originating-IP: [193.38.108.210] 
X-Originating-Email: [EMAIL PROTECTED] 
X-Sender: [EMAIL PROTECTED] 
Received: from mail pickup service by mail2world.com with Microsoft
SMTPSVC; Tue, 15 Feb 2005 02:48:54 -0800
Received: from 10.1.50.1 unverified ([10.1.50.1]) by
mwde09la.mail2world.com with Mail2World SMTP Server,Tue 15 Feb 2005
02:48:51 -08:00
Received: from bag.python.org (bag.python.org [194.109.207.14])by
smtp-vbr1.xs4all.nl (8.12.11/8.12.11) with ESMTP id
j1FAxqDX014057;Tue, 15 Feb 2005 11:59:52 +0100 (CET)(envelope-from
[EMAIL PROTECTED])
Received: from bag.python.org (bag [127.0.0.1])by bag.python.org
(Postfix) with ESMTP id A93C81E4007;Tue, 15 Feb 2005 11:59:52 +0100
(CET)
Received: from bag.python.org (bag [127.0.0.1])by bag.python.org
(Postfix) with ESMTP id 26DE51E4007for tutor@python.org; Tue, 15 Feb
2005 11:59:51 +0100 (CET)
Received: from bag (HELO bag.python.org) (127.0.0.1)by bag.python.org
with SMTP; 15 Feb 2005 11:59:50 +0100
Received: from hotmail.com (bay22-f4.bay22.hotmail.com [64.4.16.54])by
bag.python.org (Postfix) with ESMTPfor tutor@python.org; Tue, 15 Feb
2005 11:59:50 +0100 (CET)
Received: from mail pickup service by hotmail.com with Microsoft
SMTPSVC;Tue, 15 Feb 2005 02:58:00 -0800
Received: from 193.38.108.210 by by22fd.bay22.hotmail.msn.com with
HTTP;Tue, 15 Feb 2005 10:57:20 GMT
Sender: [EMAIL PROTECTED] 
ResentFrom: [EMAIL PROTECTED] 
X-Original-To: tutor@python.org 
Delivered-To: [EMAIL PROTECTED] 
X-Spam-Status: OK 0.223 
X-Spam-Level: ** 
X-OriginalArrivalTime: 15 Feb 2005 10:58:00.0997
(UTC)FILETIME=[373B4D50:01C5134D]
X-BeenThere: tutor@python.org 
X-Mailman-Version: 2.1.5 
Precedence: list 
List-Id: Discussion for learning programming with Python
tutor.python.org
List-Unsubscribe: 
http://mail.python.org/mailman/listinfo/tutor,mailto:[EMAIL PROTECTED]
List-Archive: http://mail.python.org/pipermail/tutor 
List-Post: mailto:tutor@python.org 
List-Help: mailto:[EMAIL PROTECTED] 
List-Subscribe: http://mail.python.org/mailman/listinfo/tutor,mailto:[EMAIL 
PROTECTED]
Errors-To: [EMAIL PROTECTED] 
X-Virus-Scanned: by XS4ALL Virus Scanner 

Plz HELP me;
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Delivery Status Notification (Failure)

2005-02-15 Thread Diez B. Roggisch
administrata wrote:

 Hello. I was about to use tutor-mailing But, When i send to
 tutor@python.org

That just means that somebody subscribed to that list isn't reachable.
Ignore it.

 Plz HELP me;

Please start talking english. This is no l337-script-kiddie forum.

-- 
Regards,

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


Re: How to implement a file lock ??

2005-02-15 Thread Miki Tebeka
Hello ionel,

 is there a cross-platform library or module for file locking?
 or at least a win32 implementation.
 
 i'm trying to get a lock on some file in a cgi script. ( i got my data
 erased a few times :P )

I'm using:

-
from os import open as _open, O_CREAT, O_EXCL, O_RDWR

lockfile = /tmp/some_lock
lockfd = None

def lock():
global lockfd
try:
lockfd = _open(lockfile, O_CREAT|O_EXCL|O_RDWR)
write(lockfd, %d % getpid())
return 1
except OSError: # Already locked
lockfd = None
return 0

def unlock():
if not lockfd:
return 0
try:
close(lockfd)
remove(lockfile)
return 1
except OSError:
return 0
-

You can wrap it in a class. However make sure you unlock either on __del__
with is a bit tricky or atexit.register(unlock) which is better.

HTH.
--

Miki Tebeka [EMAIL PROTECTED]
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
-- 
http://mail.python.org/mailman/listinfo/python-list


Accessing Objects Based On Their ID

2005-02-15 Thread Tim Daneliuk
This is probably obvious to you Python Geniuses (tm) out there but,
it is very late and I am experiencing Brain Fade:
Given the ID of an object, is there a way to access it?  For example,
if we have the ID of a class instance, is there a way to invoke its
methods and attributes knowning only that ID?  Similarly, if we have the
ID of a function, is there a way to call it?
This comes up because of an implementation I had in mind wherein I
would store the IDs of a notionally linked-list of objects - but without
the link - I just want to store their IDs in the desired order.  But later,
when I want to actually use the objects I need a way to get from ID back
to something accessible in the namespace...
TIA,
--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Accessing Objects Based On Their ID

2005-02-15 Thread Fredrik Lundh
Tim Daneliuk wrote:

 This is probably obvious to you Python Geniuses (tm) out there but,
 it is very late and I am experiencing Brain Fade:

 Given the ID of an object, is there a way to access it?

short answer: no.

longer answer: write a small C extension that casts an integer (or long integer)
argument to a PyObject, increments the refcount, and returns the object.  or
use gc.get_objects() to get a list of all GC-aware objects, and see if your 
object
is in there.  etc.  all solutions are fragile, non-portable, and/or inefficient.

 This comes up because of an implementation I had in mind wherein I
 would store the IDs of a notionally linked-list of objects - but without
 the link - I just want to store their IDs in the desired order.  But later,
 when I want to actually use the objects I need a way to get from ID back
 to something accessible in the namespace...

sounds like import weakref might be what you need.

/F 



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


Re: Accessing Objects Based On Their ID

2005-02-15 Thread Fredrik Lundh
 longer answer: write a small C extension that casts an integer (or long 
 integer)
 argument to a PyObject, increments the refcount, and returns the object.

here's a pointer to a pointer to such a function, btw:

http://mail.python.org/pipermail/python-list/1999-October/013715.html

(see other messages in that thread for more on why this is a stupid idea)

/F 



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


Re: Kill GIL

2005-02-15 Thread Adrian Casey
Aahz wrote:

 In article [EMAIL PROTECTED],
 Frans Englich  [EMAIL PROTECTED] wrote:

Personally I need a solution which touches this discussion. I need to run
multiple processes, which I communicate with via stdin/out,
simultaneously, and my plan was to do this with threads. Any favorite
document pointers, common traps, or something else which could be good to
know?
 
 Threads and forks tend to be problematic.  This is one case I'd recommend
 against threads.

Multiple threads interacting with stdin/stdout?  I've done it with 2 queues. 
One for feeding the threads input and one for them to use for output.  In
fact, using queues takes care of the serialization problems generally
associated with many threads trying to access a single resource (e.g.
stdout).  Python Queues are thread-safe so you don't have to worry about
such issues.
-- 
http://mail.python.org/mailman/listinfo/python-list


replacing ASP/VBScript with Python

2005-02-15 Thread Peter Maas
I have inherited an extremely messy ASP/VBScript application which
is a pain for me to support. Now the customer is thinking about a
redesign. I'd like to rewrite the whole thing in Python but the app
has to meet some conditions like
- IIS frontend
- MSSQL db server
- Win32 authentication
- No 'ugly' URLs like http://server/cgi-bin/frontend.cgi?main.py
- Performance: intranet with ~ 1000 users
My personal preferences:
- I'd rather do this in plain Python than using e.g. Zope because I
  fear the additional complexity of handling Zope and make it seam-
  lessly work with IIS.
- I'd like to do session handling in Python because ASP's session
  object is quite limited and some of the ASP app's mess is caused
  by trying to use it for compound data type storage. OTOH I could
  pickle Python objects to a string and store that in an ASP session.
Thanks for any help.
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


win32gui bug: where to report it?

2005-02-15 Thread George van den Driessche
It's taken me ages to find out why my window, built out of win32all, wasn't
receiving any messages. Eventually I found the answer here:

http://mail.python.org/pipermail/python-list/2001-October/069451.html

The important point being:
 IIRC you have to pass the return value of the RegisterClass() call (which
 is an atom) to the CreateWindowEx() function as the second parameter
 (lpClassName).
... in other words, you can pass the name of your window class as the second
parameter, but it will silently fail to work. (This holds for CreateWindow
too.)

This is a bug for which it is pretty much impossible to work out the
workaround without being told it, so I'd like to put the workaround in a
more easily-found place. But where? win32all doesn't seem to have much
documentation, much less a bug database.

In case anyone else needs to find this message by searching, some keywords
are: win32all, win32gui, WNDCLASS, RegisterClass, CreateWindow,
CreateWindowEx

George


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


MDaemon Warning - virus found: Returned mail: Data format error

2005-02-15 Thread Post Office

*** WARNING **
Este mensaje ha sido analizado por MDaemon AntiVirus y ha encontrado 
un fichero anexo(s) infectado(s).  Por favor revise el reporte de abajo.

AttachmentVirus name   Action taken
--
message.zip   Email-Worm.Win32.Mydoom.m Removed


**


The original message was received at Tue, 15 Feb 2005 13:13:43 +0100 from 
python.org [76.252.144.148]

- The following addresses had permanent fatal errors -
python-list@python.org



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

Variables.

2005-02-15 Thread administrata
I wrote this, It's a bit lame though

I = Allen
me = Allen
my = Allen's

print \

%s woke up early in the morning. But, it was unusal by %s. %s pillow
was with %s. %s didn't want to wake up But, %s tried my best and woke up.
it was so amazing! % (I,me,my,me,I,I)

raw_input(\n\\t\t\t- The End -)

But it looks like this...

Allen woke up early in the morning. But, it was unusal by Allen. 
Allen's pillow
was with Allen. Allen didn't want to wake up But, Allen tried my best and woke 
up.
it was so amazing

- The End -

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


Re: win32gui bug: where to report it?

2005-02-15 Thread Roger Upole
Win32all is called Pywin32 now, and resides on SourceForge:
http://sourceforge.net/projects/pywin32/

Roger


George van den Driessche [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 It's taken me ages to find out why my window, built out of win32all, 
 wasn't
 receiving any messages. Eventually I found the answer here:

 http://mail.python.org/pipermail/python-list/2001-October/069451.html

 The important point being:
 IIRC you have to pass the return value of the RegisterClass() call (which
 is an atom) to the CreateWindowEx() function as the second parameter
 (lpClassName).
 ... in other words, you can pass the name of your window class as the 
 second
 parameter, but it will silently fail to work. (This holds for CreateWindow
 too.)

 This is a bug for which it is pretty much impossible to work out the
 workaround without being told it, so I'd like to put the workaround in a
 more easily-found place. But where? win32all doesn't seem to have much
 documentation, much less a bug database.

 In case anyone else needs to find this message by searching, some keywords
 are: win32all, win32gui, WNDCLASS, RegisterClass, CreateWindow,
 CreateWindowEx

 George

 




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


Re: Variables.

2005-02-15 Thread Simon Brunning
On Tue, 15 Feb 2005 04:30:30 -0800 (PST), administrata
[EMAIL PROTECTED] wrote:
 I wrote this, It's a bit lame though
 
 I = Allen
 me = Allen
 my = Allen's
 
 print \
 
 %s woke up early in the morning. But, it was unusal by %s. %s pillow
 was with %s. %s didn't want to wake up But, %s tried my best and woke up.
 it was so amazing! % (I,me,my,me,I,I)

One thing that you might want to do is to use a dictionary to provide
the values, like so:

my_values = {I: Simon, me: Simon, my: Simon's}

print %(I)s woke up early in the morning. But, it was unusal by
%(me)s. %(my)s pillow
was with %(me)s. %(I)s didn't want to wake up But, %(I)s tried my best
and woke up.
It was so amazing! % my_values

 raw_input(\n\\t\t\t- The End -)
 
 But it looks like this...
 
 Allen woke up early in the morning. But, it was unusal by Allen.
 Allen's pillow
 was with Allen. Allen didn't want to wake up But, Allen tried my best and 
 woke up.
 it was so amazing
 
 - The End -

What did you *expect* it to do?

-- 
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32gui bug: where to report it?

2005-02-15 Thread Peter Hansen
George van den Driessche wrote:
This is a bug for which it is pretty much impossible to work out the
workaround without being told it, so I'd like to put the workaround in a
more easily-found place. But where? win32all doesn't seem to have much
documentation, much less a bug database.
http://sourceforge.net/projects/pywin32/
--
http://mail.python.org/mailman/listinfo/python-list


Re: replacing ASP/VBScript with Python

2005-02-15 Thread Peter Maas
Peter Maas schrieb:
I have inherited an extremely messy ASP/VBScript application which
is a pain for me to support. Now the customer is thinking about a
redesign. I'd like to rewrite the whole thing in Python but the app
has to meet some conditions like
[...]
Just noticed that this posting doesn't contain any questions. Here
they are:
Any comments? Has anybody done something comparable successfully and
give some advice?
Thanks in advance.
:)
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: replacing ASP/VBScript with Python

2005-02-15 Thread Diez B. Roggisch
 Just noticed that this posting doesn't contain any questions. Here
 they are:
 
 Any comments? Has anybody done something comparable successfully and
 give some advice?
 
 Thanks in advance.

You did not really give much information of what your application does -
e.g. for a CMS, I'd strongly recommend a zope based solution. Other apps
might be better written in other frameworks.


-- 
Regards,

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


Re: [perl-python] problem: reducing comparison

2005-02-15 Thread Xah Lee
here are the answers:

Perl code:

sub reduce ($$) {
my %hh= %{$_[0]}; # e.g. {'1,2'=[1,2],'5,6'=[5,6],...}
my ($j1,$j2)=($_[1]-[0],$_[1]-[1]);  # e.g. [3,4]
delete $hh{$j1,$j2};
foreach my $k (keys %hh) {
$k=~m/^(\d+),(\d+)$/;
my ($k1,$k2)=($1,$2);
if ($k1==$j1) {
if ($j2  $k2) {
delete $hh{$j2,$k2};
}
else {
delete $hh{$k2,$j2};
};
};
if ($k2==$j1) {
if ($k1  $j2) {
delete $hh{$k1,$j2};
}
else {
delete $hh{$j2,$k1};
};
};
}
return \%hh;
}


©Python code.
©
©def reduce(pairings, pair):
©ps=pairings.copy(); j=pair;
©ps.pop(%d,%d%(j[0],j[1]),0)
©for k in pairings.itervalues():
©if (k[0]==j[0]):
©if (j[1]  k[1]):
©ps.pop(%d,%d%(j[1],k[1]),0)
©else:
©ps.pop(%d,%d%(k[1],j[1]),0)
©if (k[1]==j[0]):
©if (k[0]  j[1]):
©ps.pop(%d,%d%(k[0],j[1]),0)
©else:
©ps.pop(%d,%d%(j[1],k[0]),0)
©return ps
©

In imperative languages such as Perl and Python and Java, in general it
is not safe to delete elements when looping thru a list-like entity.
(it screws up the iteration) One must make a copy first, and work with
the copy.

Note also that in Python there's already a function called reduce. (it
is equivalent to Mathematica's Fold.) In Python, looks like user can
over-ride default functions.

This post is archived at
http://xahlee.org/perl-python/pairing_reduce.html
Possible errata or addenda will appear there.

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

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


Re: replacing ASP/VBScript with Python

2005-02-15 Thread Peter Maas
Diez B. Roggisch schrieb:
You did not really give much information of what your application does -
e.g. for a CMS, I'd strongly recommend a zope based solution. Other apps
might be better written in other frameworks.
It's a procurement app. Users (employees) can search in a product list
and generate orders to the company's internal or external suppliers.
The orders are stored in a database and emails are generated to the
addresses of the buyer and the suppliers. There is no direct interface
to an erp app (like SAP).
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem: reducing comparison

2005-02-15 Thread Xah Lee
my Python coding is not experienced. In this case, is
ps.pop(%d,%d%(j[1],k[1]),0) out of ordinary?

if i have long paragraphs of documentation for a function, do i still
just attach it below the fun def?

 Xah

Xah Lee wrote:
 here are the answers:

 ©Python code.
 ©
 ©def reduce(pairings, pair):
 ©ps=pairings.copy(); j=pair;
 ©ps.pop(%d,%d%(j[0],j[1]),0)
 ©for k in pairings.itervalues():
 ©if (k[0]==j[0]):
 ©if (j[1]  k[1]):
 ©ps.pop(%d,%d%(j[1],k[1]),0)
 ©else:
 ©ps.pop(%d,%d%(k[1],j[1]),0)
 ©if (k[1]==j[0]):
 ©if (k[0]  j[1]):
 ©ps.pop(%d,%d%(k[0],j[1]),0)
 ©else:
 ©ps.pop(%d,%d%(j[1],k[0]),0)
 ©return ps
 ©

 In imperative languages such as Perl and Python and Java, in general
it
 is not safe to delete elements when looping thru a list-like entity.
 (it screws up the iteration) One must make a copy first, and work
with
 the copy.

 Note also that in Python there's already a function called reduce.
(it
 is equivalent to Mathematica's Fold.) In Python, looks like user can
 over-ride default functions.

 This post is archived at
 http://xahlee.org/perl-python/pairing_reduce.html
 Possible errata or addenda will appear there.
 
  Xah
  [EMAIL PROTECTED]
  http://xahlee.org/PageTwo_dir/more.html

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


Re: parsing IMAP responses?

2005-02-15 Thread Alan Kennedy
[Grant Edwards]
Is there a library somewhere that impliments the IMAP protocol
syntax?
[Paul Rubin]
It's very messy.
[Grant Edwards]
 It sure is.  You'd think something intended to be
 machine-readable would be easier to parse.
IMHO, email is the most disgracefully badly spec'ced application in 
existence: I'm sure the average modern-day scr1pt k1dd13 could do better.

SMTP: Have you ever tried to bounce processing? PITA.
POP: No virtual hosting support.
IMAP: You are in a twisty maze of passages, each slightly different .
It's no wonder the spammers can ply their trade with such ease.
grumpily-y'rs,
--
alan kennedy
--
email alan:  http://xhaus.com/contact/alan
--
http://mail.python.org/mailman/listinfo/python-list


Re: Variables.

2005-02-15 Thread bruno modulix
administrata wrote:
I wrote this, It's a bit lame though
(snip code - see other answers in this thread)
raw_input(\n\\t\t\t- The End -)
Why on earth are you using raw_input() here ?
HELP plz
No one can help you if you don't explain your problem. We are not 
psychic enough to read your mind !-)

(and please : avoid SCREAMING and l33t speak too...)
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])
--
http://mail.python.org/mailman/listinfo/python-list


Problems in making calulating program.

2005-02-15 Thread administrata
I wrote this to add 2 numbers...

print Please input data
number1 = int(raw_input( ))
number2 = int(raw_input(+ ))


total = number1 + number2
print total

raw_input()

I want to make output like this...

1 + 1 = 2

But, actually... it looks like this...

1
+ 1
2

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


Returned mail: see transcript for details

2005-02-15 Thread krivilli


***
** A csatolmány ldg.zip I-Worm.Mydoom.R virussal fertõzött,
** a csatolmány törölve lett.
***

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

Re: Problems in making calulating program.

2005-02-15 Thread Michele Simionato
You were on the right track before: look at the tutor
mailing list ;)

no offence intended, but there is an entire
list devoted to this kind of questions


  Michele Simionato

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


Re: replacing ASP/VBScript with Python

2005-02-15 Thread Peter Maas
Peter Maas schrieb:
I have inherited an extremely messy ASP/VBScript application which
is a pain for me to support. Now the customer is thinking about a
redesign. I'd like to rewrite the whole thing in Python but the app
has to meet some conditions like
- IIS frontend
- MSSQL db server
- Win32 authentication
- No 'ugly' URLs like http://server/cgi-bin/frontend.cgi?main.py
- Performance: intranet with ~ 1000 users
In the meantime I have searched the internet and found plenty of options:
- plain cgi with fastcgi and mod_rewrite for IIS to transform the URL
- quixote cgi with fastcgi and mod_rewrite
- Webware + wkcgi
- Python ASP (registering Python with Pywin32 as ASP language)
- mxODBC + SQL ODBC driver
- pyADO + SQL MDAC driver
I'm now confident that it is doable and keen on finding out. The usual
question: what is the one and best way to do it? ;)
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


PythonCard and Py2Exe

2005-02-15 Thread PipedreamerGrey
I've been banging my head against this problem for a week.  It's time
to ask for help, because I'm obviously not going to solve this by trial
and error.  I'm trying to create a standalone version (.exe) of
PythonCard's Custdb sample using Py2Exe version 0.5.0.  Everytime I
attempt to compile the program, I get an error during compilation.  I
need to formulate the correct setup file.  Here's the one I began with:


from distutils.core import setup
from PythonCard import dialog, model
import PythonCard
import py2exe

setup( name = custdb,
   console = [custdb.py],
   data_files = [ (., [custdb.ini, custdb.rsrc.py,
customerdata.csv]) ]
   )

Every variation of this format failed.  Does anyone have any ideas of
how to re-write this Setup file?

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


Re: PythonCard and Py2Exe

2005-02-15 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote:

 I've been banging my head against this problem for a week.  It's time
 to ask for help, because I'm obviously not going to solve this by trial
 and error.  I'm trying to create a standalone version (.exe) of
 PythonCard's Custdb sample using Py2Exe version 0.5.0.  Everytime I
 attempt to compile the program, I get an error during compilation.  I
 need to formulate the correct setup file.  Here's the one I began with:


 from distutils.core import setup
 from PythonCard import dialog, model
 import PythonCard
 import py2exe

 setup( name = custdb,
   console = [custdb.py],
   data_files = [ (., [custdb.ini, custdb.rsrc.py,
 customerdata.csv]) ]
   )

 Every variation of this format failed.

failed, as in?  did you get an error message?  can you post the error message?

/F 



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


Re: Python UPS / FedEx Shipping Module

2005-02-15 Thread Gabriel Cooper

Tom Willis wrote:
On one hand you are helping them indirectly sell their services,  On
the other, you are sort of competing with them, so, those companies
have plenty of reason to screw with you by changing the specs, lot's
of hoops to jump through to contiuously be certified.
Well before we make it out to be more than it is, what I have here is 
merely a module for getting rate requests. Basically we wanted a 
UPS/FedEx module to price-check shipping costs for eCommerce websites. 
The other types of requests could be implemented with no problem, but 
that's all that has been done so far.

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Tim Peters wrote:
[Ilias Lazaridis]
...
Let's see:
The process would be:
a) A Python Foundation official states: of course we accept diversity
and of course we are intrested that our source-code-base compiles
directly with MinGW (and other compilers).
Well, I'm a Director of the Python Software Foundation, and my view is
the more platforms the merrier.  
I extract: you are intrested, that the source-code-base compiles 
directly with MinGW (and other compilers).

Thus you should be intrested, that existent patches are incorporated 
into the source-code-base.

The suggested process ist: use of #defines whenever possible, to avoid 
influence on the existent behaviour of the code.

But I'm not paid to work on Python,
and I don't have time to volunteer to help MinGW along, so I don't
anticipate that I'll do anything here beyond writing this reply.
You have done already very much.
But should should take some time to evaluate community needs.
I think you're mistaken about the role the PSF plays here.  For
example, the PSF does no development work on Python -- all work on
Python comes from volunteers, and the PSF can't tell anyone what to
do.  
I understand.
PSF has no influence on the development. I've read a little around, and 
start to understand:

http://www.python.org/psf/records/board/minutes-2004-11-09.html
The PSF did start a grant program last year, and a proposal to
[...] - (funding)
I don't think that a founding is neccessary.
This effort could be driven by the intrested community members (which 
obviously exist).

b) the pyMinGW developer states: I am intrested that my patches are
included within the main python source code base [of course this
contribution would deserve to be mentioned somewhere]
I mean the developer of those patches:
http://jove.prohosting.com/iwave/ipython/pyMinGW.html
He must be intrested that his patches are incorporated to the main 
source code base, which would render his website useless [but of course 
not his efforts and reputation].

[Of course his website could still serve as an central point for 
intrested MinGW specific contributors.]

c) One part of the Python Community states: look those loosers, like to
use MinGW toolkit - pah! I'll continue to use my super-optimizing, xx%
faster results, less hassle Microsoft-Compiler
From the replies within this thread, i've extracted that some community 
members would think somehow this way.

d) One part of the Python Community states: I'm very happy that my
toolset of choice gets official support, to which I can contribute as a
community member
From the replies within this thread, i've extracted that some community 
members would think somehow this way.

e) there is no point e. People start simply to cooperate, thus python's
evolution is ensured.
A solid source-code-base and centralized efforts are a fundamentall part 
for the evolution of python.

Sorry, I didn't grasp the point of b thru e.
I've tried to clarify.
-
Now, can you please tell me the process I have to follow to suggest the 
following (to the PSF or to the programmers or to the decision takers), 
possibly to get at least a vote on it:

Please ensure that the source-code-base compliles directly with MinGW. 
The suggested process is to:

  * provide the infrastructure
(e.g. mailinglist, issue- tracking-category,... )
  * Notify the community about this subproject to channelise efforts
  * include existing MinGW specific patches
  * ensure future verificatioin of changes,
* optimal:due to an automated build-system
* or simpler: due to community-feedback

I've read a little about the processes:
http://www.python.org/dev/
http://www.python.org/dev/culture.html
http://www.python.org/dev/process.html
But I can't figure it out.
... 
Good night to all.

Likewise!
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Mail System Error - Returned Mail

2005-02-15 Thread Bounced mail
The original message was received at Tue, 15 Feb 2005 16:03:16 +0100 from 
193.83.236.20

- The following addresses had permanent fatal errors -
python-list@python.org



***
** A csatolmány message.zip I-Worm.Mydoom.R virussal fertõzött,
** a csatolmány törölve lett.
***

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

RE: replacing ASP/VBScript with Python

2005-02-15 Thread Tim Golden
[Peter Maas]
| 
| Peter Maas schrieb:
|  I have inherited an extremely messy ASP/VBScript application which
|  is a pain for me to support. Now the customer is thinking about a
|  redesign. I'd like to rewrite the whole thing in Python but the app
|  has to meet some conditions like
|  
|  - IIS frontend
|  - MSSQL db server
|  - Win32 authentication
|  - No 'ugly' URLs like http://server/cgi-bin/frontend.cgi?main.py
|  - Performance: intranet with ~ 1000 users
| 
| In the meantime I have searched the internet and found plenty 
| of options:
| 
| - plain cgi with fastcgi and mod_rewrite for IIS to transform the URL
| - quixote cgi with fastcgi and mod_rewrite
| - Webware + wkcgi
| - Python ASP (registering Python with Pywin32 as ASP language)
| - mxODBC + SQL ODBC driver
| - pyADO + SQL MDAC driver

There has also been noise lately about an ISAPI-Python binding
(contributed via Mark Hammond of pywin32 fame, I think) and a
WSGI implementation of same. Haven't used either, and haven't
got time to trawl for links at the mo, but I'm fairly certain
the latest pywin32 has the core stuff.

TJG


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk

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


Re: multi threading in multi processor (computer)

2005-02-15 Thread Martin Christensen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 Irmen == Irmen de Jong [EMAIL PROTECTED] writes:
Irmen Naah.  What about: http://www.razorvine.net/img/killGIL.jpg

Some people have too much spare time and too weird senses of
humour...

Fortunately for the rest of us. :-) This one actually made me laugh
out loud.

Martin

- -- 
Homepage:   http://www.cs.auc.dk/~factotum/
GPG public key: http://www.cs.auc.dk/~factotum/gpgkey.txt
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using Mailcrypt+GnuPG http://www.gnupg.org

iEYEARECAAYFAkISBcwACgkQYu1fMmOQldUg2QCgq1ATLCJWqAS7SBsHpcXTduma
xjMAoII+AzDwkp2F2NZvw4PUrBUx+GDh
=Yqjf
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Mike Meyer wrote:
Ilias Lazaridis [EMAIL PROTECTED] writes:
If it is a programming language, the requirement using an open-source
toolchain is a rational and valid one.
It is. However, mingW has nothing to do with using an open-sourcer
toolchain.
Python runs in an environment with a full, open-source tool chain. You
[...] - (twisting context and personal requirements)
sorry, no further comment.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Duncan Booth wrote:
Ilias Lazaridis wrote:

In accordance with section 10 of the GPL, Red Hat, Inc. permits
programs whose sources are distributed under a license that complies
with the Open Source definition to be linked with libcygwin.a without
libcygwin.a itself causing the resulting program to be covered by the
GNU GPL. 
If I understand this right, I cannot produce commercial software with 
the cygwin toolset.
Contrariwise. You can produce commercial software, and it doesn't have to 
be GPL licensed. However if you want to distribute it (and much, possibly  
most, commercial software is never distributed) you have to choose between 
making it open-source, or buying a commercial license for cygwin. You do 
realise that you can produce open-source software commercially?
I understand that I've possibly not expressed myself clear.
proprietary software should be the right term, right?
If you want to make your program closed source then to distribute it you 
have to pay for the cygwin license, which all seems pretty fair to me. You 
have a problem with that?
yes.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Robert Kern wrote:
Ilias Lazaridis wrote:
Duncan Booth wrote:
Ilias Lazaridis wrote:
There is a OS-tool-chain supported on windows, cygwin.
this depends on cygwin.dll, which is GPL licensed
[or am I wrong?]
It is GPL licensed with an amendment which prevents the GPL
spreading
[...]
If I understand this right, I cannot produce commercial software
with the cygwin toolset.
Wait, you demand a completely open source toolchain on a proprietary
 operating system to develop proprietary software?
I do not 'demand' this.
You've described existing constructs, which I simply like to use.
The mind *boggles*.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Robert Kern wrote:
Ilias Lazaridis wrote:
[...]
Questions and suggestions are don't count for much in this
community. Code and well-written patches do.
Stop wasting time on c.l.py and get to work! If you can't do
that, then this is not the community you are looking for.
Please speak for yourself.
I think that my participation in the community for the past six years
 and a rational examination of the responses you have received so far
 qualify me, just a little bit, to conclude that this community does
not tolerate your kind of behaviour well.
I do tolerate their behaviour.
I have to.
This is a public resource.
If you want one that does so tolerate your behaviour, you need to
keep looking.
I don't need to look.
They read, silently, deriving their conclusions.
About me.
About you.
About the python community.
[It is of course sad, that the bad manners / missing focusation on 
the context of the actively writing part reflects directly to the whole 
community.]

There are many commercial systems around python.
And yet there is not one company that has someone devoted
full-time to developing Python. Not even Guido.
Who's Guido?
The guy who wrote Python originally and is still the head developer.
ok
http://www.python.org/~guido/
Most of core-Python development happens in people's spare, unpaid
time.
Volunteerism is the core of this community. Trust me.
even if:
Volunteerism does not exclude Professionalism.
Volunteerism does not, indeed, exclude professionalism. However,
being professional does not entail satisfying the desires of everyone
who asks. Being professional does not mean that volunteerism is not
the driving force of this community.
If this does not appeal to you, then this is not the community that
you are looking for.
I've not understood what you've written.
But I understand that it is not relevant to the topic.
So please stop this volunteerism-stuff.
No. You are asking others to volunteer their time, or perhaps, 
alternately, the PSF and other businesses to volunteer their
money to fund people's time to satisfy *your* wants. I am asking
you to volunteer *your* time to satisfy *your* wants,
I'm already doing this.
Okay, let me clarify: 
[...] - (processing model)
Your suggestions affecting my processing model are irrelevant.
or alternately, stop writing questionnaires and bothering us.
Feel free to ignore the threads.
I would have been more than happy to until my web page was used. Now
I feel some obligation to correct some things.
You webpage is a public resource.
And it was terribly outdated.
Now you have corrected your website.
Thank you.
And please speak for yourself.
I am speaking as a member of this community, not necessarily for this
 community. But I do have some experience with how this community
behaves and how it responds to people who behave like you do. I know
that they do not mix well at all.
If you want a community that does tolerate this behaviour, you need
to keep looking.
I'm not looking for such a community.
Note that this reaction is pretty specific to you and not to
other newcomers. Most newcomers do not carry around a sense of
entitlement that could flatten a small village. Thus, they are
treated with respect and helpfulness. We would appreciate it if
you would emulate these people. On a purely pragmatic note, you
have to admit that they are getting much better help than you
are.
I get the help that I want.
You could do it much more efficiently.
[...] - (processing suggestions detected, not readed)
sorry, my processing is not the topic here.
If you like to help me and other newcomers, please give me
simple some answers on the initial questions.
I did provide some answers. Please review them again.
Please have the gentleness [against me and the current/future
readers] to answer within the context of the original writings.
I will be more careful in the future.
You can still give your answers within the main thread, thus they don't
get lost in this huge thread.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Delaney, Timothy C (Timothy) wrote:
Stephen Kellett wrote:
In message [EMAIL PROTECTED], Ilias Lazaridis
[EMAIL PROTECTED] writes
And yet there is not one company that has someone devoted full-time
to  developing Python. Not even Guido.
Who's Guido?
LOL Falling off my chair!!
See, the problem is that you have to go all the way to the second FAQ in
order to find out who Guido is. Obviously it needs to be more prominent
on the Python web site.
Oh - you mean Ilias didn't actually *read* anything on the Python web
site? My bad.
Illias - I'm assuming you are not a troll (despite the contrary
evidence) and am going to direct you to a site with all the answers you
need.
http://www.catb.org/~esr/faqs/smart-questions.html
I know this document.
It has no relevance to me.
Tim Delaney
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Fredrik Lundh
Ilias Lazaridis wrote:

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

 I know this document.

 It has no relevance to me.

QOTW! 



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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Stephen Kellett wrote:
In message [EMAIL PROTECTED], Steve Horsley 
[EMAIL PROTECTED] writes

Stephen Kellett wrote:
Who's Guido?
  LOL Falling off my chair!!
I think the expression you are looking for is ROFL!
:-) Yes, but with that I could've been standing up before ending up on 
the floor. I wrote it as I felt it!. Its a really good demonstration as 
to the depth of the research performed by Illias.
I thin I understand what you mean.
Guido van Rossum is the project's lead developer. In recognition of 
this role, he's sometimes jokingly called the Benevolent Dictator For 
Life, or BDFL; the acronym is occasionally used in python-dev postings, 
especially in a context such as making that change will require a BDFL 
pronouncement. In theory the BDFL makes all the decisions about what 
goes in to Python and what doesn't. 
source: http://www.python.org/dev/process.html

I'm waiting for the Who's Matz? comment in comp.lang.ruby
Stephen
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Simon Brunning wrote:
On Mon, 14 Feb 2005 14:23:08 +0200, Ilias Lazaridis [EMAIL PROTECTED] wrote:
(snip)

But if those answers above were of official nature, I must seriously
rethink if I can rely on _any_ system which is based on python, as the
foundation and the community do not care about essential needs and
requirements.
I couldn't agree more. You need to find a community that *does* care
about essential needs. Might I recommend Perl or Ruby?
you can review this thread.
[EVALUATION] - E01: The Java Failure - May Ruby Helps?
http://groups-beta.google.com/group/comp.lang.ruby/msg/676a2fbaf48046ac
Currently, I tend more to python, but I don't think that I can keep my 
initial enthusiasm up.

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Stephen Kellett wrote:
In message [EMAIL PROTECTED], Ilias Lazaridis 
[EMAIL PROTECTED] writes

the community do not care about essential needs and requirements.
Wrong. They do. They just don't care about *your* essential needs and 
requirements which *you* want *others* to fulfill at *their* cost. As 
others have said, do some work yourself.
your accousations are false.
please review my initial message.
Stephen
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: newbie question convert C to python

2005-02-15 Thread Steven Bethard
Paul Rubin wrote:
[EMAIL PROTECTED] writes:
How do i handle this piece of code in python:
# define vZero 15
# define vOne  20
unsigned int vTable[Zero][One]
if(vGroup[vZero][vOne] == 0)
   {
vGroup[vZero][vOne]--
.
.
   }
Simplest might be with a dictionary:
vGroup = {}# I assume you meant vGroup not vTable
if vGroup[(vZero, vOne)] == 0:
   vGroup[(vZero, vOne)] -= 1
   .
   .
Or, if you like, the parentheses are unnecessary:
vGroup = {}
if vGroup[vZero, vOne] == 0:
   vGroup[vZero, vOne] -= 1
   .
This (or the semantically identical version with parentheses) is 
definitely the best approach if you expect to have a lot of empty spots 
in your table.

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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Diez B. Roggisch wrote:
One of the most funny things within open-source is that switching:
first:
we have powerfull solutions which beat this and that
then:
hey, this is just volunteer work
I don't see the contradiction here. It beats a great deal of commercial
solutions in a lot of ways. But not on every single one of these. And the
_reason_ for beating commercial software in certain aspects is exactly that
somebody stood up and volunteered. Obviously you aren't interested in the
more labour-intensive parts of the os-development.
Sometimes the core-team must provide infrastructure for volunteers to 
contribute (as in this MinGW case).

http://lazaridis.com/core/product/case.html
But if those answers above were of official nature, I must seriously
rethink if I can rely on _any_ system which is based on python, as the
foundation and the community do not care about essential needs and
requirements.
They might not care about _your_ perceived essential needs. But as lots of
people use python and python based solutions with great commercial success,
you might think of reviewing your needs more critical. After all, there is
no _perfect_ system for all needs.
MinGW compatibility is not my need.
It is an community need.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Stephen Kellett wrote:
In message [EMAIL PROTECTED], Ilias Lazaridis 
[EMAIL PROTECTED] writes

The answer to most of your questions is, Because no one has yet 
volunteered their time and effort to get the job done.
this answer do not fit in most questions.
please review them again.
There you go. Failed the test. He is an AI. A human wouldn't make this 
mistake.
Even an simple AI would detect:
there are other reasons behind the decision to not support the MinGW 
open-source-complier directly out of the main source-code base.

Stephen
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Dr. Dobb's Python-URL! - weekly Python news and links (Feb 15)

2005-02-15 Thread Cameron Laird
QOTW:  I've forgotten what we are arguing about, but I'm sure I'm
right. -- Jive Dadson

I believe the best strategy against Identity theft is bad
credit. -- Tom Willis

You can't live without unit tests.  And once you have unit tests, the
added value of declarations is tiny, and their cost remains. -- martellibot


Make history, instead of having it happen to you:  the 
upcoming PyPy Sprint promises to be singular:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/6f0458c61169eff1/

Brian van den Broek, Roy Smith, BJ=F6rn_Lindqvist, Jason
Diamond, and Grig Gheorghiu introduce the crucial subject
of unit-testing in Python for those new to test-driven
development:

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/bbda0385fa4e1de7/
http://www.onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html

How do you know that Python has arrived?  When its use is
the least interesting part of a project.  Notice that, once
again, Python is handy in process control, traditionally
a domain for assembler, C, and Basic:
http://www.linuxjournal.com/article/7403

Philip dives deeply into Python optimization issues:
http://dirtsimple.org/2005/02/optimization-surprises.html
http://dirtsimple.org/2005/02/from-nine-to-five.html

Not only does Martin Franklin provide a new TableList widget
for Tkinter, but he clearly describes how he did so, apparently
in the belief that such knowledge might be useful to others:

http://mail.python.org/pipermail/tkinter-discuss/2005-February/000320.html
Stewart Midwinter answers with a poor-man's table widget:

http://mail.python.org/pipermail/tkinter-discuss/2005-February/000325.html

Philip Schoenborn explores RAII and related Python deli-
cacies related to resource management--in print!
http://ddj.com/articles/2005/0503/



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

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

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

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

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

Brett Cannon continues the marvelous tradition established by 
Andrew Kuchling and Michael Hudson of intelligently summarizing
action on the python-dev mailing list once every other week.
http://www.python.org/dev/summary/

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

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

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

The Python Business Forum further[s] the interests of companies
that base their business on ... Python.
http://www.python-in-business.org

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

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

Kurt B. Kaiser publishes a weekly report on faults and patches.
http://www.google.com/groups?as_usubject=weekly%20python%20patch
   
Cetus collects Python hyperlinks.
http://www.cetus-links.org/oo_python.html

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

The Cookbook is a collaborative effort to capture useful and
interesting recipes.
http://aspn.activestate.com/ASPN/Cookbook/Python

Among several Python-oriented RSS/RDF feeds available are
http://www.python.org/channews.rdf
http://bootleg-rss.g-blog.net/pythonware_com_daily.pcgi
http://python.de/backend.php
For more, see

[ANN] ConfigObj update - v3.2.5

2005-02-15 Thread fuzzyman
ConfigObj has had another update - now version 3.2.5

This update includes 3 bugfixes and several new features. Because of
the bugfixes it's reccomended for all users. New features include -
lines can now be broken over two or more lines, initial and final
comments in a config file are preserved (or can be set) when using the
write method, we can now read/write config files directly to and from a
StringIO object, and empty values are now valid (like 'value=' as per
ini files).

Homepage : http://www.voidspace.org.uk/python/configobj.html
For downloading, see the download section of the homepage.


What is ConfigObj
==

A python module (class) for ultra simple reading and writing of simple
config files, including config files with sections. Designed to allow
the greatest flexibility in the config files it will read (and your
users will create).

Many flexible features - but you don't need to use them !


What's New ?
=

The last announced release was 3.2.3, changes since then include :

   2005/02/15Version 3.2.5
   Changes so that ConfigObj can work with StringIO instances, by Wayne
Wiitanen
   (for a project that receives a configuration file over a socket
as a string.
   It is used as the source text for a StringIO object)
   Lines can be extended across more than one line, with the '\'
character
   (must be final character on line - it escapes the newline)
   Empty values can be written 'value=' (like the ini file - but read
only currently)
   Errors whilst parsing now report the line they occurred in
   Duplicate keys and sections are now reported as errors (bug fix)
   isflatfile can now handle '[' inside '\*.. *\' comments (bug fix)
   Fixed bug in handling of final line of '\*.. *\' comments
   If the first and last non empty lines of a config file are comments
they will be preserved as config.initial_comment and self.final_comment
  These are written out when the write method is called (but not
the writein method)
  New list attributes self.initial_comment and self.final_comment
   self.sectionfile is always set to the opposite of self.flatfile
 2005/01/07Version 3.2.4
   Use absolute paths for stored filename. Avoids problems when cwd is
changed.


There have also been a few other improvements to voidspace modules.
Hopefully I'll soon be announcing upgrades to approx,
approxClientproxy, and downman.py.

There is now more detailed information on customizing Movable Python
distributions. See http://www.voidspace.org.uk/python/movpy

Regards,


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

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


Re: check if object is number

2005-02-15 Thread Steven Bethard
Antoon Pardon wrote:
Op 2005-02-11, Steven Bethard schreef [EMAIL PROTECTED]:
George Sakkis wrote:
Steven Bethard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Is there a good way to determine if an object is a numeric type?
In your example, what does your application consider to be numeric?
Well, here's the basic code:
def f(max=None):
...
while max is None or n = max:
...
# complicated incrementing of n
So for 'max', technically all I need is = support.  However, the code 
also depends on the fact that after incrementing 'n' enough, it will 
eventually exceed 'max'.  Currently, ints, longs, floats, and Decimals 
will all meet this behavior.
Actually no, floats don't meet this behaviour or more specifically
floats don't guarantee this behaviour. It depends of course on
your implementation of f, but it is possible with floats to keep
incrementing and never reach a maximum.
My code won't hit this corner case.  I'm incrementing with integers.
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: PythonCard and Py2Exe

2005-02-15 Thread PipedreamerGrey
For this setup file, the executable packs, but when I attempt to run
the program, the screen flashes,  cannot import name radiogroup .
I've attempted adding import radiogroup, from Pythoncard import
radiogroup and  from Pythoncard.compnents import radiogroup  to the
setup file, and that doesn't help.  It simply terminates with no error.
 I've tried removing all references to radiogroup from the script's
resource file, but that defeats the purpose, as the list box is central
to the script's use.

My computer runs the script fine, so the radiogroup module must be
there.  I must just have the imports written wrong.

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


Re: Copying data between file-like objects

2005-02-15 Thread Steven Bethard
Thomas Lotze wrote:
another question: What's the most efficient way of copying data between
two file-like objects?
f1.write(f2.read()) doesn't seem to me as efficient as it might be, as a
string containing all the contents of f2 will be created and thrown away.
You could try f1.writelines(f2).
Steve
--
http://mail.python.org/mailman/listinfo/python-list


Re: PythonCard and Py2Exe

2005-02-15 Thread Thomas Heller
[EMAIL PROTECTED] writes:

 For this setup file, the executable packs, but when I attempt to run
 the program, the screen flashes,  cannot import name radiogroup .
 I've attempted adding import radiogroup, from Pythoncard import
 radiogroup and  from Pythoncard.compnents import radiogroup  to the
 setup file, and that doesn't help.  It simply terminates with no error.
  I've tried removing all references to radiogroup from the script's
 resource file, but that defeats the purpose, as the list box is central
 to the script's use.

 My computer runs the script fine, so the radiogroup module must be
 there.  I must just have the imports written wrong.

You should move these 'import ...' statements to your *script* so that
py2exe doesn find them, not to the setup script.

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


Re: Zope: Adding a layer causes valid output to become an object reference?

2005-02-15 Thread Junkmail
Dieter,

Thanks for the reply.  I ran across an article in the Zope FAQ that
nailed the problem on the head.  Basically it said the same thing you
are saying.  For those that follow in my footsteps one day...

ZPublisher Implicitly calls the method of a url which in the case of a
zclass is a call to index_html.  From ZPT and DTML however you must
Explicitly call the method of your zclass, for example:

  dtml-var get_users.index_html()

The paren () on the end are important!!

To make matters worse my external script references parameters in the
actual object I'm calling, but since I'm not calling a DTML method and
I have to explicitly reference the method I want to call, the DTML
namespace gets shipped to my external method instead of the namespace
of my called object.  I read groking acquisition 4 times before I
groked it.  To fix that I changed the index_html of my zclass to a
python script and call my external script from there so I can pass the
proper namespaces to the external script.  I suppose I can do that from
a DTML method, but the python script makes it absolutely clear what the
intention is.

I think the proper thing for the long term is re-write this as a
Product and emulate the way a DTML method accepts a call so I can avoid
all the blah.index_html() references and provide something a bit less
error prone (more standard).

I'm highly tempted to hack the existing DTML method into a new product
and leave DTML in it so I can combine Textile with DTML in a single
object.

Thanks,

Mike

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


Re: Kill GIL

2005-02-15 Thread Aahz
In article [EMAIL PROTECTED],
Adrian Casey  [EMAIL PROTECTED] wrote:
Aahz wrote:
 In article [EMAIL PROTECTED],
 Frans Englich  [EMAIL PROTECTED] wrote:

Personally I need a solution which touches this discussion. I need to run
multiple processes, which I communicate with via stdin/out,
simultaneously, and my plan was to do this with threads. Any favorite
document pointers, common traps, or something else which could be good to
know?
 
 Threads and forks tend to be problematic.  This is one case I'd recommend
 against threads.

Multiple threads interacting with stdin/stdout?  I've done it with 2
queues.  One for feeding the threads input and one for them to use
for output.  In fact, using queues takes care of the serialization
problems generally associated with many threads trying to access a
single resource (e.g. stdout).  Python Queues are thread-safe so you
don't have to worry about such issues.

The problem is that each sub-process really needs its own stdin/stdout.
Also, to repeat, forking tends to be problematic with threads.  Finally,
as Peter implied, I'm well-known on c.l.py for responding to thread
problems with, Really?  Are you using Queue?  Why not?  However, this
is one case where Queue can't help.
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

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


Re: keeping a COM server alive

2005-02-15 Thread Steve Holden
Do Re Mi chel La Si Do wrote:
Hi !
I had also make a Python-COM-server.
But, when I launch several clients, I obtain several instances of my
COM-server.
Finally, there are advantages and disadvantages in this established fact.
But I can't use this way for to exchange data between several clients. For
that, I use a TCP local server.
There are settings you can establish to determine the interactions 
between the COM server and its clients (threading model, in-process or 
out-of-process, etc).

If you don't get an answer on this list, try python-win32@python.org as 
a list where the readers will be more directly in tune with your needs.

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


os.walk() usage

2005-02-15 Thread rbt
I'm trying to write very small, modular code as functions to break up a 
big monolithic script that does a file system search for particular 
strings. The script works well, but it's not easy to maintain or add 
features to.

I'd like to have a function that builds a list of files with os.walk() 
and then have other functions accept that list as a parameter and modify 
it as needed. For example, if the user has specified that certain files 
and folders be excluded from the walk, I'd like to have functions like this:

def build_list(path):
fs_list = os.walk(path)
return fs_list
def skip_files(fs_list):
remove files
return fs_list
def skip_dirs(fs_list):
remove dirs
return fs_list
def search(fs_list):
pass
The problem I'm encountering is passing the list to other functions. 
It's almost as if each function needs to build the list itself (walk the 
filesystem)... which gets in the way of what I was asked to do (break 
this thing up into modular, maintainable pieces).

Any tips on this?
Thanks
--
http://mail.python.org/mailman/listinfo/python-list


Re: replacing ASP/VBScript with Python

2005-02-15 Thread D H
Peter Maas wrote:
Peter Maas schrieb:
I have inherited an extremely messy ASP/VBScript application which
is a pain for me to support. Now the customer is thinking about a
redesign. I'd like to rewrite the whole thing in Python but the app
has to meet some conditions like
- IIS frontend
- MSSQL db server
- Win32 authentication
- No 'ugly' URLs like http://server/cgi-bin/frontend.cgi?main.py
- Performance: intranet with ~ 1000 users

In the meantime I have searched the internet and found plenty of options:
- plain cgi with fastcgi and mod_rewrite for IIS to transform the URL
- quixote cgi with fastcgi and mod_rewrite
- Webware + wkcgi
- Python ASP (registering Python with Pywin32 as ASP language)
- mxODBC + SQL ODBC driver
- pyADO + SQL MDAC driver
Can those do Windows authentication though?  I guess you could with 
Python ASP.  If you really are stuck with ASP/IIS/Windows, then you 
might find using boo or ironpython easier since they work with .NET. 
I'm just saying it is an option, not that you shouldn't use CPython.

 - I'd like to do session handling in Python because ASP's session
   object is quite limited and some of the ASP app's mess is caused
   by trying to use it for compound data type storage. OTOH I could
   pickle Python objects to a string and store that in an ASP session.
For storing complex data objects, instead of pickle, you can either use 
.NET serialization: http://boo.codehaus.org/XML+Serialization
or db4objects, a GPL tool: http://www.db4o.com/
There is a sample of using boo with db4o here: 
http://db4oboobrowser.sourceforge.net/
Or ORMs like Gentle.NET can work with MSSQL:
http://www.mertner.com/confluence/display/Gentle/Home
--
http://mail.python.org/mailman/listinfo/python-list


Re: Copying data between file-like objects

2005-02-15 Thread Fredrik Lundh
Thomas Lotze wrote:

 f1.write(f2.read()) doesn't seem to me as efficient as it might be, as a
 string containing all the contents of f2 will be created and thrown away.

if f2 isn't too large, reading lots of data in one operation is often the most
efficient way (trust me, the memory system is a lot faster than your disk)

if you don't know how large f2 can be, use shutil.copyfileobj:

 help(shutil.copyfileobj)
Help on function copyfileobj in module shutil:

copyfileobj(fsrc, fdst, length=16384)
copy data from file-like object fsrc to file-like object fdst

 In the case of two StringIO objects, this means there's a point when the
 contents is held in memory three times.

to copy stringio objects, you can use f1 = StringIO(f2.getvalue()).  why you
would want/need to do this is more than I can figure out, though...

/F 



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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Pat
Fredrik Lundh wrote:
 Pat wrote:

  A few things.  Primarily the fact that I'm not very experienced in
C
  (the extensions that I need to have compiled are not written by
me).
  Secondarily, the fact that the discussion threads I read made it
seem
  much more complicated than what you just described.

 from two posts at the top of this thread:

 Writing a setup.py and running
 python setup.py build_ext --compiler=mingw32
 works for me *without* any more work. Things can't get much
 simpler.

 and

 The mingw compiler *is* supported through distutils. distutils
 can straightforwardly be configured to build extensions with
 mingw.

In my defense, the threads I was referring to were prior to this thread
and did not include the two snippets that you've quoted.  Besides,
there *was* additional work that needed to be done, specifically adding
the python23.dll or python24.dll to the \mingw\lib directory, as you
mentioned in one of your previous posts.  Now, I'm not saying any of
this is rocket science, or isn't fairly easy to overcome.  But it is a
definite stumbling block for someone like myself who is less fluent
with C that you are.

 (now go read Ilias replies to those posts)

I'm not Ilias.  He'll have to fend for himself.  I just happen to have
a similar need to understand how to simplify the process of compiling
extensions for Python in light of the recent changes with Python 2.4.

  Third, the fact that some of the code we've tried to compile didn't
compile
  cleanly, the way your cElementTree did (but I can't remember what
exactly
  the problem was and I didn't do the compiling).

 was that code tested under gcc?  code that compiles under visual C
doesn't
 necessarily compile silently under gcc, but fixing that is usually
pretty trivial
 (no worse than porting mostly portable code between platforms).

The code was not written by me.  Specifically, we are making use of
PEAK and the unofficial GPL port of Qt for Windows (not the upcoming
GPL version from Trolltech).  I just want it to work.  ;-)

  And, finally, an aversion to trial-and-error solutions.  I prefer
to Google and
  ask questions when I'm out of my element.

 sure didn't sound that way when you entered this thread:

 So in an effort to make some headway, I'm going to try to
summarize the
 current state of affairs.  The bottom line is that compiling C
extension modules
 on the Windows platform for Python 2.4 is, today, a royal pain in
the ass.
 Period.  Here's why. /.../

Okay, I suppose I could have done a better job phrasing that.  I should
have said something like in my personal opinion, finding definitive,
documented information on the proper way to compile C extensions for
Python in light of the recent changes to Python 2.4 is a royal pain in
the ass.  To that I would now add But Fredrik Lundh thinks things
can't get much simpler, and if you ask him nicely he'll show you the
error of your ways.  ;-)

 now go download MinGW and figure out what's wrong with your C code.

It isn't my C code.  I'm only including it as a dependency in my
project and trying to make the use of it by my users simpler than
could ever be conceived by someone who thinks things can't get much
simpler.  ;-)

 if you get stuck, post the error messages, and I'm sure some
c.l.pythoneer
 will help you sort it out.

Thanks.  In all seriousness, you're posts have helped.  When we ran
into snags we tried to compile cElementTree, got a bunch of errors,
figured out we hadn't copied python23.dll into /mingw/lib, and were
able to compile everything we needed.  We still haven't tried that for
Python 2.4 yet, due to other constraints that we haven't worked out.
But I think we are getting closer and your help is greatly appreciated.
 :-)

--
Patrick K. O'Brien
Orbtechhttp://www.orbtech.com
Schevo http://www.schevo.org
Pypersyst  http://www.pypersyst.org

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


Re: 64 bit Python

2005-02-15 Thread Mathias Waack
Mike C. Fletcher wrote:

 Mathias Waack wrote:
 ...
 
My python script allocates a bunch of strings each of 1024
characters and writes it in a cStringIO. And it fails after writing
512K of strings. Don't know how python restricts the heap size -
but I'm fairly sure its not a restriction of the OS.
  

 Does cStringIO require contiguous blocks of memory?  I'm wondering
 if maybe there's something going on where you just can't allocate
 more than
 a GB of contiguous space?  

That was the problem. I've used cStringIO to reduce the overhead by
the python memory management. But now I know - that was a bad idea
in this case. 

 What happens if you just store the 
 strings in
 a list (or use StringIO instead of cStringIO)?  

It consumed 10 GB really fast, another GB really slow, some hundred
MB much slower and then it died;)

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


Re: [perl-python] problem: reducing comparison

2005-02-15 Thread Joe Francia
Xah Lee wrote:
here's a interesting real-world algoritm to have fun with.
From you?  Doubtful.
Sorry, dude, but you've been replaced by über-troll Ilias Lazaridis. 
Security will escort you to the door.

--
Soraia: http://www.soraia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Copying data between file-like objects

2005-02-15 Thread Thomas Lotze
Fredrik Lundh wrote:

 if f2 isn't too large, reading lots of data in one operation is often the most
 efficient way (trust me, the memory system is a lot faster than your disk)

Sure.

 if you don't know how large f2 can be, use shutil.copyfileobj:
 
  help(shutil.copyfileobj)
 Help on function copyfileobj in module shutil:
 
 copyfileobj(fsrc, fdst, length=16384)
 copy data from file-like object fsrc to file-like object fdst

This sounds like what I was looking for. Thanks for the pointer.
However, the following doesn't seem like anything is being copied:

 from StringIO import StringIO
 from shutil import copyfileobj
 s = StringIO()
 s2 = StringIO()
 s.write('asdf')
 copyfileobj(s, s2)
 s2.getvalue()
''

 to copy stringio objects, you can use f1 = StringIO(f2.getvalue()).

But this should have the same problem as using read(): a string will be
created on the way which contains all the content.

 why you
 would want/need to do this is more than I can figure out, though...

Because I want to manipulate a copy of the data and be able to compare it
to the original afterwards.

Another thing I'd like to do is copy parts of a StringIO object's content
to another object. This doesn't seem possible with any shutil method. Any
idea on that?

What one can really wonder, I admit, is why the difference between holding
data two or three times in memory matters that much, especially if the
latter is only for a short time. But as I'm going to use the code that
handles the long string as a core component to some application, I'd like
to make it behave as well as possible.

-- 
Thomas


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


customizing metaclass constructed classes

2005-02-15 Thread Robin Becker
I have a set of classes for database access which are constructed using a 
special metaclass and base class.

so in the base module
#base.py
class M(type):
   def __init__(cls, name, bases, dict):
  super(M, cls).__init__(name, bases, dict)
  for f in dict['_fieldDefs']:
  #create special property based on the field def
  
class A(object):
   __metaclass__ = M
   _fieldDefs = []
   #base methods
   ..
in the database module we use the above
eg
#database.py
class C(A):
  _fieldDefs =[
IntColumn('id',primaryKey=1,allowNull=0),
TextColumn('name',allowNull=0,size=50),
TextColumn('description',allowNull=1,size=50),
]
Now to my question: can I change the definition of the client class C at run 
time? I want to do something like add another element to C's _fieldDefs and then 
get it to go through the construction phase provided by M. It's clearly 
pointless for me to try something like

from database import C
C._fieldDefs.append()
as C is constructed by the import.
I either have to delay C's construction or reconstruct it.
Would something like this do?
def reconstruct():
import database
class C(database.C):
  _fieldDefs = database.C._fieldDefs+[..]
database.C = C
Is there a better way to do this which preserves more of C's original identity? 
I suppose I want to call the metaclass initialization again, but can't see a way 
to do that.
--
Robin Becker

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


Newbie question about class operator overloading

2005-02-15 Thread Rory Campbell-Lange
Hi. I'm just starting to use python.

I am anxious about how best to set and access items one level down in a
data structure if I am using __setitem__ and __getitem__.

At the moment I can do

for a data structure Data:

object.Data = { 'one' : [1, 2, {}, 4],
'two' : [5, 6, {}, 8]}

I can use normal __setitem__ and __getitem__ to address Data keys very
easily

However, if I wish to access object.Data['one'][0] for instance, I am
using the following:

object['three'] = [0, 'val0'] # set
x =  object['three'][0]   # get

Is this advisable? I'm worried the syntax is very odd.

Extract from an example class:

def __setitem__ (self,key,value): 
if type(value) == list and type(value[0]) == int:
if key not in self.data:
self.data[key] = {} 
self.data[key][value[0]] = value[1]
else:
self.data[key] = value

def __getitem__ (self,key,value=None): 
if not value==None:
return self.data[key][value]
else:
return self.data[key]

-- 
Rory Campbell-Lange 
[EMAIL PROTECTED]
www.campbell-lange.net
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: customizing metaclass constructed classes

2005-02-15 Thread Robert Brewer
Robin Becker wrote:
 I have a set of classes for database access which are 
 constructed using a 
 special metaclass and base class.
 
 so in the base module
 
 #base.py
 class M(type):
 def __init__(cls, name, bases, dict):
super(M, cls).__init__(name, bases, dict)
for f in dict['_fieldDefs']:
#create special property based on the field def

 
 class A(object):
 __metaclass__ = M
 _fieldDefs = []
 
 #base methods
 ..
 
 in the database module we use the above
 eg
 
 #database.py
 class C(A):
_fieldDefs =[
  IntColumn('id',primaryKey=1,allowNull=0),
  TextColumn('name',allowNull=0,size=50),
  TextColumn('description',allowNull=1,size=50),
  ]
 
 Now to my question: can I change the definition of the client 
 class C at run 
 time? I want to do something like add another element to C's 
 _fieldDefs and then 
 get it to go through the construction phase provided by M. 
 It's clearly 
 pointless for me to try something like
 
 from database import C
 C._fieldDefs.append()
 
 as C is constructed by the import.
 I either have to delay C's construction or reconstruct it.
 
 Would something like this do?
 
 def reconstruct():
  import database
  class C(database.C):
_fieldDefs = database.C._fieldDefs+[..]
  database.C = C
 
 Is there a better way to do this which preserves more of C's 
 original identity? 
 I suppose I want to call the metaclass initialization again, 
 but can't see a way to do that.

You *are* using a language with callable functions, right? ;)

#base.py

def create_special_property(cls, f):
   # create special property based on f

class M(type):
def __init__(cls, name, bases, dict):
   super(M, cls).__init__(name, bases, dict)
   for f in dict['_fieldDefs']:
   create_special_property(cls, f)

#database.py
class C(A):
   _fieldDefs =[
 IntColumn('id',primaryKey=1,allowNull=0),
 TextColumn('name',allowNull=0,size=50),
 TextColumn('description',allowNull=1,size=50),
 ]

base.create_special_property(C, DateColumn('start_date'))

Slightly off-topic: if you really want to make it pretty, add a custom
descriptor so you can write:

class C(A):
   id = IntColumn(primaryKey=1,allowNull=0)
   name = TextColumn(allowNull=0,size=50)
   description = TextColumn(allowNull=1,size=50)

See UnitProperty (the descriptor), MetaUnit (the metaclass), and Unit
(the domain object) in http://www.aminus.org/rbre/dejavu/__init__.py for
an implementation of mine which you can steal in toto (because it's
public domain).


Robert Brewer
MIS
Amor Ministries
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Mike Meyer
Ilias Lazaridis [EMAIL PROTECTED] writes:

 MinGW compatibility is not my need.

Then why do you waste so much effort whining about it not being given
to you?

 It is an community need.

Based on the evidence at hand, this is a false statement.

  mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread bruno modulix
Ilias Lazaridis wrote:
there are other reasons behind the decision to not support the MinGW 
open-source-complier directly out of the main source-code base.

Yes, of course. The reason is they are lying about their commitment to 
open source. They are currently trying to port Python to .NET, and when 
done they'll retire the current implementation and lock everyone to a 
proprietary platform. I know it's hard to believe, but there are clues...

--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])
--
http://mail.python.org/mailman/listinfo/python-list


Postgres COPY Command with python 2.3 pg

2005-02-15 Thread Michael Lang
Hi to all,

can some one point me to the correct way, how to use PostgreSQLs COPY feature
from within python ?

What i want to do is:

connect
 start transaction
  drop current tablecontens
  copy new content from STDIN  # file need more privileged user rights
 commit transaction

using psql it works fine, but i dont know how to get it working in python.
Ive already made the calls but the changes never apper, and no error.
my suggestion was, that db.query(input|input|input) doesnt work as STDIN for
the Database, and i tryed db.putline() but no success.

Kind regards for any help
Michael Lang

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


RE: replacing ASP/VBScript with Python

2005-02-15 Thread Robert Brewer
Peter Maas wrote:
 I have inherited an extremely messy ASP/VBScript application which
 is a pain for me to support. Now the customer is thinking about a
 redesign. I'd like to rewrite the whole thing in Python but the app
 has to meet some conditions like
 
 - IIS frontend
 - MSSQL db server
 - Win32 authentication
 - No 'ugly' URLs like http://server/cgi-bin/frontend.cgi?main.py
 - Performance: intranet with ~ 1000 users

None of those sound like a problem.

 My personal preferences:
 
 - I'd rather do this in plain Python than using e.g. Zope because I
fear the additional complexity of handling Zope and make it seam-
lessly work with IIS.

I had the same fear. :)

 - I'd like to do session handling in Python because ASP's session
object is quite limited and some of the ASP app's mess is caused
by trying to use it for compound data type storage. OTOH I could
pickle Python objects to a string and store that in an ASP session.

 In the meantime I have searched the internet and found plenty of
options:
 
 - plain cgi with fastcgi and mod_rewrite for IIS to transform the URL
 - quixote cgi with fastcgi and mod_rewrite
 - Webware + wkcgi
 - Python ASP (registering Python with Pywin32 as ASP language)
 - mxODBC + SQL ODBC driver
 - pyADO + SQL MDAC driver
 
 I'm now confident that it is doable and keen on finding out. The usual
 question: what is the one and best way to do it? ;)

Python ASP (pywin32), but put as little code as possible into the
ASP--make it just a stub to call the real Python app. That app will be
running persistently in the background, which should obviate most of the
need for session support. That's been my experience, anyway.

Here's an example (from
http://www.aminus.org/rbre/cation/html/admin/ASP.html):

[EMAIL PROTECTED]
%
from cation.html.uiasp import UserInterfaceASP
from cation import catapp

ui = UserInterfaceASP(catapp)
ui.request(Request, Response)
%

The only downside is that ASP expects a physical file for every URL, so
you'll either have lots of dumb copies of the stub, or a single
dispatcher (and the ugly URL's you wanted to avoid). With a little
planning, you can have the stubs auto-generated.


Database side: try them all and see which is best with your dataset. ;)


Robert Brewer
MIS
Amor Ministries
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: os.walk() usage

2005-02-15 Thread [EMAIL PROTECTED]
every object in os.walk() returns a 3-tuple, like below, it seems your
code assumes it returns only a list of files.

for d in os.walk('c:\\temp'):
(dirpath, dirnames, filenames) = d
print dirpath
print dirnames
print filenames

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


some qustions on python

2005-02-15 Thread samar bazied
Hi..
plz
can u help me??
I am very new in python and I have some qustions about it.
can u give me design process of python and their related langauges?
and I will be very habby if u give me small evaluation of python
plz..
plz...
plz
help me..

-- 
___
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


1 cent a minute calls anywhere in the U.S.!

http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJurl=http://www.getpennytalk.com


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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
bruno modulix wrote:
Ilias Lazaridis wrote:
there are other reasons behind the decision to not support the MinGW 
open-source-complier directly out of the main source-code base.

Yes, of course. The reason is they are lying about their commitment to 
open source. They are currently trying to port Python to .NET, and when 
done they'll retire the current implementation and lock everyone to a 
proprietary platform. I know it's hard to believe, but there are clues...
impressive.
but things are much simpler.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: test_socket.py failure

2005-02-15 Thread x2164
[EMAIL PROTECTED] wrote:

  hi all,

  Linux 2.4.28
  Glibc 2.2.5
  gcc   2.95.3


  I'm new to Python.

  I've compiled Python 2.4 from tar file.

  When running 'make test' i'm getting a failure
  in test_socket.

  Running './python Lib/test/test_socket.py' yields:


 ==
 ERROR: testGetServBy (__main__.GeneralModuleTests)
 --
 Traceback (most recent call last):
   File Lib/test/test_socket.py, line 330, in testGetServBy
 port2 = socket.getservbyname(service)
 error: service/proto not found

 --
 Ran 58 tests in 3.826s



  The value of 'service' was daytime.

  After much hand wringing, editing, and use of 'print'
  statements i commented out line 330,
  '# port2 = socket.getservbyname(service)' and replaced it
  with the line 'port2 = port'.

  Running './python Lib/test/test_socket.py' now yields:


 testGetServBy (__main__.GeneralModuleTests) ... ok
.
.
.
 --
 Ran 58 tests in 5.181s

 OK

  
  Located the code for 'socket_getservbyname' in 
  'Modules/socketmodule.c' where the call to the glibc
  function 'getservbyname' is made: 

  Py_BEGIN_ALLOW_THREADS
  sp = getservbyname(name, proto);
  Py_END_ALLOW_THREADS
  if (sp == NULL) {
  PyErr_SetString(socket_error, service/proto not found);
  return NULL;
  }

  
  The only call of socket.getservbyname that failed was when
  it was passed the single argument.  Since the error message
  service/proto not found seems to only be generated upon
  failure of gibc's 'getservbyname' could it be that 
  'PyArg_ParseTuple(args, s|s:getservbyname, name, proto)'
  generates values for 'name' and/or 'proto' that cause the
  failure?

  My search for prior reports of failure at line 330 found
  a mention of problems at line 331.

  Well, at any rate, if someone could point me down the 
  correct path on this i would appreciate it.


  pete jordan
  x2164 - mailcity.com
  - equals at symbol




 http://www.die.net/doc/linux/man/man3/getservbyname.3.html


 The above link was provide by Nick Coghlan. 

 Thanks Nick.

 Well if the man page says it, then it must be so.

 By way of follow up i wanted to let you know that i think
 i've found the reason why i was getting the getservbyname
 behaviour that i described.

 In my /etc/nsswitch.conf file the original line for
 scanning the /etc/services file was:

 services:   nisplus [NOTFOUND=return] db files

 The nisplus module was being used first to scan the file
 and it apparently returns 'NOTFOUND' when proto is NULL.
 '[NOTFOUND=return]' then stops any of the other two
 services, 'db' and 'files', from being used to scan 
 the 'services' file.  I changed the 'services:' line to:

 services:   nisplus db files

 and now if proto is NULL the first line in the 'services' 
 file, matching the service argument passed to 
 getservbyname, is passed back.  This seems to be consistent 
 behaviour with the man page link above.

 I'm not sure removing '[NOTFOUND=return] ' is 100% 
 correct but from information in the libc info page i 
 think it will do.

 Later i'll post this as a followup to comp.lang.python 
 thread in case someone else might have the problem.

 Thanks for the help.


 pete jordan
 x2164 AT mailcity com



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


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Mike Meyer wrote:
Ilias Lazaridis [EMAIL PROTECTED] writes:
MinGW compatibility is not my need.
Then why do you waste so much effort whining about it not being given
to you?
It is an community need.
Based on the evidence at hand, this is a false statement.
  mike
MinGW compatibility is not [only] my need.
It is an community need [at least partially]
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: some qustions on python

2005-02-15 Thread Caleb Hattingh
http://www.python.org
On Tue, 15 Feb 2005 13:16:53 -0500, samar bazied [EMAIL PROTECTED]  
wrote:

Hi..
plz
can u help me??
I am very new in python and I have some qustions about it.
can u give me design process of python and their related langauges?
and I will be very habby if u give me small evaluation of python
plz..
plz...
plz
help me..

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


Re: os.walk() usage

2005-02-15 Thread bruno modulix
rbt wrote:
I'm trying to write very small, modular code as functions to break up a 
big monolithic script that does a file system search for particular 
strings. The script works well, but it's not easy to maintain or add 
features to.

I'd like to have a function that builds a list of files with os.walk() 
and then have other functions accept that list as a parameter and modify 
it as needed. For example, if the user has specified that certain files 
and folders be excluded from the walk, I'd like to have functions like 
this:

def build_list(path):
fs_list = os.walk(path)
return fs_list
def skip_files(fs_list):
remove files
return fs_list
def skip_dirs(fs_list):
remove dirs
return fs_list
def search(fs_list):
pass
The problem I'm encountering is passing the list to other functions. 
err...
search(skip_files(skip_dirs(build_list(path ?
What's your problem *exactly* ?-)
BTW, you may want to have a look at the path module :
http://www.jorendorff.com/articles/python/path/
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])
--
http://mail.python.org/mailman/listinfo/python-list


Re: customizing metaclass constructed classes

2005-02-15 Thread Robin Becker
Robert Brewer wrote:
...
..
You *are* using a language with callable functions, right? ;)
#base.py
def create_special_property(cls, f):
   # create special property based on f
class M(type):
def __init__(cls, name, bases, dict):
   super(M, cls).__init__(name, bases, dict)
   for f in dict['_fieldDefs']:
   create_special_property(cls, f)
#database.py
class C(A):
   _fieldDefs =[
 IntColumn('id',primaryKey=1,allowNull=0),
 TextColumn('name',allowNull=0,size=50),
 TextColumn('description',allowNull=1,size=50),
 ]
base.create_special_property(C, DateColumn('start_date'))
You're absolutely right :) I can modify the class in place if I
have access to the required modifications.
This seems more easily assimilable and definitely works in my cases.
Would it make sense to put the def create_special_property inside the metaclass 
as it then becomes available as a class method of A as well as being visible as 
cls.create_special_property(f) in the metaclass __init__?

Slightly off-topic: if you really want to make it pretty, add a custom
descriptor so you can write:
class C(A):
   id = IntColumn(primaryKey=1,allowNull=0)
   name = TextColumn(allowNull=0,size=50)
   description = TextColumn(allowNull=1,size=50)
I'll certainly take a look at this
See UnitProperty (the descriptor), MetaUnit (the metaclass), and Unit
(the domain object) in http://www.aminus.org/rbre/dejavu/__init__.py for
an implementation of mine which you can steal in toto (because it's
public domain).
--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread bruno modulix
Ilias Lazaridis wrote:
bruno modulix wrote:
Ilias Lazaridis wrote:
there are other reasons behind the decision to not support the MinGW 
open-source-complier directly out of the main source-code base.

Yes, of course. The reason is they are lying about their commitment to 
open source. They are currently trying to port Python to .NET, and 
when done they'll retire the current implementation and lock everyone 
to a proprietary platform. I know it's hard to believe, but there are 
clues...

impressive.
but things are much simpler.
Could you be more prolific ?
--
bruno desthuilliers
python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for 
p in '[EMAIL PROTECTED]'.split('@')])
--
http://mail.python.org/mailman/listinfo/python-list


Re: Iterator / Iteratable confusion

2005-02-15 Thread Michael Spencer
Michael Spencer wrote:
But, notwithstanding the docs, it is not essential that
iter(iterator) is iterator
Terry Reedy wrote:
 iter(iterator) is iterator is part of the iterater protocol

[...]I interpret [your post] as saying three things:
1. There is more than one possible definition of 'iterator'.
Terry, thanks for responding in depth.

2. It is not essential to not do something wasteful as long as it is 
otherwise inconsequential.
Not that iter(iterator) is iterator is somehow wasteful (actually it seems
conservative), but rather that alternative behavior is readily implmented.  You 
point out, reasonably, that if I do that, then what I get is not then an 
iterator, because it fails to conform with the protocol.

However, I suggest that there may be cases where iter(iterator) is not 
iterator is useful behavior.  What to call such an object is another matter.

For example, consider:
import itertools as it
def tee2(iterable):
class itertee(object):
def __init__(self, iterator):
self.iterator = iterator
def __iter__(self):
return itertee(self.iterator.__copy__())
def next(self):
return self.iterator.next()
return itertee(it.tee(iterable, 1)[0])
This returns an itertee instance which simply wraps the tee iterator returned by 
 itertools.  However iter(itertee instance) returns a copy of its iterator.  So 
this object creates as many independent iterators over iterable as are required.

In an earlier post in this thread, I included several examples of generating 
infinite series using iterator-copying like this.  I implemented the copying as 
a method of a containing iterable 'Stream', rather than of the iterators 
themselves, partly to respect the 'iterator protocol'.


3. You can substitute a copy of an object that is never mutated for the 
object itself.

This was not my intended point, although I accept that my example was too 
abstract.
Cheers
Michael
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Adam DePrince
On Tue, 2005-02-15 at 13:29, Ilias Lazaridis wrote:
 Mike Meyer wrote:
  Ilias Lazaridis [EMAIL PROTECTED] writes:
  
 MinGW compatibility is not my need.
  
  Then why do you waste so much effort whining about it not being given
  to you?
  
 It is an community need.
  
  Based on the evidence at hand, this is a false statement.
  
mike
 
 MinGW compatibility is not [only] my need.
 
 It is an community need [at least partially]

And herein lies the beauty of the noble meritocratic free software
movement.  

If the community needs it, a member of said community has both complete
unfettered freedom and a supportive environment to make it.   Any amount
of success at such an endeavor, even a feeble failure of an attempt,
would bring kudos the hero who attempts such a feat and possibly
organize unfathomable resources in the attendance of such a lofty goal.

Make us proud Ilias.  But whatever you do, don't beg.


Adam DePrince 

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


Re: replacing ASP/VBScript with Python

2005-02-15 Thread Peter Maas
Robert Brewer schrieb:
I'm now confident that it is doable and keen on finding out. The usual
question: what is the one and best way to do it? ;)

Python ASP (pywin32), but put as little code as possible into the
ASP--make it just a stub to call the real Python app. That app will be
running persistently in the background, which should obviate most of the
need for session support. That's been my experience, anyway.
Sounds reasonable. How do ASP-Python and IIS work together? Is the Python-
Interpreter loaded each time a Python-ASP is called?
Here's an example (from
http://www.aminus.org/rbre/cation/html/admin/ASP.html):
[EMAIL PROTECTED]
%
from cation.html.uiasp import UserInterfaceASP
from cation import catapp
ui = UserInterfaceASP(catapp)
ui.request(Request, Response)
%
That's interesting, thanks for the URL and your advice.
--
---
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
---
--
http://mail.python.org/mailman/listinfo/python-list


Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-15 Thread Ilias Lazaridis
Adam DePrince wrote:
On Tue, 2005-02-15 at 13:29, Ilias Lazaridis wrote:
Mike Meyer wrote:
Ilias Lazaridis [EMAIL PROTECTED] writes:
[...]
MinGW compatibility is not [only] my need.
It is an community need [at least partially]
And herein lies the beauty of the noble meritocratic free software
movement.  

If the community needs it, a member of said community has both complete
unfettered freedom and a supportive environment to make it.   
Which is this supportive environment?
Any amount
of success at such an endeavor, even a feeble failure of an attempt,
would bring kudos the hero who attempts such a feat and possibly
organize unfathomable resources in the attendance of such a lofty goal.
Make us proud Ilias.  But whatever you do, don't beg.
I don't beg.
If you think this, than please reread the thread (or at least the 
root-trunk)

Adam DePrince 
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: Accessing Objects Based On Their ID

2005-02-15 Thread Tim Daneliuk
Diez B. Roggisch wrote:
Given the ID of an object, is there a way to access it?  For example,
if we have the ID of a class instance, is there a way to invoke its
methods and attributes knowning only that ID?  Similarly, if we have the
ID of a function, is there a way to call it?

No. 


This comes up because of an implementation I had in mind wherein I
would store the IDs of a notionally linked-list of objects - but without
the link - I just want to store their IDs in the desired order.  But
later, when I want to actually use the objects I need a way to get from ID
back to something accessible in the namespace...

Why only the id? A list only stores a reference to the object anyway - no
copy of it. So you don't gain anything by using the id.
Point taken... thanks.
--

Tim Daneliuk [EMAIL PROTECTED]
PGP Key: http://www.tundraware.com/PGP/
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   >