ANN: PyDev 0.9.7 with support to java 1.3 and 1.4 released

2005-08-02 Thread Fabio Zadrozny
Hi All,

PyDev - Python IDE (Python Development Enviroment for Eclipse) version 
0.9.7  with support to java 1.3 and 1.4 has just been released.

Check the homepage (http://pydev.sourceforge.net/) for more details.

IMPORTANT:

- A new package has been added to the pydev release with support to 
earlier java versions (latest release just supports java 5.0).

- This package is targeted specifically for people that don't have 
access to java 5.0 (namely, earlier versions of MAC OS).

- Support for this release is limited to the .zip distribution in the 
sourcforge downloads, and will not be put into the update site.


Release Highlights:

This build fixes some nasty bugs from 0.9.6... it is highly recommended 
you install it. (right now, everything but the debugger should work fine 
with 3.1).

Important notes

Note 1: Because of some issues with Eclipse, you have to uninstall all 
previous PyDev installations before installing the new release.
Note 2: This release only works with Eclipse 3.1 (and from now on, 
Eclipse 3.0.x is no longer supported).

Regards,

Fabio

-- 
Fabio Zadrozny
--
Software Developer

ESSS - Engineering Simulation and Scientific Software
www.esss.com.br

PyDev - Python Development Enviroment for Eclipse
pydev.sf.net
pydev.blogspot.com


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

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


ANN: Kamaelia 0.2.0 has been released!

2005-08-02 Thread Michael Sparks
Kamaelia 0.2.0 has been released!

What is it?
===
Kamaelia is a collection of Axon components designed for network
protocol experimentation in a single threaded, select based environment.
Axon components are python generators are augmented by inbox and outbox
queues (lists) for communication in a communicating sequential processes
(CSP) like fashion.

The architecture is specifically designed to try and simplify the
process of designing and experimenting with new network protocols in
real environments. More background on the motivations behind Kamaelia
can be found here: http://kamaelia.sourceforge.net/Challenges/

The focus of this release adds in support for introspection, pygame based
interfaces, 4 new examples using these, visualisation tools, as well as
syntactic sugar to make building Kamaelia systems simpler. (Specifically
Graphline and pipeline systems. This build upon the existing base allowing
TCP and Multicast based client/server systems.

Other additions and changes include updated examples, variety of bugfixes
in existing components (some pre-emptively discovered by introspection), and
a variety of utility components. It is now also possible to write components
using threading as the concurrency model rather than generators - allowing
integration with thread/blocking only based systems.

The system is known to work under Linux, Mac OS X, Windows and a subset
has been tested on Series 60 mobiles.

General feedback is welcome either directly, mailing lists or via the
project weblog which is here:
* http://kamaelia.sourceforge.net/cgi-bin/blog/blog.cgi

What's new in version 0.2.0 ?
=

Lots! Full release notes can be found here:
   * http://kamaelia.sourceforge.net/Kamaelia-0.2.0-ReleaseNotes.html

Editted highlights...

Debian Packages! Many thanks are due to Gintautas Miliauskas, Programmers
of Vilnius, for assistance in building Debian packages. (The current
packages are based on his, and any errors are likely to be mine, not
his) These have been tested successfully on Ubuntu 5.04.

4 new examples have been added showing of various new subsystem:
   * Example 5 : This creates a simple streaming system, and looks inside
 to see what components are running/active, and passes the resulting
 information an Axon Visualiser.

   * Example 6 : This is a simple/generic topology visualisation server.
 Accepts the following commands over the network
ADD NODE id label auto -
ADD LINK id id
DEL NODE id
DEL ALL
 As this stands this is pretty useful, but that's pretty much everything
 it does like this.

   * Example 7 : This shows how the visualisation subsystem can be extended
 to work in different ways. What this does by default when run is
 randomly create new nodes and new linkages quite quickly, allowing
 you to see how the system works.

   * Example 8 : Sample slideshow/presentation tool. Unlike traditional
 slideshow/presentation tools, you can modify this to run arbitrary
 components. An example of how this can work is provided - allowing
 stepping through some graph visualisations along with the presentation.

A Tools directoy has been added with the following tools:
   * Axon Shell. (Requires IPython) Implements a simple command line shell
 which allows experimentation with Axon systems - the shell runs a
 scheduler as a background thread. For a tutorial of use, see:
   * http://kamaelia.sourceforge.net/AxonShell.html
   * Axon Visualiser. Implements a simple tool for looking inside (quite
 literally) running Axon/Kamaelia systems. This allows a very different
 style of debugging and can be extremely useful. Tutorial on its way!

Graphlines and Pipelines

  These are probably the most useful additions to Kamaelia since 0.1.2.
  They are essentially syntactic sugar for building and working with
  systems of components, but make building interesting systems rapidly
  out of pre-existing components fun and easy. The pipelines follow the
  same sort of model as the Unix pipeline. Graphlines are something new,
  and like pipelines and all linkages may take any data along them.

  Please take a look at the release notes for a graphline example.

  A couple of simple pipelines looks like this:

   pipeline(
  ReadFileAdaptor(file_to_stream, readmode=bitrate, bitrate=40,
  chunkrate=50),
  blockise(), # Ensure chunks small enough for multicasting!
  Multicast_transceiver(0.0.0.0, 0, 224.168.2.9, 1600),
   ).activate()
   pipeline(
  Multicast_transceiver(0.0.0.0, 1600, 224.168.2.9, 0),
  detuple(1),
  VorbisDecode(),
  AOAudioPlaybackAdaptor(),
  ).run()

A selection of other subsystems have been added - targeted at visualisation
of Kamaelia (and other graph structured) systems using pygame. The layout
mechanism is a simple physics engine. 

Key packages of note added: Kamaelia.UI, Kamaelia.UI.Pygame,

ANN: HarvestMan 1.4.5 beta 1

2005-08-02 Thread Anand
HarvestMan 1.4.5 beta 1 follows right at the heels of HarvestMan
1.4.5 alpha 2 which was released on July 21 2005.

The new version adds a lot of improvements on the command line options.
There is a wget like option which allows the user to just download
files without trying to crawl the website. The entire command line is
rewritten for ease of use and clarity.

Support for server-side dynamic web page extensions '.shtm', '.aspx',
'.cfm','.cfml','.cms' were added. Apart from there there are a few
minor
bug fixes.

The harvestman web site http://harvestman.freezope.org is not
reachable since the hosting provider, freezope seems to be down since
yesterday. However you can download the package and see the Changelogs
at http://developer.berlios.de .

Package:
http://download.berlios.de/harvestman/HarvestMan-1.4.5-b1.tar.bz2 .
Release information  Changelog:
http://developer.berlios.de/project/shownotes.php?release_id=6732 .

The release announcement is also available at freshmeat.

http://freshmeat.net/releases/203127/

Thanks

-Anand

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

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


ANN: matplotlib 0.83.2

2005-08-02 Thread John Hunter

matplotlib is a 2D plotting package for python.  This is a summary of
recent developments in matplotlib since 0.80.  For detailed notes, see
http://matplotlib.sf.net/whats_new.html,
http://matplotlib.sf.net/CHANGELOG and
http://matplotlib.sf.net/API_CHANGES

== Whats New ==

matplotlib wiki: this was just launched a few days ago and only has
  two entries to date, but we hope this will grow into a useful site
  with tutorials, howtos, installation notes, recipes, etc.  Please
  contribute!  Thanks to scipy.org and Enthought for hosting.
  http://www.scipy.org/wikis/topical_software/MatplotlibCookbook

CocoaAgg: New CocoaAgg backend for native GUI on OSX, 10.3 and 10.4
  compliant, contributed by Charles Moad.

TeX support : Now you can (optionally) use TeX to handle all of the
  text elements in your figure with the rc param text.usetex in the
  antigrain and postscript backends; see
  http://www.scipy.org/wikis/topical_software/UsingTex.  Thanks to
  Darren Dale for hard work on the TeX support.

Reorganized config files: Made HOME/.matplotlib the new config dir
  where the matplotlibrc file, the ttf.cache, and the tex.cache live.
  Your .matplotlibrc file, if you have one, should be renamed to
  .matplotlib/matplotlibrc.

Masked arrays: Support for masked arrays in line plots, pcolor and
  contours.  Thanks Eric Firing and Jeffrey Whitaker.

New image resize options interpolation options.  See help(imshow) for
  details, particularly the interpolation, filternorm and filterrad
  kwargs.  New values for the interp kwarg are:

'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom',
'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', 'blackman'

Byte images: Much faster imaeg loading for MxNx4 or MxNx3 UInt8
  images, which bypasses the memory and CPU intensive integer/floating
  point conversions.  Thanks Nicolas Girard.

Fast markers on win32: The marker cache optimization is finally
  available for win32, after an agg bug was found and fixed (thanks
  Maxim!).  Line marker plots should be considerably faster now on
  win32.

Qt in ipython/pylab: You can now use qt in ipython pylab mode.  Thanks
  Fernando Perez and the Orsay team!

Agg wrapper proper: Started work on a proper agg wrapper to expose
  more general agg functionality in mpl.  See examples/agg_test.py.
  Lots of wrapping remains to be done.

Subplot configuration: There is a new toolbar button on
  GTK*, WX* and TkAgg to launch the subplot configuration tool.

GUI neutral widgets: Matplotlib now has cross-GUI widgets (buttons,
  check buttons, radio buttons and sliders).  See
  examples/widgets/*.py and
  http://matplotlib.sf.net/screenshots.html#slider_demo.  This makes
  it easier to create interactive figures that run across backends.

Full screen mode in GTK*: Use 'f' to toggle full screen mode in the
  GTK backends.  Thanks Steve Chaplin.

Downloads available from http://matplotlib.sf.net
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Script for generating WSDL

2005-08-02 Thread Pranav Bagora
hello,

I am trying to write a python code which reads a web
service and creates its corresponding wsdl file. Any
idea how to do it.Please help

Thanks
Pranav  


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this Pythonic?

2005-08-02 Thread phil hunt
On Mon, 01 Aug 2005 22:01:06 +0200, Caleb Hattingh [EMAIL PROTECTED] wrote:
Peter

To my mind, this kind of setup (interface class, or abstact class) is more  
usually used in static languages to benefit polymorphism - but python is  
dynamically typed, so in which situations would this setup be useful in a  
python program?  You see, I expected your post to say that it wouldn't  
even be necessary, but you didn't :)

I realise it's not necessary. I just thought it would be nice to 
document the interfaces my concrete classes will be using.

I have spent a little effort training myself not to bother setting up  
class hierarchies like this in python, due to the fact that I use Delphi a  
lot at work (I do pretty much the code below to let myself know when an  
inherited/abstract class method is being called in error).

I started doing OO stuff with Smalltalk, where it isn't necessary, 
then moved to C++, where it is, and liked it.

-- 
Email: zen19725 at zen dot co dot uk


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


Re: Is this Pythonic?

2005-08-02 Thread phil hunt
On Mon, 01 Aug 2005 14:07:46 -0700, Erik Max Francis [EMAIL PROTECTED] wrote:

Yes, but raise NotImplementedError instead of Exception.  Another trick 
you can use is to prevent people from instantiating the abstract class:

   class Foo:
   def __init__(self):
   if self.__class__ is Foo:
   raise NotImplementedError
   ...

   def bar(self):
   raise NotImplementedError

That's a clever trick, but it's obvious from the code that the class 
is intended to be abstract, so if people are stupid enough to shoot 
themselves in the foot by creating an instance, I don't feel like 
adding extra code to protect themselves from their stupidity.

-- 
Email: zen19725 at zen dot co dot uk


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


Re: Is this Pythonic?

2005-08-02 Thread Erik Max Francis
phil hunt wrote:

 That's a clever trick, but it's obvious from the code that the class 
 is intended to be abstract, so if people are stupid enough to shoot 
 themselves in the foot by creating an instance, I don't feel like 
 adding extra code to protect themselves from their stupidity.

Right.  But even if you're not worried about stupidity, it's useful to 
have it fail in an explicit way as early as possible, rather than later 
on.  With that addition, the moment you try to create an instance of an 
abstract class, you get an exception.  Even if it's just a typo, and not 
severe negligence, that helps the problem get fixed sooner, rather than 
later.

-- 
Erik Max Francis  [EMAIL PROTECTED]  http://www.alcyone.com/max/
San Jose, CA, USA  37 20 N 121 53 W  AIM erikmaxfrancis
   Morality is a weakness of the mind.
   -- Arthur Rimbaud
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: doctest bug with nested triple quotes

2005-08-02 Thread Peter Otten
Michele Simionato wrote:

 I am getting trouble with nested triple quoted strings in doctest.
 For instance
 
 $ cat x.py
 
 dummy = '''
 something
 here
 '''
 
 import doctest; doctest.testmod()
 
 $ python x.py
 
 **
 File x.py, line 2, in __main__
 Failed example:
 dummy = '''
 Exception raised:
 Traceback (most recent call last):
   File /usr/lib/python2.4/doctest.py, line 1243, in __run
 compileflags, 1) in test.globs
   File doctest __main__[0], line 1
  dummy = '''
   ^
  SyntaxError: EOF while scanning triple-quoted string
 **
 
 Is this a know bug? Any workaround? Thanks for comments,

I think it is your bug. All lines but the first must be prefixed with
sys.PS2. Just add some dots to make it work:

'''
 dummy = 
... something
... here
... 
'''
import doctest; doctest.testmod()

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


Re: using Pyro for network games

2005-08-02 Thread garabik-news-2005-05
Michael Rybak [EMAIL PROTECTED] wrote:
 Hi, everyone.
 In topic 2-player game, client and server at localhost, I've asked
 about subj, and Peter Hansen suggested to switch to Twisted, Pyro or
 the like.
 
 I've tried using Pyro.
 
 I've written a very very simple test-game, in which you have 2 balls
 controlled by 2 players. Each player moves his mouse somewhere at
 his window, and his ball starts moving towards the pointer. No
 objectives, just to test how it works. The code is very small, so I
 can put it all here, skipping obvious stuff.
 
 I've tried playing this test-game via local-host - all is ok.
 Then I've tested via Internet connection with my friend. I have a
 33.6 Kbps modem, he has a 2 MBps dedicated line (if this is the term),
 and we ran a server at his pc and both connected to it. His ball ran as
 a child, smoothly and quickly, while I had about 5 fps :(, and for him
 it looked like my ball is simply very slow. I realise that client at
 my pc *has* to work slower than the client at server's pc, but hey,
 I've played Quake2 and WarCraft 2 via 33.6 modem, and those should have
 much more stuff to transfer per second :(
 
 Please help me in any way you can think of. I'd welcome links to
 Python games written with Pyro, tips on what I am doing wrong, on not
 Pythonically enough - anything.


Do not use pyro, use simple UDP protocol. 
I've written networked tetris in python, communicating via
UDP protocol, and used it successfully on very congested lines.
If all you need is to transfer pointer coordinates, UDP is perfect since
you do not need feedback.

use something like this for server:

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', port))
while 1:
data, addr = s.recvfrom(1024)
print `data`


and for client:

import socket

outsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
outsock.bind(('', 0))
outsock.sendto('message', ('server-hostname', server_port))



-- 
 ---
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
-- 
http://mail.python.org/mailman/listinfo/python-list

Re[4]: need for speed

2005-08-02 Thread Michael Rybak
sorry for emailing privately, pressed the wrong reply button

DLB On Mon, 1 Aug 2005 20:14:51 +0300, Michael Rybak [EMAIL PROTECTED]
DLB declaimed the following in comp.lang.python:


 
 Is there a way of profiling other than manual (debug output with

DLB Chapter 10 of the Python Library Reference... You have looked at
DLB that document, haven't you?
Already am, yes!

 measurements and all)? Some tools? And is there some kind of plugin
 for native Python's IDLE to trace scripts? I'm a bit tired of getting

DLB Have you read Chapter 9?
ok, I'm looking through. A bit tough for me I think, I can live with
debug outputs :) Well I'm too much used to M$ V$ / Borland Delphi
interfaces to switch to almost-asm-like debugging.

DLB BTW: if you are working on M$ Windows,
 only on that
DLB you might want to consider installing the ActiveState release
I tried, and the installer gives me that stupid Internal Error 2229:
Control, SELECT 'Control', 'Type', 'X', 'Y', [..snip..], 'Dialog' = ?
And I forgot the OK button.

DLB -- PythonWin might be nicer than IDLE (and has the referenced
DLB manuals formatted as Windows help files).
I am using a *.chm file containing all online documentation available
from python.org



DLB -- 
DLB   == 
DLB [EMAIL PROTECTED]  | Wulfraed  Dennis Lee Bieber  KD6MOG 
DLB[EMAIL PROTECTED] |   Bestiaria Support Staff   
DLB   == 
DLB Home Page: http://www.dm.net/~wulfraed/
DLB  Overflow Page: http://wlfraed.home.netcom.com/



-- 
Best Regards,
 Michael Rybak   mailto:[EMAIL PROTECTED]

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


Re[6]: 2-player game, client and server at localhost

2005-08-02 Thread Michael Rybak
sorry for emailing privately, pressed the wrong reply button

 Each player controls a snake, which is 2 to 12 balls connected to each
 other with ropes; by mouse motions you move the snake's head, and the
 rest of the body moves adhering normal physics. The objective/gameplay

DLB For purposes of the motion this snake -- the game rendering side
DLB (the client) probably should handle the physics. The only part being
DLB actively controlled is the head, and only the head movement needs to be
DLB sent -- the clients respond to head movement and compute the effect on
DLB the rest of the body. IOW, the head and /attached/ balls are ONE object
DLB for purposes of server I/O, not 2 to 12.
 Well, that's exactly how I think of it.

 is unimportant here, but if you're curios - all the balls of your
 snake are bullets, and right-clicking releases current tail. So, you
 have to spin around, and release the tail in appropriate moment so it

DLB At this point, you've added another object to track -- but it
DLB sounds like all you need to send is a vector (start position, direction,
DLB speed). The server, on each input can compute -- based on the
DLB situation at that moment -- if an intersect will occur, and when. That
DLB state doesn't change unless on or the other player inputs some new
DLB command (the target player, most likely, trying to avoid impact).
But that happens all the time, and lots of times per second! If you
played Quake, CS or even UT :), you know that you hold your forward
key pressed all the time, and you also move your mouse aiming on
target almost all the time. And when I play Quake, I *see* how my
opponent's model aims at me, I mean, his mouse motions are transferred
to me.
 Well, I suppose that Quake doesn't send mouse motion, clients
probably retrieve the resulting aiming direction from server, but in
my case, as you said yourself, client side should do physics'
computations.

DLB Upon the new input, the server interpolates all moving objects -- that is,
DLB its prior update (time T0) says an intersect will occur at time T0+t,
DLB and the player response came in at t/2 (halfway, for simplicity). The
DLB server would compute positions for tracked objects at (T0+t/2), then
DLB apply the new motion vectors (player changed heading), transmit all this
DLB to all clients, and determine the next intersect time. The server
DLB doesn't have to do anything until either this intersect time or a play
DLB input comes in.
 That's the problem - or a player input comes in. As I've explained,
this happens a dozen of times per second :(. I've even tried not
checking for player's input after every frame, but do it 3 times more
rare (if framecount % 3 == 0 : process_players_input()). Well, I've
already got it that I shouldn't tie this around framerate, but
nevertheless...

 So, you see - server will have to send current status as much time per
 second, as much fps I want, and that's quite a lot of data.

DLB No... Frame rate is independent. Each client should perform some
DLB tests to determine what frame rate they can support, and adjust their
DLB internal time-steps to that. The server should probably send a
DLB time-stamp so clients can adjust for running over (might result in small
DLB jerks on slow machines, say). Of course, the server will need to check
DLB its clock speed to determine what size a time step will be (and maybe
DLB send that to clients so clients can compute a clock factor for internal
DLB calculations -- especially if the server is using a simulation clock
DLB for speed rather than wall clock time)
 I'm afraid I'm loosing it. Let's consider your example:

DLB Say the snake is moving left to right at 100 pixels (or some
DLB game internal unit) per second, and client one can only run 5FPS; that
DLB means each rendering pass uses the head position as:
DLB P(f) = P(T0) + (100/5)*f.
DLB {P(f) is Position(frame); P(T0) is the position at the start, the last
DLB status received from the server; 100/5 is the speed divided by the frame
DLB rate = speed per frame}

DLB The other client may be running 50FPS... For that client, the
DLB same status turns into:
DLB P(f) = P(T0) + (100/50)*f

DLB The first player sees the snake move 20 pixels per frame. The
DLB second player will see it move 2 pixels per frame, but will see 10
DLB frames in the time the first player sees one.

This sounds transparent, but my slow client isn't able to process
networking fast enough, so even if it's able to work at 30 fps, it
can't draw those 30 frames, because input from other player comes
instantly, about 10 times per second, and server tries sending this to
all clients. So my slow client simply can't know current true status,
thus has nothing to draw, because it can't handle 10 transfers per
second. And if server doesn't send user motions equal number of times
to all clients, while they compute the world's status, they will
happen to have different pictures 

Re[2]: need for speed

2005-08-02 Thread Michael Rybak
sorry for emailing privately, pressed the wrong reply button

BD Michael Rybak a écrit :
BD (snip)
 
 Is there a way of profiling other than manual (debug output with
 measurements and all)? Some tools?

BD http://docs.python.org/lib/profile.html

BD HTH

Oh, wow! Manuals rule, I should have at least skimmed through.
Thanks a lot, already profiling :)

-- 
Best Regards,
 Michael Rybak   mailto:[EMAIL PROTECTED]

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


Re: startfile problems

2005-08-02 Thread Timothy Smith
Dennis Lee Bieber wrote:

On Tue, 02 Aug 2005 15:10:23 +1000, Timothy Smith
[EMAIL PROTECTED] declaimed the following in comp.lang.python:

  

i'm very curious as to what everyone thinks



   I suspect most of us think: Where's the code?
   followed by: Where's the traceback?

   As for your statement of verifying the path and filename... We
haven't seen it so can't guess... (part of the where's the code)

   Does the path contain \n, \t, \r, \f, etc. If it does, and you
are not using a raw string, you are looking for a file with newline,
tab, carriage return, formfeed, etc. respectively in the name.


fid = c:\temp\something.pdf  #bad, this is
#  c:tabemp\something.pdf
#  assuming \s isn't some special character

fid = rc:\temp\something.pdf #good
fid = c:\\temp\\something.pds #okay

  

it's iterally just

PDFname = 'tmp.pdf'
os.startfile(PDFname)

thats the code.

so obviously it contains no errnous characters. see my update btw. it 
actually DOES open the report, but throws up the exception as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is this Pythonic?

2005-08-02 Thread Reinhold Birkenfeld
Delaney, Timothy (Tim) wrote:
 Peter Hansen wrote:
 
 Change those to raise NotImplementedError('blah') instead and you'll
 be taking the more idiomatic approach.
 
 One thing I've noticed, which I may raise on python-dev ...
 NotImplementedError does *not* play well with super() ...
 
 class A (object):
 def test (self):
 raise NotImplementedError
 
 class B (object):
 def test (self):
 print 'B'
 super(B, self).test()
 
 class C (B, A):
 def test (self):
 print 'C'
 super(C, self).test()
 
 It's actually worse than AttributeError, because the method actually
 exists. In both cases though you need to know when you create the base
 class how it's going to be used to work out whether a super() call is
 needed.
 
 One option is to do a try: except (AttributeError, NotImplementedError).
 Yuk - talk about hiding errors :(

Hm... one could return NotImplemented from the abstract method. It won't raise
an error immediately, but will certainly be discovered at some point.

Not optimal though.

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


Re: Wheel-reinvention with Python

2005-08-02 Thread Torsten Bronger
Hallöchen!

Mike Meyer [EMAIL PROTECTED] writes:

 Torsten Bronger [EMAIL PROTECTED] writes:

 [...]

 I'm interested in a language with a big community.  This is my
 definition of success.  [...]

 GUI applications seem to be the most attractive application type.
 This is not only true for commercial programming.  When I look at
 the most agile projects on Sourceforge, almost all of them have a
 GUI.

 Why restrict yourself to agile projects?

Because such projects attract the greatest number of developers,
many of them being amongst the most diligent developers, too.  I
expect this to have a positive influence of the language.

 [...]

 I won't argue that most of the projects on Sourceforge have GUIs -
 that's certainly true. I will argue that most of the projects are
 done in languages that aren't what you call GUI-aware.

Yes, this is what I meant with legacy code.  C and C++ are
actually special-purpose.  They are good for controlling a computer
but not for implementing an idea.  Their current vitality on almost
all software areas arise from the fact that they had been extremely
successful before Java, C#, and VB came into play.  Invented today,
they would be niche languages.

However, even C++ is really successful only when used as a GUI-aware
dialect.  Additionally, Python does not have this legacy bonus.

 Therefore, GUI-aware languages attract much larger user bases,
 and so they cater my definition of being successful.

 Since you haven't stated what that definition is, I can't really say
 anything about this.

Yes, I did.

 [...]

 Legacy code is not a sign of success IMO because it implies a
 difficult future.

 So you're saying that Python, Perl, Linux, the various BSD
 et. al. will have a difficult future? [...]

No.  All I said was that if a language's success relies almost
exclusively on the heavy presence of legacy code, its future is
difficult.  I see this for C and C++ excluding VC++.  They will
always be there, but cool new things will be made available
firstly (or only) for Java, C#, Python etc.

 [...]

 Or maybe you could switch to Jython, and just use swing?

Actually I'm very happy with CPython.  Besides, I don't like the
Java world.  When I left C++ last winter, I dithered between C#,
Ruby, and Python.


BTW this thread was extremely interesting for me.  I've learnt a
lot.  (Unfortunately, two weeks ago I opted for wxPython, after a
long and tough time of thorough pondering, and today this thread
informed be about progress on the Tk front.  *cry* ;-)

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Dabo in 30 seconds?

2005-08-02 Thread EP
Jorge Godoy opined:

  We can find several problems, almost all of them can be solved with 
  the admin's creativity.  


In response to which Cliff Wells posted an interpreter session:

  import creativity
 Traceback (most recent call last):
   File stdin, line 1, in ?
 ImportError: No module named creativity
 
 
 Nope.  Not included with Python.  Can't be used.


Does anyone remember where all the modules in The Path originated from?  
Joesusedgui modules mingle with the standard library on my machine, and as long 
as the import statements work, maybe it doesn't matter.  Which, again, is 
Python?

Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32
***

IDLE 1.1.1  
 import creativity
 creativity.whatis()
Creativity is everywhere, even more so in the abysss
generator object at 0x00B433F0
 




cheers

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


Re: Python IDE's

2005-08-02 Thread Adriaan Renting
vi/vim is a godssend if you need a working system that needs to fit in 4
Mb or ROM, but it's an editor not an IDE. You can debate about how good
an editor it is, but that's just differences in taste I suppose.

When talking about IDE's I mean a lot more as 'just' an editor, below is
my 'wishlist', I would be very interested what solutions you use, how
much time it took you to set up this solution, and which parts of my
'wishlist' it implements. Also suggestions to add to my 'wishlist' are
welcome:

- Integrated help.
when I press help button I should get a help page that's appropriate
for the piece of code my cursor currently sits on.
- Code completion.
If I type 'os.path.', the editor should be a ble to show me a list of
all methods and attributes the module has. If I then continue with
'os.path.isfile(', it should show me the parameters for the function.
- Integrated GUI design.
The IDE should have a graphical tool for designing GUIs, and the editor
should be aware of it and propagate changes in an inobtrusive way.
- Integrated debugger.
I should be able to run my module/program from the editor, execute up to
the current cursor position, preset breakpoints (maybe with conditions).
The editor should highlight the current line being executed, and give
you the choice to: step to the next line, step into the execution of the
current line, step out to the function that called the current code, run
to the next brekpoint, etc.
When the code is running I should be able to inspect the values of all
variables currently assigned and change them on the fly.
- Code aware editor.
Syntax highlighting, syntax checking, automatic indentation, loop
folding. Functionality like refatoring, create function from selected
code, inlining current selected function, template macros, coding
mistake warnings (for if (somevar); {do something;} in C/C++ kind of
mistakes).
- Integration with version control system.
- Code documentation/inspection tools.
Ability to generate include and inheritance trees, LOC counters,
profiling what lines of you code get executed most/never, helpfile
generation from code, etc.
- Project management.
Tools for communication with coworkers, bugtracking, which targets need
which files, automatic install scripts/tools, etc.
- Accessible user interface.
All functionality should be accessible through some menu structure, so I
don't need to depend on my memory. Prefereable reprogrammable/assignable
shortcut keys for all functionality, maybe even some form of macros,
plugins, etc.
- For C/C++: 
memory leak detection

Why  I want this?
Because I want to spend my time programming my code, not my developement
environment.

I currently use Eric3+QtDesigner for Python, and while not perfect, I
realy like it. I have used Borland C++Builder for C/C++ in the past for
Windows, but I haven't found a satisfactory C/C++ solution for my
current Linux system yet.

--
Adriaan Renting| Email: [EMAIL PROTECTED]
ASTRON | Phone: +31 521 595 217
P.O. Box 2 | GSM:   +31 6 24 25 17 28
NL-7990 AA Dwingeloo   | FAX:   +31 521 597 332
The Netherlands| Web: http://www.astron.nl/~renting/
 [EMAIL PROTECTED] 08/02/05 4:42 AM 
On Mon, 01 Aug 2005 18:21:08 -0400
Benji York wrote:

 Jon Hewer wrote:
  But, if i use Vi, then whenever i want to test some code i have to
  open up python, import the necessary modules and run it - I like the
  idea of developing python in an IDE and just hitting a run button.
 
 map F5 :wCR:!python %CR

Or, probably even better:

map F5 :wCR:!xterm -e python -i % CRCR

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

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


Re: doctest bug with nested triple quotes

2005-08-02 Thread Michele Simionato
This is my file
$ python -c print open('x.py').read().encode('base64')
IiIiCj4+PiBkdW1teSA9ICcnJwpzb21ldGhpbmcKaGVyZQonJycKIiIiCmltcG9ydCBkb2N0ZXN0
OyBkb2N0ZXN0LnRlc3Rtb2QoKQo=

but anyway I think Peter Otten is right, the problem is with the
missing dots.
It makes sense, actually, but for some reason I would never have
thought
of it (I did not expect doctest to be so smart to strip the dots even
inside a string).
Thanks for the feeback and the quick solution,

   Michele Simionato

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


Re: Dabo in 30 seconds?

2005-08-02 Thread Daniel Dittmar
Jorge Godoy wrote:
 I agree where you say that lack of information is a risk.  But I don't see
 how it -- lack of information -- wouldn't affect both scenarios.  At least,

Because you put different probabilities on different outcomes. One easy 
'risk markup' would be to assume that parts of the standard Python 
distribution like TkInter have a higher chance of working with the next 
release than external libraries like wxPython. Of course, there are lots 
of other possible criteria:
- which has been under more active development in the last releases
- which source code is easier to understand so that I don't have to rely 
on external help

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


Re: Is this Pythonic?

2005-08-02 Thread Michael Hudson
[EMAIL PROTECTED] (phil hunt) writes:

 Suppose I'm writing an abstract superclass which will have some 
 concrete subclasses. I want to signal in my code that the subclasses 
 will implement certan methods. Is this a Pythonic way of doing what 
 I have in mind:

 class Foo: # abstract superclass
def bar(self):
   raise Exception, Implemented by subclass
def baz(self):
   raise Exception, Implemented by subclass

 class Concrete(Foo):
def bar(self):
   #...actual implemtation...
def baz(self):
   #...actual implemtation...

Well, I guess you know this, but if Foo contains no implementation at
all, why inherit from it?  It would (possibly) be more Pythonic to
define an interface instead, or just use duck typing.

Cheers,
mwh

-- 
  nonono, while we're making wild conjectures about the behavior
  of completely irrelevant tasks, we must not also make serious
  mistakes, or the data might suddenly become statistically valid.
-- Erik Naggum, comp.lang.lisp
-- 
http://mail.python.org/mailman/listinfo/python-list


Re[2]: using Pyro for network games

2005-08-02 Thread Michael Rybak
gn20kjss Do not use pyro, use simple UDP protocol.
gn20kjss I've written networked tetris in python, communicating via
gn20kjss UDP protocol, and used it successfully on very congested lines.

Would you please be so kind to share that with me? That would be
greatly helpful, because 1) I'd run it together with my friend to see
what speed I can get from UDP 2) I'd grasp the networking part of your
code and reuse it.

gn20kjss If all you need is to transfer pointer coordinates, UDP is perfect 
since
gn20kjss you do not need feedback.

gn20kjss use something like this for server:

gn20kjss import socket
gn20kjss s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
gn20kjss s.bind(('', port))
gn20kjss while 1:
gn20kjss data, addr = s.recvfrom(1024)
gn20kjss print `data`


gn20kjss and for client:

gn20kjss import socket

gn20kjss outsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
gn20kjss outsock.bind(('', 0))
gn20kjss outsock.sendto('message', ('server-hostname', server_port))
Would you recommend some reading on this? I have some immediate
questions to your code, but don't want to flood here. OK, I will flood
here a bit: what's the print `` syntax?

P.S. I loved your virus alert ;)


gn20kjss -- 
gn20kjss  ---
gn20kjss | Radovan Garabik http://kassiopeia.juls.savba.sk/~garabik/ |
gn20kjss | __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
gn20kjss  ---
gn20kjss Antivirus alert: file .signature infected by signature virus.
gn20kjss Hi! I'm a signature virus! Copy me into your signature file to help 
me spread!



-- 
Best Regards,
 Michael Rybak   mailto:[EMAIL PROTECTED]
 

Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!

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


Re: ANN: Kamaelia 0.2.0 released!

2005-08-02 Thread phil hunt
Kamaelia seems it might be an interesting project. However, I don't 
think the project is well served by this announcement -- which I 
find vague and hard to understand. Which is a shame, because it 
means that other people probably don't understand it very well 
either, which means less people will use it.

In a spirit of constructive criticism I'd like to give some detailed 
comments about this...


On Mon, 01 Aug 2005 19:50:11 +0200, Michael Sparks [EMAIL PROTECTED] wrote:

Kamaelia is a collection of Axon components designed for network
protocol experimentation in a single threaded, select based environment.
Axon components are python generators are augmented by inbox and outbox
queues (lists) for communication in a communicating sequential processes
(CSP) like fashion.

I really have very little idea what this means.

The architecture is specifically designed to try and simplify the
process of designing and experimenting with new network protocols in
real environments. 

The information I can guess out of this is: Kamaelia is a library 
for creating network protocols that sit on top of tcp and/or udp. 
Given that it's a BBC project, I imagine we're talking about 
protocols for transferring large amount of data, e.g. sound or 
motion pictures.

More background on the motivations behind Kamaelia
can be found here: http://kamaelia.sourceforge.net/Challenges/

There's something interesting here:

  In Building Public Value, the BBC has committed to the delivery of 
  BBC content to the British Public over this multitude of systems, 
  in a way that is enjoyable, accessible and **repurposable** by the 
  British Public in the way they choose.

(my emphasis)

This is a laudable aim, but if the BBC want to do this, the first 
step they could make is to open up their content under a Creative 
Commons licence. They could start with their news, current affairs 
and documentaries. They could also do this with music downloads: for 
example a few weeks ago they made available for free download 
all of Beethoven's symphonies, performed by the BBC Orchestra. But the
download only staryed up for a week, and they didn't put the files 
under a CC license, so they could be redistributed. Why not? It 
would have cost them no more to do so than what they did, and 
would've provided better value for downloaders and music lovers.

Of course, the music industry would've complained, but they did
anyway. Frankly, fuck them. Their business model is obsolete, and
they should either get a new one or crawl into a corner and die.

BTW, the html is broken in that it's very poorly written, doedsn't
use CSS, and some of the stuff that is intended to display in a
monospaced font doesn't.  For example, this HTML code from 
http://kamaelia.sourceforge.net/Docs/Axon.html:


  divspan style=font-family:Courier 10 
  Pitch;font-weight:600def/spanspan style=font-family:Courier 
  10 Pitch main(self):/span/div
  ul type=discdivspan style=font-family:Courier 10 
  Pitch;font-weight:600yield/spanspan 
  style=font-family:Courier 10 Pitch 1br //spanspan 
  style=font-family:Courier 10 Pitch;font-weight:600while/span
  span style=font-family:Courier 10 Pitch(self.i):/span/div

could be better written as:

  pre
 def main(self):
yield 1
while (self.i):
  /pre

Much, much simpler, and actually works.

General feedback is welcome either directly, mailing lists or via the
project weblog which is here:
* http://kamaelia.sourceforge.net/cgi-bin/blog/blog.cgi

I guess the main question that needs to be answered is Why would I, 
as a programmer, use Kamaelia?


-- 
Email: zen19725 at zen dot co dot uk


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


Re: Wheel-reinvention with Python

2005-08-02 Thread phil hunt
On Tue, 02 Aug 2005 00:42:53 -0400, Mike Meyer [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] (phil hunt) writes:
 In practise any Python GUI is going to contain code from otyher 
 languages since if it was coded all the way down in python it would 
 be too slow.

Not necessarily. My window manger is Python all the way down

Your X server is written in Python? :-)

 - it uses
the Python Xlib implementation - and is plenty fast.

Of course, it doesn't do a lot of graphics work, even for a window
manager.

That's what I mean: painting the individual pixels on the screen.

-- 
Email: zen19725 at zen dot co dot uk


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


Re: Python Programming Contest: First results

2005-08-02 Thread Brian Quinlan
Tomi Kyöstilä wrote:
 Why don't I see my solution (__author__ = dOb) in the results? I'm 
 sure that you got it as you replied to my mail.

Ahhh...sorry. I have your solution and I timed it but I don't have the 
results here so I can't add it to the website. I'll do it tomorrow.

 Where do the timing results come from? Is it the number that 
 fly_test.main(['fly']) outputs? I don't think it is that because with my 
 solution that would be ~0.06 seconds.

This is the time required to do several thousand trials.

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


Re: Is this Pythonic?

2005-08-02 Thread phil hunt
On Tue, 02 Aug 2005 08:31:27 GMT, Michael Hudson [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] (phil hunt) writes:

 Suppose I'm writing an abstract superclass which will have some 
 concrete subclasses. I want to signal in my code that the subclasses 
 will implement certan methods. Is this a Pythonic way of doing what 
 I have in mind:

 class Foo: # abstract superclass
def bar(self):
   raise Exception, Implemented by subclass
def baz(self):
   raise Exception, Implemented by subclass

 class Concrete(Foo):
def bar(self):
   #...actual implemtation...
def baz(self):
   #...actual implemtation...

Well, I guess you know this, but if Foo contains no implementation at
all, why inherit from it?

(in fact the class I'm using/creating does contain some 
implementation)

It would (possibly) be more Pythonic to
define an interface instead,

Does Python have the concept of an interface? When was that added?


-- 
Email: zen19725 at zen dot co dot uk


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


Re: calling functions

2005-08-02 Thread bruno modulix
anthonyberet wrote:
 This is the first time I have tried out functions (is that the main way
 of making subroutines in Python?)

A function is allowed to change it's arguments and to return None, so
yes, you can consider it as a 'subroutine'.

 
 Anyway, my function, mutate, below
 
 #make a child string by randomly changing one character of the parent
 
 Def mutate():
s/Def/def/

meta
please copy-paste code - retyping it increases the risk of typos.
/meta

 newnum=random.randrange(27)
 if newnum==0:
 gene=' '
 else:
 gene=chr(newnum+96)

 position=random.randrange(len(target))
 child=parent[:position-1]+gene+parent[position+1:]

Where does this 'gene' come from ?-)

 mutate()
 
 
 The trouble is when I later (as in further down the code) attempt to
 retrieve the value of gene I get an error saying that gene is undefined.

Of course it is.

 It works fine when I don't have the routine defined as a function. - the
 IF- Else structure means gene must have a value of ' ' or 'a' to 'z'.

This 'gene' only lives in the function body - as with almost any other
programming language.

 It seems that the line:
 
 mutate()
 
 is not invoking the function, 

It is. But this function does not return anything (well, it returns
None, which is the Python representation of exactly nothing) - and you'd
loose it if it did anyway.

non-pythonic-explanation
A variable created in a function is local to the function. It disappears
as soon as the function returns - unless you keep a reference to it one
way or another. The usual way to do so is to return the variable to the
caller :
/non-pythonic-explanation


def mutate():
  newnum = random.randrange(27)
if newnum == 0:
  gene=' '
else:
  gene = chr(newnum + 96)
  return gene

gene = mutate()
# target and parent where undefined...
# please post working code
parent = 0123456789
#position = random.randrange(len(target))
position = random.randrange(len(parent))
child=parent[:position-1]+gene+parent[position+1:]

Now you may want to check your algorithm, since it doesn't perform as
described - but this is another problem !-)

hints:
 import string
 string.ascii_lowercase
 help(random.choice)

 astring = abcd
 alist = list(astring)
 alist[0] = 'z'
 astring2 = ''.join(alist)

Also note that a function can take arguments:
 def fun_with_args(arg1, arg2):
   print in func_with_name : arg1 = %s - arg2 = %s % (arg1, arg2)

 fun_with_args('toto', 'titi')

so you can have the whole algorithm in the function body:

def createChild(parent):
  # code here to create child
  return child

parent = 0123456789
child = createChild(parent)
print parent : %s\nchild : %s % (parent, child)

 Thanks again - this group is great. I despair of ever being able to
 contribute though :-(

You did. There would be no answer if there were no questions !-)
BTW, may I suggest you to spend some time on a good Python tutorial ?
(there are many good ones freely available on the net).

HTH
-- 
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: Is this Pythonic?

2005-08-02 Thread Michael Hudson
[EMAIL PROTECTED] (phil hunt) writes:

It would (possibly) be more Pythonic to
define an interface instead,

 Does Python have the concept of an interface? When was that added?

It doesn't have one included, but there are at least two
implementations, zope.interface and PyProtocols (I'm sure google will
find you more on both of these).

-- 
  ... with these conditions cam the realisation that ... nothing
  turned a perfectly normal healthy individual into a great political
  or military leader better than irreversible brain damage.
   -- The Hitch-Hikers Guide to the Galaxy, Episode 11
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newer than a Newbe

2005-08-02 Thread bruno modulix
None wrote:
 Hello,
 I am just starting to look into python.I have been prog with php for 
 several years.My question is:
 Can/Is Python used as a web scripting language 
Yes, definitively.

There are in fact almost too many web-programming solutions in Python,
from the good ole cgi to the full-blown web application server.

, and if so do many hosts 
 support it?

No.

 Thanks

You're welcome !-)

-- 
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: [path-PEP] Path inherits from basestring again

2005-08-02 Thread Michael Hoffman
Ron Adam wrote:

 PS. Could someone repost the links to the current pre-pep and the most 
 recent module version so I can look at it closer look?

Pre-pre-PEP: http://wiki.python.org/moin/PathClass

Reinhold's version of the module is in Python CVS in 
nondist/sandbox/path. Jason Orendorff's version is at 
http://www.jorendorff.com/articles/python/path/.
-- 
Michael Hoffman
-- 
http://mail.python.org/mailman/listinfo/python-list


HTTPSConnection Password

2005-08-02 Thread michaelparkin
Hi,

I'm using httplib to create a mutually authenticated HTTPS connection
with a server.

I create the connection as follows:

c = httplib.HTTPSConnection(uri, key_file = key, cert_file = cert)

However, because I am using a private key I keep getting asked to enter
the password to open that key every time I run the script.

I've had a dig around and can't seem to find a way of specifying the
password so that the user can supply it on the command line, or so I
can script/fully automate these connections. The ideal scenario would
be to be able to specify the password on the command line like in
curl/pyCurl

How can I set the password for the private key so it doesn't keep
asking me for it?

Appologies if I've missed something obvious here.

Thanks,

Michael.

p.s. I need to use httplib (rather than pyCurl) as I need to be able to
specify methods other than GET and POST in my requests to the server.

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


C++, Swig, and pyMPI

2005-08-02 Thread stringy
I would like to be able to write a C++ function, to be wrapped into
some python, to be able to communicate over pyMPI. As pyMPI is based on
C++ I figure that this should be possible, although I'm not sure of
where to start. I know the basics of swig and pyMPI, but not how I
would do this.

Does anyone know if this is possible and where to start?

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


Re: ANN: Kamaelia 0.2.0 released!

2005-08-02 Thread Michael Sparks
Phil Hunt wrote:

 Kamaelia seems it might be an interesting project. However, I don't
 think the project is well served by this announcement -- which I 
 find vague and hard to understand. Which is a shame, because it
 means that other people probably don't understand it very well
 either, which means less people will use it.

It is a shame, and thanks for mentioning this. Let me have another
go :-) (ripping to shreds welcome :)

OK, here's a better go. (It's always difficult to think where to pitch
this sort of thing)
---START---
The project aims to make it simple to build networked multimedia
systems (eg audio, video, interactive systems), which are naturally
componentised and naturally concurrent allowing quick and fast reuse in
the same way as Unix pipelines do. 

It is designed as a practical toolkit, such that you can build systems
such as:
   * Ogg Vorbis streaming server/client systems (via vorbissimple)
   * Simple network aware games (via pygame)
   * Quickly build TCP based network servers and clients
   * Quickly build Multicast based network servers and clients

It runs on Linux, Window, Mac OS X with a subset running on Series 60
phones.

The basic underlying metaphor of a component us like an office worker
with inboxes and outboxes, with deliveries occuring between desks,
offices, and depts. The component can thus do work anyway it likes but
only communicates with these inboxes and outboxes. Like office workers,
components run in parallel, and to achieve this are generally
implemented using python generators, but can also used threads.

The rationale behind the project is to provide a toolkit enabling the
development of new protocols, including streaming, for large scale
media delivery. The license essentially allows use in proprietary
systems without change, but all changes to the system itself must be
shared.
---END---

Is that clearer ? 

A short summary of all that could be:

Kamaelia is a networking/communications infrastructure for innovative
multimedia systems. Kamaelia uses a component architecture designed to
simplify creation and testing of new protocols and large scale media
delivery systems.

Hopefully that's clearer than:

Kamaelia is a collection of Axon components designed for network
protocol experimentation in a single threaded, select based
environment. Axon components are python generators are augmented by
inbox and outbox queues (lists) for communication in a communicating
sequential processes (CSP) like fashion.

[ which you noted I really have very little idea what this means. ]

 The information I can guess out of this is: Kamaelia is a library
 for creating network protocols that sit on top of tcp and/or udp.
 Given that it's a BBC project, I imagine we're talking about
 protocols for transferring large amount of data, e.g. sound or
 motion pictures.

Indeed. However, if you're having to guess I'm not doing the best job
(despite trying!) at explaining this.

More background on the motivations behind Kamaelia
can be found here: http://kamaelia.sourceforge.net/Challenges/
 
 There's something interesting here:
 
   In Building Public Value, the BBC has committed to the delivery of
   BBC content to the British Public over this multitude of systems,
   in a way that is enjoyable, accessible and **repurposable** by the
   British Public in the way they choose.
 
 (my emphasis)
 
 This is a laudable aim, but if the BBC want to do this, the first
 step they could make is to open up their content under a Creative
 Commons licence.

not such a wise thing for me to reply to, but please read the
 disclaimer at the bottom, these are personal opinions only

I would suggest that you forward this comment directly to the team
involved in working on the Creative Archive. You can do this via this
URL:
   * http://creativearchive.bbc.co.uk/

This is unfortunately not as simple as just putting stuff up, and any
comments you have, I'm sure would be welcome. However, the Creative
Archive hasn't yet been put to a Public Value Test (including impact on
industry), and rights is a much more problematic issue than you might
expect. (eg background music on the radio in eastenders, posters on
people's walls...)

There's also http://www.bbc.co.uk/info/contactus/form.shtml which might
be more appropriate.

On a positive note, the Creative Archive has more organisations involved
than just the BBC, it inlucde the BFI , Channel 4, Open University 
Teachers'TV, so even if these things take longer than some people might
like they do seem to be moving. Public organisations are weighed down
whether the should do something, as well as whether they can.

BBC RD's role in this is to make these decisions possible.

 They could start with their news, current affairs 
 and documentaries. 

BBC Backstage is a start here - at least with some of the online
content. (http://backstage.bbc.co.uk)

 But the download only staryed up for a week, and they didn't put the
 files under a CC license, so they could be 

Re: Newer than a Newbe

2005-08-02 Thread gene tani
Truthfully, the number of frameworks is staggering, tho some are
specialized for blogs/wiki, search engine, PIM, etc.

http://www.colorstudy.com/docs/shootout.html
http://pythonology.org/howto
http://aspn.activestate.com/ASPN/Cookbook/Python?kwd=Web
http://www.awaretek.com/tutorials.html#web
http://www.personal.psu.edu/staff/i/u/iua1/python_reviews.html

http://subway.python-hosting.com/
http://snakelets.sourceforge.net/

http://www.cherrypy.org/
http://spyce.sourceforge.net/
http://www.mems-exchange.org/software/quixote/

http://mail.python.org/pipermail/medusa-dev/2003/000843.html

http://www.awaretek.com/tutorials.html#firedrop

http://www.webwareforpython.org/
http://wiki.webwareforpython.org/thiswiki.html

http://moinmoin.wikiwikiweb.de/
http://webservices.xml.com/pub/a/ws/2003/05/13/email.html
http://www.oreillynet.com/pub/au/1099

http://www.divmod.org/Home/Projects/Lupy/

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


SOAPpy and http authentication

2005-08-02 Thread Odd-R.
I use the following piece of code to contact a webservice,
and read a wsdl file.

from SOAPpy import WSDL
from SOAPpy import URLopener
url= ' http://someserver/somewebservice
url1 = URLopener.URLopener(username='user',passwd='pass')
server=WSDL.Proxy(url1.open(url))

This yields no errors, and everyting is fine.

However, when I start calling the actual methods of
this webservice, I get this error

SOAPpy.Errors.HTTPError: HTTPError 401 Unauthorized

How can I avoid this?

Thanks in advance for all help!

-- 
Har du et kjøleskap, har du en TV
så har du alt du trenger for å leve

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


Re: Dabo in 30 seconds?

2005-08-02 Thread Jorge Godoy
Daniel Dittmar wrote:

 Because you put different probabilities on different outcomes. One easy
 'risk markup' would be to assume that parts of the standard Python
 distribution like TkInter have a higher chance of working with the next
 release than external libraries like wxPython. Of course, there are lots

I think it will be true only if there's no package for the considered
toolkit on my Linux distribution, *BSD, Windows or Mac.  I don't see it as
a risk because having the toolkit available on the destination platform is
a pre-requisite and comes before coding.

If I already have the code working on some version, backwards compatibility
handles a little of the problem and besides, I can create one new package
for the lacking environment.  I just need to do this work once.

 of other possible criteria:
 - which has been under more active development in the last releases
 - which source code is easier to understand so that I don't have to rely
 on external help

- Which takes less time
- Which needs less hand written code
- Which provides more functionality
- Which has data aware controls
- ...

There are lots of other things that are considered, independently of the
toolkit.  None gets a 100% OK grade, and some things have a higher weight
to me or to the client.


-- 
Jorge Godoy  [EMAIL PROTECTED]

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


Re: C++, Swig, and pyMPI

2005-08-02 Thread Mandus
2 Aug 2005 03:47:02 -0700 skrev stringy:
 I would like to be able to write a C++ function, to be wrapped into
 some python, to be able to communicate over pyMPI. As pyMPI is based on
 C++ I figure that this should be possible, although I'm not sure of
 where to start. I know the basics of swig and pyMPI, but not how I
 would do this.

 Does anyone know if this is possible and where to start?


Are you sure that pyMPI are C++-based? I think it is based on pure C?

Besides that, it is not clear (at least to me) what you try to achive.
Do you want to use MPI also in your extension module?

mvh,
-- 
Mandus - the only mandus around.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDE's

2005-08-02 Thread Wolfgang Keller
Hello,

 Thanks for your reply - that link is very useful, and i have been browsing 
 through the various multiplatform editors/ide's (i'm looking for something to 
 use on both my Windows machines and my Mac)

You might want to have a look at the archive of the Python-Mac 
mailinglist. Someone who's maintaining the Mac OS X installers for 
several open-source IDEs has posted a quite extensive review of some 
IDEs very recently. To me it looks like Wing IDE may be the best choice 
if you want something perfectly solid and don't mind paying a 
reasonable price.

Sincerely,

Wolfgang Keller


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


Re: Wheel-reinvention with Python

2005-08-02 Thread Cliff Wells
On Tue, 2005-08-02 at 09:45 +0200, Torsten Bronger wrote:

 Yes, this is what I meant with legacy code.  C and C++ are
 actually special-purpose.  They are good for controlling a computer
 but not for implementing an idea.  Their current vitality on almost
 all software areas arise from the fact that they had been extremely
 successful before Java, C#, and VB came into play.  

Unfortunately your assertion is patently false.  C and C++ are very much
general-purpose languages.  It is a logical contradiction to assert that
Java, C#, VB and Python are general-purpose languages while C and C++
are not when the former were implemented using the latter.  
Being implemented in C, Python can do nothing that C cannot.  It can
certainly make it *easier* to do things, but it conveys no new abilities
other than that of meeting deadlines ;)

As an aside, I don't disagree with what I think is your main point:
higher-level abstractions make more advanced ideas feasible.  You simply
state it far too strongly.

Regards,
Cliff

-- 
[EMAIL PROTECTED]
http://www.develix.com :: Web applications and hosting :: Linux, PostgreSQL and 
Python specialists ::


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


Re: SOAPpy and http authentication

2005-08-02 Thread Lutz Horn
On 2005-08-02, Odd-R. [EMAIL PROTECTED] wrote:
 from SOAPpy import WSDL
 from SOAPpy import URLopener
 url= ' http://someserver/somewebservice
 url1 = URLopener.URLopener(username='user',passwd='pass')
 server=WSDL.Proxy(url1.open(url))

Is it possible to call WSDL.Proxy with a String? Then you could build
the URL als http://user:[EMAIL PROTECTED]/somewebservice. This works
with SOAPpy.SOAPProxy.

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


Re: Wheel-reinvention with Python

2005-08-02 Thread Torsten Bronger
Hallöchen!

Cliff Wells [EMAIL PROTECTED] writes:

 On Tue, 2005-08-02 at 09:45 +0200, Torsten Bronger wrote:

 Yes, this is what I meant with legacy code.  C and C++ are
 actually special-purpose.  They are good for controlling a
 computer but not for implementing an idea.  Their current
 vitality on almost all software areas arise from the fact that
 they had been extremely successful before Java, C#, and VB came
 into play.

 Unfortunately your assertion is patently false.  C and C++ are
 very much general-purpose languages.

This is true in the sense that you can realise an arbitrary program
with them, and you can use the full power of the computer.  But in
my opinion the era of such programming is over.  Already today but
even more in the future programs of all kind are coded in the
higher-level languages (including VC++), limiting C(++) to the field
of system programming.  Probably quibbling, but this is how I meant
it.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
-- 
http://mail.python.org/mailman/listinfo/python-list

RE: ANN: Kamaelia 0.2.0 released!

2005-08-02 Thread Tim Golden
[Michael Sparks]
| Phil Hunt wrote:
| 
|  Kamaelia seems it might be an interesting project. However, I don't
|  think the project is well served by this announcement -- which I 
|  find vague and hard to understand. Which is a shame, because it
|  means that other people probably don't understand it very well
|  either, which means less people will use it.
| 
| It is a shame, and thanks for mentioning this. Let me have another
| go :-) (ripping to shreds welcome :)
| 
| OK, here's a better go. (It's always difficult to think where to pitch
| this sort of thing)

[... snip ...]

I just wanted to say that I find the ideas behind Kamaelia
interesting, and I only wish I had an application for it!
Because I'm not especially into media-streaming, I'm more
interested in it from the point of view of the generator-based
architecture.

What prompted me to write now was in appreciation of Michael's
taking the effort to recast his words into a form which might
well be understood better by others (including me) when he
might well have simply huffed a bit and told the other poster 
to read the words on the site and stop complaining about the HTML!

Thanks, Michael. Hope the project continues apace and if I
can ever find a need for it, I'll know where to look.

Tim Golden


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: SOAPpy and http authentication

2005-08-02 Thread Oliver Andrich
2 Aug 2005 11:38:51 GMT, Lutz Horn [EMAIL PROTECTED]:
 On 2005-08-02, Odd-R. [EMAIL PROTECTED] wrote:
  from SOAPpy import WSDL
  from SOAPpy import URLopener
  url= ' http://someserver/somewebservice
  url1 = URLopener.URLopener(username='user',passwd='pass')
  server=WSDL.Proxy(url1.open(url))
 
 Is it possible to call WSDL.Proxy with a String? Then you could build
 the URL als http://user:[EMAIL PROTECTED]/somewebservice. This works
 with SOAPpy.SOAPProxy.

Yes, you can actually call it that way, but then the wsdl retrieval is
done using the authentication, but all the service calls are done
without. This is something, that is also puzzling me. So far I can
perfectly live with SOAPProxy, but it would be nice to solve this
puzzle.

Best regards,
Oliver

-- 
Oliver Andrich [EMAIL PROTECTED] --- http://fitheach.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Newer than a Newbe

2005-08-02 Thread Peter Hansen
gene tani wrote:
 Truthfully, the number of frameworks is staggering, tho some are
 specialized for blogs/wiki, search engine, PIM, etc.
[snip massive yet even so incomplete list]

It's called biodiversity and, while generally this is a good thing, I 
think it's high time for some of these Python web frameworks to start 
mating and having nice little baby web frameworks which keep all the 
good genes and dispense with the bad. :-)

Actually, I strongly suspect this is already happening, as there are 
clear signs the latest generation of frameworks is quite a bit more 
sophisticated than the earlier ones.

So... does anyone have a nice framework with TLS and sessions support, 
which they'd like to rent out for stud? ;-)

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


ANN: matplotlib 0.83.2

2005-08-02 Thread John Hunter

matplotlib is a 2D plotting package for python.  This is a summary of
recent developments in matplotlib since 0.80.  For detailed notes, see
http://matplotlib.sf.net/whats_new.html,
http://matplotlib.sf.net/CHANGELOG and
http://matplotlib.sf.net/API_CHANGES

== Whats New ==

matplotlib wiki: this was just launched a few days ago and only has
  two entries to date, but we hope this will grow into a useful site
  with tutorials, howtos, installation notes, recipes, etc.  Please
  contribute!  Thanks to scipy.org and Enthought for hosting.
  http://www.scipy.org/wikis/topical_software/MatplotlibCookbook

CocoaAgg: New CocoaAgg backend for native GUI on OSX, 10.3 and 10.4
  compliant, contributed by Charles Moad.

TeX support : Now you can (optionally) use TeX to handle all of the
  text elements in your figure with the rc param text.usetex in the
  antigrain and postscript backends; see
  http://www.scipy.org/wikis/topical_software/UsingTex.  Thanks to
  Darren Dale for hard work on the TeX support.

Reorganized config files: Made HOME/.matplotlib the new config dir
  where the matplotlibrc file, the ttf.cache, and the tex.cache live.
  Your .matplotlibrc file, if you have one, should be renamed to
  .matplotlib/matplotlibrc.

Masked arrays: Support for masked arrays in line plots, pcolor and
  contours.  Thanks Eric Firing and Jeffrey Whitaker.

New image resize options interpolation options.  See help(imshow) for
  details, particularly the interpolation, filternorm and filterrad
  kwargs.  New values for the interp kwarg are:

'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom',
'gaussian', 'bessel', 'mitchell', 'sinc', 'lanczos', 'blackman'

Byte images: Much faster imaeg loading for MxNx4 or MxNx3 UInt8
  images, which bypasses the memory and CPU intensive integer/floating
  point conversions.  Thanks Nicolas Girard.

Fast markers on win32: The marker cache optimization is finally
  available for win32, after an agg bug was found and fixed (thanks
  Maxim!).  Line marker plots should be considerably faster now on
  win32.

Qt in ipython/pylab: You can now use qt in ipython pylab mode.  Thanks
  Fernando Perez and the Orsay team!

Agg wrapper proper: Started work on a proper agg wrapper to expose
  more general agg functionality in mpl.  See examples/agg_test.py.
  Lots of wrapping remains to be done.

Subplot configuration: There is a new toolbar button on
  GTK*, WX* and TkAgg to launch the subplot configuration tool.

GUI neutral widgets: Matplotlib now has cross-GUI widgets (buttons,
  check buttons, radio buttons and sliders).  See
  examples/widgets/*.py and
  http://matplotlib.sf.net/screenshots.html#slider_demo.  This makes
  it easier to create interactive figures that run across backends.

Full screen mode in GTK*: Use 'f' to toggle full screen mode in the
  GTK backends.  Thanks Steve Chaplin.

Downloads available from http://matplotlib.sf.net
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo in 30 seconds?

2005-08-02 Thread Sion Arrowsmith
James Stroud  [EMAIL PROTECTED] wrote:
Perhaps some of us are writing software with non-developer end-users in mind
and we kind of keep that mentality when evaluating modules our code uses.

In the commercial environment I'm working in, non-developer end-users
get a frozen executable. They don't know that there are eight packages
not included in the standard library (including wxPython) in there,
unless they go looking in the licences directory. They don't even have
to install Python. Using a swarm of potentially awkward third-party
modules and keeping things simple for the user are not incompatible.

Of course, going back to Dabo there is the question of whether it has
such a thing as a non-developer end-user.

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

Re: Dabo in 30 seconds?

2005-08-02 Thread Ed Leafe
On Tuesday 02 August 2005 09:15, Sion Arrowsmith wrote:

 Of course, going back to Dabo there is the question of whether it has
 such a thing as a non-developer end-user.

 Yes and no. Developers will be the primary users of Dabo, of course, but they 
will most likely use it to create apps that non-developers will then use, so 
packaging/distribution certainly comes into play at some point.

-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


JBUS and Python which way

2005-08-02 Thread mjekl
Hi,

I'm a newbie without a technical background making some technology
research for a company I work for.

My aim is to have an idea of the alternatives technologies for
accessing
information produced by a machine with a JBUS interface (RS232) and how
to
access this information realtime in Python (connecting a PC locally via
serial
port).

I'm aware of pyserial but I wonder if there is a library/module that
takes care of accessing/interpreting JBUS protocol. I've searched for
this without results.

I also searched the net looking for some information so that I could
have a
birds-eye-view on this subject and got the impression that a
possibility is to
have the communication (JBUS protocol / buffering) managed by some
hardware
component. Is this so? Can some-one give me some pointers/resources on
this
subject. Would it still be possible to work with Python.


Hope this makes any sense.
All help appretiatted.
Txs,
Miguel

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


RE: Terminate a thread that doesn't check for events

2005-08-02 Thread Liu Shuai








Can someone please comment on this?













From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Liu Shuai
Sent: Monday, August 01, 2005 4:29
PM
To: python-list@python.org
Subject: Terminate a thread that
doesn't check for events





Hi all,



I am aware that similar and probably same questions have
been posted many times, but I was unable to find a solution after reading a
dozen threads in the archive. So here it goes again.



I have a thread that does some heavy task (hash calculation,
for instance). I need a mechanism that works *across
platforms* to stop that calculation if user decides to exit. How can
I do that? 

I can not do the standard periodical checking
way since there is only one function/step call in my thread.



Here is a snippet of my thread classes to help illustrate
the problem:



class Dispatcher():

 def
__init__(self): 


self.__worker = Worker() 

 

 def start(self):


self.__worker.start() 

 

 def stop():


#how do i stop the worker?



class Worker(threading.Thread):

 def __init__(self):

 

 def run(self):


oneTimeConsumingCall()





Thank you in advance for any suggestions/pointers.



LS








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

finding sublist

2005-08-02 Thread giampiero mu
hi everyone

my target is implement a function controlla(string - a binary string-)
that check if there is in a string two equal not overlapping
subsequences at least of length limitem:

my code:

def controlla(test):
#   print test
limitem=4
lunghezz=len(test)

l1=lunghezz-limitem+1
l2=lunghezz-limitem+1
f=0

for ii in range(l1):
for kk in range(l2):
t1=test[ii:ii+limitem]
t2=test[kk:kk+limitem]
if abs(ii-kk)=limitem :
if t1==t2 :
f=1
if f==1 :
break
break
break
if f==0 :
return test
else:
return 'no'


the question is: Is there a faster way doing that? I don't know,
changing string into list or array, using map, or module, using
different loop, regular expression,funcional programming , list
comprehensions , sets, different looping techniques, i dont
know...(!)

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


Re: finding sublist

2005-08-02 Thread Kent Johnson
giampiero mu wrote:
 hi everyone
 
 my target is implement a function controlla(string - a binary string-)
 that check if there is in a string two equal not overlapping
 subsequences at least of length limitem:

You can do this with a regular expression:

  import re
  r=re.compile(r'(?Pseq.{4,}).*(?P=seq)')
  r.match('abcaoeaeoudabc')
  r.match('abcdaeaeuabcd')
_sre.SRE_Match object at 0x008D67E0
  _.group(1)
'abcd'
  r.match('abcdefgaeaeuabcdefg')
_sre.SRE_Match object at 0x008D68E0
  _.group(1)
'abcdefg'

Kent


 
 my code:
 
 def controlla(test):
 #   print test
 limitem=4
   lunghezz=len(test)
 
 l1=lunghezz-limitem+1
 l2=lunghezz-limitem+1
 f=0
 
 for ii in range(l1):
 for kk in range(l2):
 t1=test[ii:ii+limitem]
 t2=test[kk:kk+limitem]
 if abs(ii-kk)=limitem :
 if t1==t2 :
 f=1
 if f==1 :
 break
 break
   break
 if f==0 :
 return test
 else:
   return 'no'
 
 
 the question is: Is there a faster way doing that? I don't know,
 changing string into list or array, using map, or module, using
 different loop, regular expression,funcional programming , list
 comprehensions , sets, different looping techniques, i dont
 know...(!)
 
-- 
http://mail.python.org/mailman/listinfo/python-list


Class design for parser object

2005-08-02 Thread James Saker

I've been working on a Python class object for APRS (Automatic Position 
Reporting System - a digital mode used by amateur radio operators) and have 
been going through David Mertz's Text Processing in Python book to help in 
the construction of the parser component of the class.

I was curious if there was a good reference on the most pythonic design of 
parsing objects.  For instance, should one parse raw or formatted data upon 
initialization and return a boolean indicating success/failure, or require 
multiple steps to instantiate then parse and test? Are there generally found 
public methods in parsing objects that would serve as a good model? 

Thanks - 

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


Re: Tkinter, Menu(bar) font size

2005-08-02 Thread Bob Greschke
Yeah.  It works on a Sun and Linux, but not Windows.  That stinks.  We got a 
bunch of 1400x1050 display laptops in and now I have to run around changing 
a bunch of programs that looked fine on 1024x768 displays.

Thanks!

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Tk tries to use the native menu control on Windows (and, I think, MacOS).
One result seems to be that for the application's menu bar you can't change 
the
font.

Of course, Windows provides a way for users to select a uniform font for
menu bars in all applications, in the Display control panel.

Jeff


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


Re: 2-player game, client and server at localhost

2005-08-02 Thread Christopher Subich
Michael Rybak wrote:
  That's the problem - or a player input comes in. As I've explained,
 this happens a dozen of times per second :(. I've even tried not
 checking for player's input after every frame, but do it 3 times more
 rare (if framecount % 3 == 0 : process_players_input()). Well, I've
 already got it that I shouldn't tie this around framerate, but
 nevertheless...

There's the key.  How are you processing network input, specifically 
retrieving it from the socket?
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Terminate a thread that doesn't check for events

2005-08-02 Thread Jp Calderone
On Tue, 2 Aug 2005 09:51:31 -0400, Liu Shuai [EMAIL PROTECTED] wrote:
Can someone please comment on this?

 [snip - how to stop a thread without its cooperation?]

There's no way to do this with threads, sorry.

Perhaps you could use a child process, instead.  Those are typically easy to 
terminate at arbitrary times.

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


Re: Python IDE's

2005-08-02 Thread projecktzero
The thing that nudged me into trying VIM was the book, The Pragmatic
Programmer. It mentioned Emacs and VIM and the value of learning a
powerful editor and sticking with it. I had tried Emacs three times
long ago, and it didn't click with me. I decided to try VIM, and it
made a lot more sense to me. Yep, there's a steep learning curve. I
learned a lot of the basic command in a day or so, then gradually
learned more and more. I'm always finding something new about it.
There's tons of scripts, plug-ins, and tips at the vim.org site.

A couple of important things to me are:

Cross platform: I work with Windows, Linux, VMS, and Mac

Works with mulitple languages: I write Python, Perl, XHTML/HTML, CSS,
Javascript, SQL, COBOL, DCL, and occasionally VBScript.

I will point out that both Emacs and VIM do their best to keep your
hands on the keyboard which supposedly keeps you more productive since
you don't have to waste time grabbing the mouse to perform many tasks.
That philosophy is alien to many people and does take some getting used
to. I think both of these editors have their roots in the pre-mouse
days.

http://brianray.chipy.org//Python/pythonandvim.html has a blog about
VIM with Python built in. You can script VIM with Python.

http://www.vim.org/scripts/script.php?script_id=910 is a script that
allows you to use PyDoc from within VIM, so you can look up
documentation on modules while coding.

http://www.vim.org/scripts/script.php?script_id=850 pydiction is a
special dictionary file of Python modules for use with vim's completion
feature.

http://www.vim.org/scripts/script.php?script_id=127 is a plug in for
running Python scripts from within VIM.

http://www.vim.org/scripts/script.php?script_id=1096 allows you to run
PyChecker from within VIM.

Code folding, auto indentation, syntax highlighting are standard
features in VIM.

Anyway, it's worth checking out VIM. If it doesn't click with you, look
at Emacs. I'd imagine that it has as many plug-ins/scripts for Python
as VIM.

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


time.clock() or time.time()

2005-08-02 Thread [EMAIL PROTECTED]
What's the difference between time.clock() and time.time()
(and please don't say clock() is the CPU clock and time() is the actual
time because that doesn't help me at all :)

I'm trying to benchmark some function calls for Zope project and when I
use t0=time.clock(); foo(); print time.clock()-t0
I get much smaller values than when I use time.clock() (most of them
0.0 but some 0.01)
When I use time.time() I get values like 0.0133562088013,
0.00669002532959 etc.
To me it looks like time.time() gives a better measure (at least from a
statistical practical point of view).

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


RE: Terminate a thread that doesn't check for events

2005-08-02 Thread Liu Shuai
Thanks for the reply Chris. 

Are you suggesting running the task in a *separate* process instead of a
separate *thread*? Because if that's the case, I will have to share data
(and possible memory) between that new process and my master process
since they depend on one other.

Yeah I will sure post it if I can find an elegant solution.

Thank you,
LS

 -Original Message-
 From: Chris Lambacher [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, August 02, 2005 11:50 AM
 To: Liu Shuai
 Subject: Re: Terminate a thread that doesn't check for events
 
 Hi,
 
 There is no cross platform way to do this.  You need to periodically
check
 a
 quit flag, or perform a platform specific action to terminate it.  On
 Linux
 you can send the process a signal.  On windows you will need to use
the
 win32all package.  If you decide to go the later route, maybe you
could
 encapsulate the thread termination code in a module and share it with
the
 Python community.
 
 -Chris
 
 On Tue, Aug 02, 2005 at 09:51:31AM -0400, Liu Shuai wrote:
 Can someone please comment on this?
 
 
 
 
-
 -
 
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf
Of
 Liu
 Shuai
 Sent: Monday, August 01, 2005 4:29 PM
 To: python-list@python.org
 Subject: Terminate a thread that doesn't check for events
 
 
 
 Hi all,
 
 
 
 I am aware that similar and probably same questions have been
posted
 many
 times, but I was unable to find a solution after reading a dozen
 threads
 in the archive. So here it goes again.
 
 
 
 I have a thread that does some heavy task (hash calculation, for
 instance). I need a mechanism that works *across platforms* to
stop
 that
 calculation if user decides to exit. How can I do that?
 
 I can not do the standard periodical checking way since there
is
 only
 one function/step call in my thread.
 
 
 
 Here is a snippet of my thread classes to help illustrate the
 problem:
 
 
 
 class Dispatcher():
 
 def __init__(self):
 
 self.__worker = Worker()
 
 
 
 def start(self):
 
 self.__worker.start()
 
 
 
 def stop():
 
 #how do i stop the worker?
 
 
 
 class Worker(threading.Thread):
 
 def __init__(self):
 
 
 
 def run(self):
 
 oneTimeConsumingCall()
 
 
 
 
 
 Thank you in advance for any suggestions/pointers.
 
 
 
 LS
 
  --
  http://mail.python.org/mailman/listinfo/python-list


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


a pickle's pickle

2005-08-02 Thread [EMAIL PROTECTED]
I'm trying to pickle a class, and while I get no errors or anything,
almost none of the class instance gets pickled, and I don't know
why...Here's the pickled output:

(i__main__
TrainingMatrix
p0
(dp1
S'matrixWords'
p2
I4714
sS'numWords'
p3
I4714
sS'totalWordsProcessed'
p4
I46735
sS'numContexts'
p5
I7664
sS'estimator'
p6
(dp7
sb.

--End of output

The class TrainingMatrix has no embedded classes and none of its
methods have embedded methods. An instance of this class running in my
program for about 10 minutes can build up on the order of 100MB in
resident memory, but the output seems to be the same regardless of the
data set size. The output seems to not even capture all of the member
variables in the class. Here is the class code, abridged:

class TrainingMatrix:
matrix = []
estimator = {}
wordInfo = {}
contextInfo = {}
totalWordsProcessed = 0
numWords = 0
numContexts = 0
matrixWords = 0

def AddWordInfo(self,newWordInfo,newCapScheme):
...
#End AddWordInfo

def AddNewWord(self,newCapScheme):
...
#End AddNewCapScheme

def AddContext(self,newContext):
   ...
#End AddContext

def AddInstance(self,word,context):
...
#End AddInstance

def UpdateMatrix(self,wordIndex,contextIndex,isLowerCase):
   ...
#End UpdateMatrix

def PrintMatrix(self):
...
#End PrintMatrix

def EstimateLowerCase(self):
...
#End GetNumWords

def GetWordInfo(self,wordToFind):
...
#End GetWordInfo

def GetContext(self,wordList,direction):
...
#End GetContext

def GetBestCapScheme(self,wordInfo,precedeContext,followContext):
...
#End GetBestCapScheme

def IsLowerCase(self,word):
...
#End IsLowerCase

#End TrainingMatrix
###

And here is the pickling code:

try:
trainDB = open(trainDBString,r+)
except IOError:
trainDB = open(trainDBString,w)
trainDB.close()
trainDB = open(trainDBString,r+)
#End try
...
try:
trainerString = trainDB.read()
trainer = loads(trainerString)

except EOFError:
trainer = TrainingMatrix()
#End try
...
trainerString = dumps(trainer)
trainDB.write(trainerString)

I've also tried a simple shelve implementation but got results similar
to this, which is why I recoded to pickle, since it's lower level. Any
help is appreciated :-)

-Andrew

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


Re: Terminate a thread that doesn't check for events

2005-08-02 Thread Chris Lambacher
No.  On Linux a separate thread is a separate process with shared memory.  You
can send a signal to a particular process and catch that signal as an
indication that you need to terminate (perhapse something that is set up
before running your long running process so that it is generic).  In windows
threads are separate beasts from processes(almost) and there are functions for
terminating them (though I don't think gracefully).  Unfortunately I can't
comment on other platforms.

-Chris
  
On Tue, Aug 02, 2005 at 11:54:57AM -0400, Liu Shuai wrote:
 Thanks for the reply Chris. 
 
 Are you suggesting running the task in a *separate* process instead of a
 separate *thread*? Because if that's the case, I will have to share data
 (and possible memory) between that new process and my master process
 since they depend on one other.
 
 Yeah I will sure post it if I can find an elegant solution.
 
 Thank you,
 LS
 
  -Original Message-
  From: Chris Lambacher [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, August 02, 2005 11:50 AM
  To: Liu Shuai
  Subject: Re: Terminate a thread that doesn't check for events
  
  Hi,
  
  There is no cross platform way to do this.  You need to periodically
 check
  a
  quit flag, or perform a platform specific action to terminate it.  On
  Linux
  you can send the process a signal.  On windows you will need to use
 the
  win32all package.  If you decide to go the later route, maybe you
 could
  encapsulate the thread termination code in a module and share it with
 the
  Python community.
  
  -Chris
  
  On Tue, Aug 02, 2005 at 09:51:31AM -0400, Liu Shuai wrote:
  Can someone please comment on this?
  
  
  
  
 -
  -
  
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf
 Of
  Liu
  Shuai
  Sent: Monday, August 01, 2005 4:29 PM
  To: python-list@python.org
  Subject: Terminate a thread that doesn't check for events
  
  
  
  Hi all,
  
  
  
  I am aware that similar and probably same questions have been
 posted
  many
  times, but I was unable to find a solution after reading a dozen
  threads
  in the archive. So here it goes again.
  
  
  
  I have a thread that does some heavy task (hash calculation, for
  instance). I need a mechanism that works *across platforms* to
 stop
  that
  calculation if user decides to exit. How can I do that?
  
  I can not do the standard periodical checking way since there
 is
  only
  one function/step call in my thread.
  
  
  
  Here is a snippet of my thread classes to help illustrate the
  problem:
  
  
  
  class Dispatcher():
  
  def __init__(self):
  
  self.__worker = Worker()
  
  
  
  def start(self):
  
  self.__worker.start()
  
  
  
  def stop():
  
  #how do i stop the worker?
  
  
  
  class Worker(threading.Thread):
  
  def __init__(self):
  
  
  
  def run(self):
  
  oneTimeConsumingCall()
  
  
  
  
  
  Thank you in advance for any suggestions/pointers.
  
  
  
  LS
  
   --
   http://mail.python.org/mailman/listinfo/python-list
 
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why Tcl/Tk?

2005-08-02 Thread William Park
Thomas Bartkus [EMAIL PROTECTED] wrote:
 
 William Park [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Jerry He [EMAIL PROTECTED] wrote:
   I'm a little curious, why does most scripting
   languges(i.e. python and ruby) use Tcl/Tk rather than
   wx or Fox as its standard GUI? Although I did notice
   that the Vpython IDE that uses Tkinker starts up a lot
   faster than the DrPython IDE that uses wxpython. But
   that makes no sense, Tk is based on Tcl, a scripting
   language, but wx is written in C++.
 
  Old habits die hard.  Soon, these folks will die off, and we'll be left
  with GTK+ or wxWidgets.
 
 
 Ahhh! That devilish little or
 
 If we only knew which one :-)
 Thomas Bartkus

If you're C, then GTK+.  If you're C++, then wxWidgets.  Since I do C
mostly, I looked into GTK+ (actually, stared at the doc for 2 weeks and
absorbed what I can through osmosis) and decided to include GTK+
interface into Bash shell.  Here is the result:
http://home.eol.ca/~parkw/index.html#gtk

-- 
William Park [EMAIL PROTECTED], Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
   http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
  http://freshmeat.net/projects/bashdiff/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re[2]: 2-player game, client and server at localhost

2005-08-02 Thread Michael Rybak
CS Michael Rybak wrote:
  That's the problem - or a player input comes in. As I've explained,
 this happens a dozen of times per second :(. I've even tried not
 checking for player's input after every frame, but do it 3 times more
 rare (if framecount % 3 == 0 : process_players_input()). Well, I've
 already got it that I shouldn't tie this around framerate, but
 nevertheless...

CS There's the key.  How are you processing network input, specifically 
CS retrieving it from the socket?

A sock class has a socket with 0.1 timeout, and every time I
want anything, I call it's read_command() method until it returns
anything. read_command() and send_command() transfer user's actions in
special format so that it takes 10 bytes per transfer.


I believe this should be rewritten to be done in a separate thread, and
that *current* user input should be processed as *next* one:
 while 1:
 render()
 inp = get_player_input()
 thread.start_new(send_inp, (inp,))
 thread.start_new(accept_opponents_inp, ())
 while still_no_opponents_input_from_previous_iteration()
   time.sleep(0.05)
 process_previous_player_input()
 physics.make_step
 
I will try writing it that way, but I doubt it shall make things much
better... You see, I've tried the normal 1-server-2-clients approach
with Pyro (and today with simulating RMI proxy via UDP), and resulted
with nothing comforting. Please read the using Pyro for network
games topic here for details.

-- 
Best Regards,
 Michael Rybak   mailto:[EMAIL PROTECTED]

Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!




P.S. here's the sock class. My server_sock and client_sock are derived
from it, with additional accept_connection and establish_connection
methods respectively.

#sock.py
import socket
import com_network
import constants as c_


class sock:
def __init__(self, host):
self.host = host
self.port = c_._PORT

self.sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sockobj.settimeout(0.1)

self.curcon = None #connection will be created and saved here
self.connected = False

def read_command(self):
format:
command_id - 1 byte
command_size - CMD_LEN_BIT_SIZE bytes
command_text - command_size bytes

returns a triple (int id, int size, str text)

if not self.connected:
return (None, None)
cmd = com_network.read_fixed(self.curcon, 1)
if len(cmd)  1: #no cmd
return (None, None)
sz = com_network.read_fixed(self.curcon, CMD_LEN_BIT_SIZE)
cmd, sz = str_to_cmd(cmd + sz)
text = com_network.read_fixed(self.curcon, sz)
return (cmd, text)

def send_command(self, cmd, obj):
send_text(self.curcon, com_network.cmd_to_str(cmd, str(obj)))

 
def close(self):
if self.connected:
self.connected = False
self.curcon.close
self.curcon = None
self.sockobj.close()

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


Re: time.clock() or time.time()

2005-08-02 Thread Leonhard Vogt
[EMAIL PROTECTED] schrieb:
 What's the difference between time.clock() and time.time()
 (and please don't say clock() is the CPU clock and time() is the actual
 time because that doesn't help me at all :)

clock (depending on the platform ?) measures the time spent by your program.

Time gives you the system time, so the difference is the time between
your calls, your program could have been idle (waiting for input or
sharing processor due to multitasking)

 I'm trying to benchmark some function calls for Zope project and when I
 use t0=time.clock(); foo(); print time.clock()-t0
 I get much smaller values than when I use time.clock() (most of them
 0.0 but some 0.01)

Run your code 100 times and divide the result by 100.

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


Art of Unit Testing

2005-08-02 Thread Christoph Zwerschke
In August 2001, there was a thread about the Art of Unit Testing:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/aa2bd17e7f995d05/71a29faf0a0485d5

Paul Moore asked the legitimate question why there is no hook for a 
global fixture code that is run only once for the whole TestCase, as 
opposed to the normal setUp and tearDown code that is run for every 
single test in the TestCase. A global fixture would be preferable 
whenever creating the fixture is time consuming, e.g. you have to create 
a database connection or even a whole database.

What would be the preferred solution for such global fixtures? Simply 
create the database, run the TestCase, and drop the database?

Would it make sense to add globaleSetup and globalTearDown methods 
to the TestCase class? I think at least it would not harm anybody. Where 
should such proposals be submitted?

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


Re: Art of Unit Testing

2005-08-02 Thread Grig Gheorghiu
The py.test module offers setup/teardown hooks at the method, class and
module level. The scenario you're describing would be covered at the
module level. See the py.test documentation for more details:
http://codespeak.net/py/current/doc/test.html#managing-test-state-across-test-modules-classes-and-methods

Grig


http://agiletesting.blogspot.com

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


Re: a pickle's pickle

2005-08-02 Thread Magnus Lycka
[EMAIL PROTECTED] wrote:

 class TrainingMatrix:
 matrix = []
 estimator = {}
 wordInfo = {}
 contextInfo = {}
 totalWordsProcessed = 0
 numWords = 0
 numContexts = 0
 matrixWords = 0

Is there some confusion between the scope of the class
object and the scopes of the instance objects perhaps?

Are you aware of this distinction? See below:

  class X:
... m=0
...
  X.m
0
  x=X()
  x.m
0
  x.m += 5
  x.m
5
  X.m
0

Are you pickling the class object or an instance?

If you are pickling the class: Why? Is the data
really in the class object?

If you are pickling an instance:
Is the data in the class object?
Is the data in another instance object?

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


Re: time.clock() or time.time()

2005-08-02 Thread Magnus Lycka
Shane Hathaway wrote:
 time.time() measures real time, while time.clock() measures the time the 
 CPU dedicates to your program. 

I suppose that varies with the platform... help(time.clock) says:

Help on built-in function clock:

clock(...)
 clock() - floating point number

 Return the CPU time or real time since the start of the process or 
since
 the first call to clock().  This has as much precision as the 
system records.

Another thing to notice is that depending on OS, either time.time() or
time.clock() might have much higher precision than the other.

For Linux on Intel at least, you'll probably want to always use
time.time(). On Windows, you're likely to prefer time.clock(), to
measure relative times, since time.time() will have too low resolution
for measuring short thingies. Be aware that time.clock() will restart
at 0 now and then though. I.e. t1=time.clock();f();t2=time.clock() will
have t1t2 now and then. Using time.time(), that won't happen until
after I retire... :)

For Linux, see man 2 time and man 3 clock.

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


pre subprocess module help

2005-08-02 Thread chuck
I need to execute a command shell process obtain the return code and
capture stdout from that shell process.  I've done this with 2.4 using
subprocess.  How do I do it with 2.3?

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


pre subprocess module help

2005-08-02 Thread chuck
I need to execute a command shell process obtain the return code and
capture stdout from that shell process.  I've done this with 2.4 using
subprocess.  How do I do it with 2.3?

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


pre subprocess help needed

2005-08-02 Thread chuck
I need to execute a command shell process obtain the return code and
capture stdout from that shell process.  I've done this with 2.4 using
subprocess.  How do I do it with 2.3?

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


Pythoncom scripting Windows Media Player visible

2005-08-02 Thread Bill Eldridge

I'm trying to make Windows Media Player visible
and control it from Python. It seems when I call it
below, I get only the console version, and there's
no Visible method like with Internet Explorer.
I do catch events, but I need it visible.
Should it be put into a panel instead?
Should a different type dispatch be called
or a different method? it seems that there are
a console and a windows classes in the COM browser,
but I can't seem to access any useful windows classes.
I get fullScreen as False, but can't set it.
openPlayer(address) will launch a visible window,
but with no control of the the window after that.

Ideas?

from win32com.client import Dispatch,DispatchWithEvents

class WMPEvents:
def OnVisible(self,evt):
print OnVisible changed:,evt
def OnError(self,evt=None):
print OnError,evt
def OnMediaError(self,evt=None):
print OnMediaError,evt
def OnDisconnect(self,evt):
print OnDisconnect,evt
def OnStatusChange(self):
print OnStatusChange
def OnDisconnect(self,evt):
print Disconnect,evt
def OnBuffering(self,evt):
print OnBuffering changed:,evt
def OnOpenStateChange(self,evt=None):
print OnOpenStateChange ,evt
   
mp = DispatchWithEvents(WMPlayer.OCX.7,WMPEvents)
mp.Visible = True   # Does nothing
tune = mp.newMedia(C:/WINDOWS/system32/oobe/images/title.wma)
mp.currentPlaylist.appendItem(tune)
mp.controls.playItem(tune)
mp.controls.play()
raw_input(Press enter to stop playing)
mp.controls.stop()

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


Re: Printing Docstrings Without Importing

2005-08-02 Thread Bengt Richter
On 1 Aug 2005 06:50:23 -0700, Fuzzyman [EMAIL PROTECTED] wrote:

This seems to scratch several people's itches.

Care to develop/maintain it ?

Are you talking to me? ;-)

(My news server is having some problem. I saw my post on google groups
but my normal news client isn't seeing it.)

Assuming you are talking to me, there's a bug, naturally, in trying to
escape None as a doc string. It was twenty minutes of hacking and a half hour
of trying to choose html colors, so there's not that much there ;-)
But what did you have in mind? Javascript menu rollovers for popup docs of
functions and classes and methods etc? Full help info access? Optional pdf 
output?

That would take more than another hour, but I did fix the mentioned bug and put
a table of clickable module names at the top with the file date stamps and paths
so you can navigate down to the spcific module docstring output quickly if you 
have
a lot of them. Of course, I think I'd put styling in the header rather than hack
more raw html if I were to go another round.

I'll post the latest once I can see my postings in context with my own 
newsreader again.

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


Re: a pickle's pickle

2005-08-02 Thread [EMAIL PROTECTED]
I intended to pickle the class instance I call trainer...from my code,
also in the first post:

trainerString = trainDB.read()
trainer = loads(trainerString)


except EOFError:
trainer = TrainingMatrix()
...
trainerString = dumps(trainer)
...

So basically trainer always gets an existing TrainingMatrix(the class)
pickled object if there is a file to read from, otherwise it just makes
a new instance.  Either way, the instance trainer is pickled at the
end.  Maybe I'm missing something...

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


Re: py2exe windows apps path question

2005-08-02 Thread vincent wehren

Grant Edwards [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
|I have several python apps (some wxPython, some plain text-mode
| stuff) that I distribute internally for installation on Win32
| machines.  They're bundled/installed using py2exe and inno
| setup.
|
| I followed what I think is the normal procedure of installing
| each app in its own directory under /Program
| Files/vendor/app.
|
| The problem is that the apps only run if they're started with
| the install directory as the current working directory.
| Otherwise they can't find the .dll's they use from the install
| directory.

AFAIK, Windows normally *does* search the directory where the executable 
module for the current process lives in for dlls. What sort of dlls are 
given you trouble?

--

Vincent Wehren




|
| Is there some way to temporarily add the app's install
| directory to the search path for .dll's?
|
| -- 
| Grant Edwards   grante Yow!  .. I think I'd
|  at   better go back to my 
DESK
|   visi.comand toy with a few 
common
|   MISAPPREHENSIONS... 


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


bug in python/numarray

2005-08-02 Thread meng
Hi, there,

I got different results by running the same lines of code on windows and 
debian. Here is the code:

a = kroneckerproduct(ones((4195,1)), identity(12))
print a.mean()

This works perfectly well in windows but it gave the following error while 
running it in debian:
Traceback (most recent call last):
   File stdin, line 1, in ?
   File /usr/lib/python2.4/site-packages/numarray/numarraycore.py, line 
1137, in mean
 return self.sum()/(self.nelements()*1.0)
   File /usr/lib/python2.4/site-packages/numarray/numarraycore.py, line 
1133, in sum
 return ufunc.add.reduce(ufunc.add.areduce(self, type=type).flat, 
type=type)
IndexError: too many indices.

But if I reduce the number 4195 to 419, it works. Is it a bug in Python or 
Numarray? Can someone help me figure it out? BTW, the python version is 2.4.1

Many thanks!
Xiangyi

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


Re: finding sublist

2005-08-02 Thread Johan Lindberg
Hello.

 my target is implement a function controlla(string - a binary string-)
 that check if there is in a string two equal not overlapping
 subsequences at least of length limitem:

 my code:
 [snip]


I may have misunderstood it, but does your function work the way you
want it to?

controlla(testeststest)
no

I can't get it to print anything other than no. But then again, I'm
reading and posting via Google and I guess all those break statements
shouldn't be on the same indent-level.

 the question is: Is there a faster way doing that? I don't know,
 changing string into list or array, using map, or module, using
 different loop, regular expression,funcional programming , list
 comprehensions , sets, different looping techniques, i dont
 know...(!)

Since you're using nested for loops when searching the string you
should make sure not to perform more iterations than neccessary. The
function below returns a list of all, non-overlapping, substrings in
text where len(substring)= minLength. The outer loop is limited to
about half of the length of the text which is where most of the speed
comes from but I'm sure it can be tweaked for more.

def foo(text, minLength):
  result= []
  for length in range(minLength, len(text)/ 2+ 1):
for start in range(len(text)):
  end= start+ length
  if end len(text):
part= text[start:end]
if text.find(part, end)!= -1:
  if part not in result:
result.append(part)

  return result

foo(testeststest, 4)
['test', 'stes', 'stest']

foo(testeststest, 3)
['tes', 'est', 'ste', 'test', 'stes', 'stest']

HTH
Johan Lindberg
[EMAIL PROTECTED]

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


Re: pre subprocess help needed

2005-08-02 Thread Chris Lambacher
There is a version of subprocess for 2.3.
http://www.lysator.liu.se/~astrand/popen5/
http://effbot.org/downloads/#subprocess


On Tue, Aug 02, 2005 at 10:05:00AM -0700, chuck wrote:
 I need to execute a command shell process obtain the return code and
 capture stdout from that shell process.  I've done this with 2.4 using
 subprocess.  How do I do it with 2.3?
 
 -- 
 http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Dabo in 30 seconds?

2005-08-02 Thread Fernando Perez
Ed Leafe wrote:

 On Monday 01 August 2005 11:56, Terry Reedy wrote:
 
 That is an impossibility.  However, there is a middle path between that and
 no defensive code.  In the present case, you appear to acknowledge a known
 easy way to mis-compile wxWidgets from Dabo's viewpoint.  If there is a
 known easy way to detect that misconfiguration (which I suspect there is),
 and it is known that someone has tripped over that problem (which it now
 is), then a nice error message  like 'Sorry, Dabo need wxWidgets compiled
 with the --include_stylized_text option' would certainly be friendlier than
 a stack trace.
 
  OK, that's more of what I had in mind. Truth be told, this is the first time
 we've run into this, and as a result I'll make the change to that import
 statement today.

plug, but hopefully a useful one

You may want to steal the crash handling code from ipython.  In order to
address this kind of problem, ipython sticks an exceptionally verbose
traceback printer into sys.excepthook.  If ipython ever crashes, the user gets
a LOT of info, and it's all packaged ready to go, to be emailed to me.  Here's
an example of the result (I stuck 1/0 inside to force the crash):

In [1]: print 'hello'
hello

In [2]:
---
exceptions.ZeroDivisionError Python
2.3.4: /usr/bin/python
   Tue Aug  2 11:21:46 2005
A problem occured executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.

/home/fperez/usr/bin/ipython
 -2 import IPython
 -1
  0 IPython.Shell.start().mainloop()

/usr/local/home/fperez/code/python/IPython/Shell.py in
mainloop(self=IPython.Shell.IPShell instance, sys_exit=0, banner=None)

/home/fperez/code/python/IPython/iplib.py in
mainloop(self=IPython.iplib.InteractiveShell instance, banner='Python 2.3.4
(#1, Feb  2 2005, 12:11:53) \nType ...ut \'object\'. ?object also works, ??
prints more.\n')
   1263
   1264 def mainloop(self,banner=None):
   1265 Creates the local namespace and starts the mainloop.
   1266
   1267 If an optional banner argument is given, it will override the
   1268 internally created default banner.
   1269
   1270 self.name_space_init()
   1271 if self.rc.c:  # Emulate Python's -c option
   1272 self.exec_init_cmd()
   1273 if banner is None:
   1274 if self.rc.banner:
   1275 banner = self.BANNER+self.banner2
   1276 else:
   1277 banner = ''
- 1278 self.interact(banner)
self.interact = bound method InteractiveShell.interact of
IPython.iplib.InteractiveShell instance at 0x4005ffac
banner = 'Python 2.3.4 (#1, Feb  2 2005, 12:11:53) \nType copyright,
credits or license for more information.\n\nIPython 0.6.16_svn -- An
enhanced Interactive Python.\n?   - Introduction to IPython\'s features
\n%magic  - Information about IPython\'s \'magic\' % functions.\nhelp-
Python\'s own help system.\nobject? - Details about \'object\'. ?object also
works, ?? prints more.\n'
   1279
   1280 def exec_init_cmd(self):
   1281 Execute a command given at the command line.
   1282
   1283 This emulates Python's -c option.
   1284
   1285 sys.argv = ['-c']
   1286 self.push(self.rc.c)
   1287
   1288 def
embed_mainloop(self,header='',local_ns=None,global_ns=None,stack_depth=0):
   1289 Embeds IPython into a running python program.
   1290
   1291 Input:
   1292
   1293   - header: An optional header message can be specified.


[...]

LOTS MORE: each stack frame has a lot of surrounding context printed, and all
locals as well.

Then this is the end of the printout:

   1399 except KeyboardInterrupt:
- 1400 1/0

   1401 self.write(\nKeyboardInterrupt\n)
   1402 self.resetbuffer()
   1403 more = 0
   1404 # keep cache in sync with the prompt counter:
   1405 self.outputcache.prompt_count -= 1
   1406
   1407 if self.autoindent:
   1408 self.readline_indent = 0
   1409
   1410 except bdb.BdbQuit:
   1411 warn(The Python debugger has exited with a BdbQuit
exception.\n
   1412  Because of how pdb handles the stack, it is
impossible\n
   1413  for IPython to properly format this particular
exception.\n
   1414  IPython will resume normal operation.)
   1415

ZeroDivisionError: integer division or modulo by zero

**

Oops, IPython crashed. We do our best to make it stable, but...

A crash report was automatically generated with the following information:
  - A verbatim copy of 

Re: Art of Unit Testing

2005-08-02 Thread John Roth
Björn Lindström [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Christoph Zwerschke [EMAIL PROTECTED] writes:

 Would it make sense to add globaleSetup and globalTearDown methods
 to the TestCase class? I think at least it would not harm
 anybody. Where should such proposals be submitted?

 In general that's not such a good idea. If you build your tests like
 that, it gets hard to know which test really went wrong, and you might
 get the situation where the whole set of tests works, but depend on each
 other in some way. (This can also happen for more obscure reasons, and
 is worth looking out for whichever way you do it.)

 So, rebuilding the environment for the each before every single test is
 generally worth the overhead.

Generally is not always. There are configuration issues that are
best dealt with once at the beginning of the test, and once at
the end, and that have absolutely nothing to do with the order
in which each elementary test runs.

When your customers keep asking for something, and you
keep telling them that they really don't want what they're
asking for, who's lisening, and who's being stubborn?

John Roth
Python Fit.


 -- 
 Björn Lindström [EMAIL PROTECTED]
 Student of computational linguistics, Uppsala University, Sweden 

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

Re: Dabo in 30 seconds?

2005-08-02 Thread Paul McNett
Fernando Perez wrote:
 plug, but hopefully a useful one
 
 You may want to steal the crash handling code from ipython.  In order to
 address this kind of problem, ipython sticks an exceptionally verbose
 traceback printer into sys.excepthook.  If ipython ever crashes, the user gets
 a LOT of info, and it's all packaged ready to go, to be emailed to me.  Here's
 an example of the result (I stuck 1/0 inside to force the crash):

[snip]

 This approach has worked very well for me over the years, and these crash
 report emails have become fortunately rather rare as of late :)
 
 If you are interested, just get ipython and grab the files for this, it's all
 BSD licensed.  You can also browse the SVN repo here if you want to look at
 the code:
 
 http://ipython.scipy.org/svn/ipython/ipython/trunk/IPython/
 
 The relevant files are ultraTB.py and CrashHandler.py.

Thanks Fernando, consider your excellent code stolen! :) I'll probably 
make a flag that defaults to ultraTB but that can also be set to leave 
sys.excepthook as-is. Best of both worlds!

I've done things like this in the past, in my own Visual Foxpro 
framework. In that situation, I had enough control over the deployment 
to also ship a small smtp client, and automatically email the error 
without requiring any interaction at all. Clients were impressed when 
I'd already have a fix for the problem before they even notified me of 
the issue!

-- 
Paul McNett
http://paulmcnett.com

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


Re: Dabo in 30 seconds?

2005-08-02 Thread Ed Leafe
On Tuesday 02 August 2005 13:40, Fernando Perez wrote:

 The point is that something like this:

 - gives an experienced user a lot of information to track down the bug if
 they feel like it.

 - but also gives the raw newbie an easy solution: just mail me that
 auto-generated crash file and forget about it.

 Thanks! This looks like a great approach - I may have to borrow it!
-- 

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 2-player game, client and server at localhost

2005-08-02 Thread Christopher Subich
Michael Rybak wrote:
 CS There's the key.  How are you processing network input, specifically 
 CS retrieving it from the socket?
 
 A sock class has a socket with 0.1 timeout, and every time I
 want anything, I call it's read_command() method until it returns
 anything. read_command() and send_command() transfer user's actions in
 special format so that it takes 10 bytes per transfer.

So when you want player input, you explicitly halt the program until you 
receive it, inside a while loop?  No wonder your programs aren't 
behaving well, then.

Network processing Is Not Slow.  Unless you're sending near the maximum 
capacity of your line, which you're obviously not[1], the slowness is 
architectural.

[1] - The TCP packet contains at most 28 bytes of overhead, so combine 
that with 10 bytes of data and you're looking at 38 bytes/packet.  A 
33.6 modem can handle 4.2kB/sec, cut that in half for a safety margin 
for 2.1kB/sec.  That will handle about 55 updates/second, which you 
shouldn't be reaching if you're just sending updates when a player does 
something.

Why are you messing with sockets directly, to begin with?  It looks like 
you want an asynchronous socket interface, so that you don't explicitly 
loop and wait for data from the nyetwork for updates.

In addition to making Julienne fries, Twisted is an excellent framework 
for asynchronous network IO.  For a naive, non-threaded implementation, 
you'd schedule your update code as a timed event, and you'd define a 
Protocol for handling your network stuff.  When you receive data, the 
protocl would update your application's state, and that would be picked 
up automagically the next time your update event ran.

In a threaded implementation, you'd run your update code to a thread 
(DeferToThread), and your network code would post updates to a 
synchronous queue, read by your update code.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe windows apps path question

2005-08-02 Thread Grant Edwards
On 2005-08-02, vincent wehren [EMAIL PROTECTED] wrote:

 Grant Edwards [EMAIL PROTECTED] schrieb im Newsbeitrag 
 news:[EMAIL PROTECTED]
|I have several python apps (some wxPython, some plain text-mode
| stuff) that I distribute internally for installation on Win32
| machines.  They're bundled/installed using py2exe and inno
| setup.
|
| I followed what I think is the normal procedure of installing
| each app in its own directory under /Program
| Files/vendor/app.
|
| The problem is that the apps only run if they're started with
| the install directory as the current working directory.
| Otherwise they can't find the .dll's they use from the install
| directory.

 AFAIK, Windows normally *does* search the directory where the executable 
 module for the current process lives in for dlls. What sort of dlls are 
 given you trouble?

One's a driver for a CAN bus USB widget.  The other failure
that springs to mind is that gnuplot-py couldn't find something
(could have been an .exe) that was in the app directory.

-- 
Grant Edwards   grante Yow!  HUGH BEAUMONT died
  at   in 1982!!
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe windows apps path question

2005-08-02 Thread vincent wehren
Gregory Piñero [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]

|And here is how I make sure I'm always using the right directory in my 
scripts:
|
|Put this code at the top:
|import sys
|curdir=os.path.dirname(sys.argv[0])
|#print curdir
|Then I use curdir to build all of the paths in my app:
|For example let's get a list of files in a folder:
|lstresumes=os.listdir(os.path.join(curdir,resume_folder_path)) #get
|list of resumes

snipped

Greg,

If you need something that works both on a frozen app as well as an 
(unfrozen) python
script, you'd be better off using something like:

def getAppPrefix():
Return the location the app is running from

isFrozen = False
try:
isFrozen = sys.frozen
except AttributeError:
pass
if isFrozen:
appPrefix = os.path.split(sys.executable)[0]
else:
appPrefix = os.path.split(os.path.abspath(sys.argv[0]))[0]
return appPrefix

Now you can use the return value of getAppPrefix() everywhere you need to 
calculate paths relative to your app, regardless if it involves a regular 
script or py2exe'ified one.

Regards,

--

Vincent Wehren


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

Re: py2exe windows apps path question

2005-08-02 Thread vincent wehren
Grant Edwards [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
| On 2005-08-02, vincent wehren [EMAIL PROTECTED] wrote:
| 
|  Grant Edwards [EMAIL PROTECTED] schrieb im Newsbeitrag
|  news:[EMAIL PROTECTED]
| |I have several python apps (some wxPython, some plain text-mode
| | stuff) that I distribute internally for installation on Win32
| | machines.  They're bundled/installed using py2exe and inno
| | setup.
| |
| | I followed what I think is the normal procedure of installing
| | each app in its own directory under /Program
| | Files/vendor/app.
| |
| | The problem is that the apps only run if they're started with
| | the install directory as the current working directory.
| | Otherwise they can't find the .dll's they use from the install
| | directory.
| 
|  AFAIK, Windows normally *does* search the directory where the executable
|  module for the current process lives in for dlls. What sort of dlls are
|  given you trouble?
|
| One's a driver for a CAN bus USB widget.  The other failure
| that springs to mind is that gnuplot-py couldn't find something
| (could have been an .exe) that was in the app directory.

Grant,

If you are building paths in you code that are relative to your app, please 
see my reply to Greg's post. If not, you may as a workaround want to try to 
add the frozen application's directory to the system path environment 
variable. Windows will look for dlls there, too.

To get the app's actual location, you will need something like the 
getAppPrefix() function as per my reply to Greg's reply. The getAppPrefix() 
function will also hold when the user adds your frozen app to his/her system 
path and call the app from any location from the command line - sys.argv[0] 
just won't do the trick in such a setting.


HTH,

--

Vincent Wehren










|
| -- 
| Grant Edwards   grante Yow!  HUGH BEAUMONT 
died
|  at   in 1982!!
|   visi.com 


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


IronPython 0.9 Released

2005-08-02 Thread Luis M. Gonzalez
IronPython 0.9 Released(8/2/2005 10:28:41 AM)

http://www.microsoft.com/downloads/details.aspx?familyid=cf5ae627-5df1-4f8a-ba8b-d64f0676f43fdisplaylang=en

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


Re: py2exe windows apps path question

2005-08-02 Thread Gregory Piñero
 If you need something that works both on a frozen app as well as an
 (unfrozen) python
 script, you'd be better off using something like:
 
 def getAppPrefix():
 Return the location the app is running from
 
 isFrozen = False
 try:
 isFrozen = sys.frozen
 except AttributeError:
 pass
 if isFrozen:
 appPrefix = os.path.split(sys.executable)[0]
 else:
 appPrefix = os.path.split(os.path.abspath(sys.argv[0]))[0]
 return appPrefix
 

Vincent,

This sounds interesting.  A few questions for you:
Why don't I see sys.frozen in interpreter?  
Does it only appear when it is frozen?  
What do you mean by frozen, how does python know?
What does sys.executable do?

Thanks,

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


Re: Dabo in 30 seconds?

2005-08-02 Thread Fernando Perez
Paul McNett wrote:

 Fernando Perez wrote:

 If you are interested, just get ipython and grab the files for this, it's
 all
 BSD licensed.  You can also browse the SVN repo here if you want to look at
 the code:
 
 http://ipython.scipy.org/svn/ipython/ipython/trunk/IPython/
 
 The relevant files are ultraTB.py and CrashHandler.py.
 
 Thanks Fernando, consider your excellent code stolen! :) I'll probably
 make a flag that defaults to ultraTB but that can also be set to leave
 sys.excepthook as-is. Best of both worlds!

Glad to be of use!  I should probably ship this standalone, as I'm sure a lot
of projects could use it, and the tracebacks are a hell of a lot better than
what you get with python's default printouts.  So little time...

By all means contact me with complaints/bugs if you run into problems with this
code.

Cheers,

f

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


Re: a pickle's pickle

2005-08-02 Thread Benji York
[EMAIL PROTECTED] wrote:
 So basically trainer always gets an existing TrainingMatrix(the class)
 pickled object if there is a file to read from, otherwise it just makes
 a new instance.  Either way, the instance trainer is pickled at the end.

Right, but the data you're interested in is contained in the class, not 
the instance.  You need to move the mutable class attributes into the 
instance.  Like so:

class TrainingMatrix:

 totalWordsProcessed = 0
 numWords = 0
 numContexts = 0
 matrixWords = 0

 def __init__(self):
 self.matrix = []
 self.estimator = {}
 self.wordInfo = {}
 self.contextInfo = {}
--
Benji York


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


Re: Art of Unit Testing

2005-08-02 Thread Christoph Zwerschke
Thanks for the link, Grig. I wasn't aware of the py lib so far. The 
possibility to create fixtures at the three different scopes is exactly 
what I was looking for.

Anyway, I think it would be nice to have that feature in the standard 
lib unittest as well. It should not be too hard to add setUpOnce and 
tearDownOnce methods in addition to setUp and tearDown. Actually, I am 
wondering that there doesn't seem to be any development progress since 
unittest was included in the standard lib of Python 2.1 in August 2001. 
I had expected that such an important module would be continually 
improved and maintained. How come? So few people using unit tests? Or do 
most people write their own testing code or use py.test?

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


Re: bug in python/numarray

2005-08-02 Thread Terry Reedy

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi, there,

 I got different results by running the same lines of code on windows and
 debian. Here is the code:

 a = kroneckerproduct(ones((4195,1)), identity(12))

I don't know what this does, but wonder if it uses a lot of memory.

 print a.mean()

 This works perfectly well in windows but it gave the following error 
 while
 running it in debian:

Were you running on one dual boot machine (with the same memory available 
to each OS) or on two different machines, especially with different amounts 
of memory.

 Traceback (most recent call last):
   File stdin, line 1, in ?
   File /usr/lib/python2.4/site-packages/numarray/numarraycore.py, line
 1137, in mean
 return self.sum()/(self.nelements()*1.0)
   File /usr/lib/python2.4/site-packages/numarray/numarraycore.py, line
 1133, in sum
 return ufunc.add.reduce(ufunc.add.areduce(self, type=type).flat,
 type=type)
 IndexError: too many indices.

 But if I reduce the number 4195 to 419, it works.

Try using binary search (ie, try 2200 next) to pin down the exact breakdown 
point (as in 2123 works, 2124 does not) if there is one, or whether the 
breakdown is run dependent.  Unload other apps and non-essential background 
process to see if that changes anything

 Is it a bug in Python or  Numarray?

If it is not a resource issue, assume the latter since it crashed in 
Numarray.  I think its maintainers would want to know about it.

Terry J. Reedy



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


Re: a pickle's pickle

2005-08-02 Thread [EMAIL PROTECTED]
Benji,
   Thanks so much, you have saved the day ^_^

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


Re: Art of Unit Testing

2005-08-02 Thread Christoph Zwerschke
Björn Lindström wrote:
Would it make sense to add globaleSetup and globalTearDown methods
to the TestCase class?
 In general that's not such a good idea.

I completely agree and I think it makes a lot of sense that unittest 
calls setUp and tearDown for every single test. However, the fact that 
this is *generally* the best way doesn't exclude the fact that there are 
*exceptions* when it makes sense to setUp and tearDown not for every 
test, e.g. when it is absolutely sure that the fixture cannot be 
destroyed by the individual tests or when creating the fixture takes too 
much time. I already gave the example of creating database connections 
or even creating/importing whole databases. My question was, how do I 
handle these cases with the standard lib unittest?

According to the extreme programming paradigm, testing should be done 
several times a day. So a requirement for extreme programm is that tests 
are fast enough. If the testing needs too much time, people are 
discouraged to test often.

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

Fredericksburg, VA Zope and Python User Group

2005-08-02 Thread Benji York
Please join us August 10, 7:30-9:00 PM, for the third meeting of the
Fredericksburg, VA Zope and Python User Group (ZPUG).

This meeting has four features of note.

- Brian Lloyd, the author of Python for .Net (http://www.zope.org/
Members/Brian/PythonNet/) and the Zope Corporation VP of Engineering,
will discuss his .Net platform and give a brief .Net overview.

- Benji York, Zope Corp Senior Software Engineer, will discuss
current functional testing practices on Zope 3, including using
Selenium on Zope 3, using demo storage for functional testing, and
using his own compelling new functional test package.  Note that the
majority of this discussion has strong applicability to automated
testing of all web frameworks and applications.

- We will serve the now-usual geek-chic fruit, cheese, and soft drinks.

- Fred Drake, Zope Corp Senior Software Engineer, Python core
developer, Python documentation maintainer and editor, and co-author
of the O'Reilly book Python  XML will give two of his books (http://
www.amazon.com/exec/obidos/tg/detail/-/0596001282/) to new
attendees.  Upon pressure, he admitted that he would be willing to
autograph them if bribed with fruit, cheese, and soft drinks.

Note that we are eager to have non-Zope-Corporation employees give
presentations. :-)

We had three new attendees last meeting, for a total of ten.  Please
come and bring friends!

More information http://www.zope.org/Members/poster/
fxbgzpug_announce_3 and below.

Hope to see you there!

Gary

General ZPUG information

When: second Wednesday of every month, 7:30-9:00.

Where: Zope Corporation offices. 513 Prince Edward Street;
Fredericksburg, VA 22408 (tinyurl for map is http://tinyurl.com/duoab).

Parking: Zope Corporation parking lot; entrance on Prince Edward Street.

Topics: As desired (and offered) by participants, within the
constraints of having to do with Python.

Contact: Gary Poster ([EMAIL PROTECTED])


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


trying to parse non valid html documents with HTMLParser

2005-08-02 Thread florent
I'm trying to parse html documents from the web, using the HTMLParser 
class of the HTMLParser module (python 2.3), but some web documents are 
not fully valids. When the parser finds an invalid tag, he raises an 
exception. Then it seems impossible to resume the parsing just after 
where the exception was raised. I'd like to continue parsing an html 
document even if an invalid tag was found. Is it possible to do this ?

Here is a little non valid html document.
--
html
body
a href=bogus link/a
/body
/html
--
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe windows apps path question

2005-08-02 Thread Grant Edwards
On 2005-08-02, vincent wehren [EMAIL PROTECTED] wrote:

 If you are building paths in you code that are relative to
 your app,

I'm not using any paths.  I use cytpes to load a .dll, and I
don't really know what gnuplot-py is doing, but I think it's
executing a .exe file and talking to it via a pipe or something.

 please see my reply to Greg's post. If not, you may
 as a workaround want to try to add the frozen application's
 directory to the system path environment variable. Windows
 will look for dlls there, too.

That's probably the right answer.

 To get the app's actual location, you will need something like
 the getAppPrefix() function as per my reply to Greg's reply.
 The getAppPrefix() function will also hold when the user adds
 your frozen app to his/her system path and call the app from
 any location from the command line - sys.argv[0] just won't do
 the trick in such a setting.

I'll give that a try.

-- 
Grant Edwards   grante Yow!  .. I think I'd
  at   better go back to my DESK
   visi.comand toy with a few common
   MISAPPREHENSIONS...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pre subprocess help needed

2005-08-02 Thread [EMAIL PROTECTED]
You can also use the spawn functions in os, together with the P_WAIT
mode.

os.spawnlp(os.P_WAIT, 'ls', 'ls')
gconfd-martin  kde-martin  mcop-martin   ssh-PhJzdB6333
gpg-bSRhOE ksocket-martin  orbit-martin
0
os.spawnlp(os.P_WAIT, 'spam', 'spam')
127

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


Re: finding sublist

2005-08-02 Thread giampiero mu
controlla(12345678) - 12345678

thanks everyone. only a question. there is a way to advantage of binary
sequences?

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


Re: Newer than a Newbe

2005-08-02 Thread Luis M. Gonzalez

linuxfreak wrote:
 Look at Karrigell. Its a web framework for Python

 http://karrigell.sourceforge.net

I second this suggestion.
Karrigell is a pleasure to work with and I'm sure it will appeal any
python fun who dare to play with it.
I also hope Pierre (its developer) lose some of his modesty and start
to show off this beatifull framework :-)
because so far, he's been reluctant to promote it until he is 100% sure
it's mature and stable (it's been ready for a long time though).

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


Re: bug in python/numarray

2005-08-02 Thread Robert Kern
[EMAIL PROTECTED] wrote:
 Hi, there,
 
 I got different results by running the same lines of code on windows and 
 debian. Here is the code:
 
 a = kroneckerproduct(ones((4195,1)), identity(12))
 print a.mean()
 
 This works perfectly well in windows but it gave the following error while 
 running it in debian:
 Traceback (most recent call last):
File stdin, line 1, in ?
File /usr/lib/python2.4/site-packages/numarray/numarraycore.py, line 
 1137, in mean
  return self.sum()/(self.nelements()*1.0)
File /usr/lib/python2.4/site-packages/numarray/numarraycore.py, line 
 1133, in sum
  return ufunc.add.reduce(ufunc.add.areduce(self, type=type).flat, 
 type=type)
 IndexError: too many indices.
 
 But if I reduce the number 4195 to 419, it works. Is it a bug in Python or 
 Numarray? Can someone help me figure it out? BTW, the python version is 2.4.1

It's almost certainly numarray. I don't get an error on OS X with the 
latest CVS of numarray. Please try the latest CVS on your platforms, and 
if you still get this error, then post it to the numarray mailing list. 
Thanks!

http://lists.sourceforge.net/lists/listinfo/numpy-discussion

-- 
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


  1   2   >