Re: sum and strings

2006-08-24 Thread Fredrik Lundh
Tim Chase wrote:

   q3 = q1 + q2
   q3.n, q3.i, q3.j, q3.k
 (8, 13, 16, 22)
   sum([q1,q2])
 Traceback (most recent call last):
File stdin, line 1, in ?
 TypeError: unsupported operand type(s) for +: 'int' and 'q'
 
 Just because something is slow or sub-optimal doesn't mean it 
 should be an error.

that's not an error because it would be slow or sub-optimal to add 
custom objects, that's an error because you don't understand how sum 
works.

(hint: sum != reduce)

/F

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


Re: how to get file name of the running .py file

2006-08-24 Thread Fredrik Lundh
Larry Bates wrote:

 How to get the name of the running .py file like the macro _FILE_ in C?

 import os
 import sys
 print sys.argv[0]
 
 or if you just want the script and not the full path
 
 print os.path.basename(sys.argv[0])

except that __FILE__ is the name of the current source file, not the 
name of the main program.

the global name __file__ is a better choice; when definied, it points to 
the file from which the current module was loaded (this might be a byte 
code file or a shared library).

also see:

 http://pyref.infogami.com/__file__

/F

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


Re: Taking data from a text file to parse html page

2006-08-24 Thread Anthra Norell
DH,
  Could you be more specific describing what you have and what you want? 
You are addressing people, many of whom are good at
stripping useless junk once you tell them what 'useless junk' is.
  Also it helps to post some of you data that you need to process and a 
sample of the same data as it should look once it is
processed.

Frederic

- Original Message -
From: DH [EMAIL PROTECTED]
Newsgroups: comp.lang.python
To: python-list@python.org
Sent: Thursday, August 24, 2006 2:11 AM
Subject: Taking data from a text file to parse html page


 Hi,

 I'm trying to strip the html and other useless junk from a html page..
 Id like to create something like an automated text editor, where it
 takes the keywords from a txt file and removes them from the html page
 (replace the words in the html page with blank space) I'm new to python
 and could use a little push in the right direction, any ideas on how to
 implement this?

 Thanks!

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

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


Re: Problem with tokenize module and indents

2006-08-24 Thread Tim Scheidemantle


Tim wrote:
 I ran into a problem with a script i was playing with to check code 
 indents and need some direction.  It seems to depend on if tabsize is 
 set to 4 in editor and spaces and tabs indents are mixed on consecutive 
 lines.  Works fine when editors tabsize was 8 regardless if indents are 
 mixed.
   
Nevermind, I asked a *duh* question
The simple answer is it would never compile anyway lol
It's been a long week with 2 days to go...


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


Re: Problem with tokenize module and indents

2006-08-24 Thread Fredrik Lundh
Tim wrote:

 I ran into a problem with a script i was playing with to check code 
 indents and need some direction.  It seems to depend on if tabsize is 
 set to 4 in editor and spaces and tabs indents are mixed on consecutive 
 lines.  Works fine when editors tabsize was 8 regardless if indents are 
 mixed.
 

 # nano -T4 tabspacing_4.py
 class Test:
 triple quote  #indent is 1 tab
 def __init__(self, msg):#indent is 4 spaces
 this gets reported as a dedent when there is no change in indent level

http://pyref.infogami.com/lexical-analysis

   First, tabs are replaced (from left to right) by one to eight spaces
   such that the total number of characters up to and including the
   replacement is a multiple of eight (this is intended to be the same
   rule as used by Unix). The total number of spaces preceding the first
   non-blank character then determines the line's indentation.

/F

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


what is the data from loads()

2006-08-24 Thread leo
Hi,

Following is the python scripts:



import marshal

exec(marshal.loads('c\000\000\000\000\001\000\000\000s\017\000\000\000\177\000\000\177\002\000d\000\000GHd\001\000S(\002\000\000\000s\005\000\000\000helloN(\000\000\000\000(\000\000\000\000s\010\000\000\000scripts\001\000\000\000?\002\000s\000\000\000\000'))

anyone know what is the data in loads()?
i mean what is the 
('c\000\000\000\000\001\000\000\000s\017\000\000\000\177\000\000\177\002\000d\000\000GHd\001\000S(\002\000\000\000s\005\000\000\000helloN(\000\000\000\000(\000\000\000\000s\010\000\000\000scripts\001\000\000\000?\002\000s\000\000\000\000')
 
?? 


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


Re: How to download a web page just like a web browser do ?

2006-08-24 Thread Bo Yang

 Thank you , Max !
 I think HarvestMan is just what I need !
 Thanks again !

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


Record Audio Analysis

2006-08-24 Thread Jo Chase
I would like to record audio from a mic and perform some basic analysis on 
the audio wave patterns produced.  What would be the easiest way to 
accomplish this in Python? 


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


Re: what is the data from loads()

2006-08-24 Thread Fredrik Lundh
leo wrote:

 anyone know what is the data in loads()?
 i mean what is the 
 ('c\000\000\000\000\001\000\000\000s\017...

compiled and serialized Python code (the same kind of stuff that you'll 
find in PYC files).

if you don't trust the source, don't run that program.

/F

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


Re: How to download a web page just like a web browser do ?

2006-08-24 Thread BJörn Lindqvist
Mechanize (http://wwwsearch.sourceforge.net/mechanize/) is another
option, it can even fill out forms!

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


datetime problems select from MySQL

2006-08-24 Thread ZoombyWoof
Hi. I have ran into a weird thing I just can't find any solution for. I 
have googled and searched but no luck.

The problem is that when I select TIME values from MySQL from python, I 
get wrong results when the TIME values are negative.

 From mysql program:
mysql select id,flex from Users where id=2;
++--+
| id | flex |
++--+
|  2 | 00:30:00 |
++--+

 From python script:
SELECT id,flex FROM Users WHERE id=2
Data back from MySQLdb:
((2L, datetime.timedelta(0, 1800)),)

This looks good and fine, but this :

 From mysql program:
mysql select id,flex from Users where id=2;
++---+
| id | flex  |
++---+
|  2 | -00:30:00 |
++---+

 From python :
SELECT id,flex FROM Users WHERE id=2
Data back from MySQLdb:
((2L, datetime.timedelta(0, 1800)),)

Not good, python thinks this is a positive value. One more:

mysql select id,flex from Users where id=2;
++---+
| id | flex  |
++---+
|  2 | -01:30:00 |
++---+

Python :
SELECT id,flex FROM Users WHERE id=2
Data back from MySQLdb:
((2L, datetime.timedelta(-1, 84600)),)

At least its negative but this looks to me as -00:30 rather than 
-01:30. (86400-84600 = 1800, = 30 minutes)

And now a negative that works!:

mysql select id,flex from Users where id=2;
++---+
| id | flex  |
++---+
|  2 | -10:00:00 |
++---+

Python:
SELECT id,flex FROM Users WHERE id=2
Data back from MySQLdb:
((2L, datetime.timedelta(-1, 50400)),)

This looks alright to me...(86400-50400 = 36000, = 10 hours)

Any ideas ? Have I missed something obvious here or ? It seems to be 
offset by an hour or something

I run python2.4 on debian sarge, MySQL 5.0.18 and python-mysqldb version 
1.2.1-c2-1

Any help greatly appreciated. Thanx.

/ZW


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


Re: programming with Python 3000 in mind

2006-08-24 Thread GHUM
Steven,

you ask good questions!

 (2) Will there be automated tools for converting source code from Python 2
 to Python 3000?

If you would have been to the EuroPythom 2006, you may have heard the
plans for PyPy 2.0; which may have per-module-switchable syntax
compatibility for Py 2.2-3000. So by trusting the PyPy team, you can
stay very very relaxed concerning Python 3000.

Harald

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


Concatenating arrays

2006-08-24 Thread Sheldon
Good day everyone,

I would like to know if anyone has a fast and concise way of
concatenating two 2D arrays of same dimensions?
Whenever I try:

a = concatenate(b,c)

I get erroneous data as if the axises were incorrectly chosen. As far
as I can see concatenate((b,c),0) does it vertically while a 1 does it
horizontally. But the results does not reflect this.
What am I missing here?

I am using Numeric.

Any help is appreciated,
Sheldon

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


Re: Python + Java Integration

2006-08-24 Thread Paul Boddie
Fredrik Lundh wrote:
 Ben Sizer wrote:

  Java itself never deserved to be the 'next' anything anyway.

 I've had a lot of developers come up to me and
 say, I haven't had this much fun in a long time.
 It sure beats writing Cobol -- James Gosling

Nice quote! It also reinforces the impression that there are many
people working with technology who don't have very much control over
the tools they get to use - you could replace Cobol with VB in the
quote and it'd still echo the sentiments of a large number of
developers.

Of course, it's just not accurate to imply that Java had nothing to
offer: in an age when a number of languages provided support for safe
execution (Obliq, Telescript, Safe-Tcl, etc.) and where a few had
in-built support for concurrency (Ada, Occam, etc.), Java rather
effectively brought both of these and more to the mainstream. It may be
true that the language didn't justify the hype and that the API was
fairly badly designed in various places, but it represented a step up
for most developers, and the hype managed to give many of those
developers a chance or an excuse to use the language, rather than be
forbidden to use it because it didn't fit in with corporate or
organisational strategy.

There are parallels with Rails in the Java hype story: something better
than what lots of people are using (probably PHP in most cases),
combined with a dose of hype to persuade decision makers that everyone
else in the herd is moving in that direction, leads to something
suddenly becoming popular, being perceived as the next big thing, and
having lots of vocal evangelists who might seem like wise men to the
masses, but whose pronouncements on dynamic languages, for example,
seem belated and obvious to many of us. For those inclined to panic at
such a spectacle, a perusal of the comp.lang.python/python-list
archives for 1996-1998 might be informative to see how a community can
adapt sensibly to such events.

Paul

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


Re: Can Python do Perl's print EOF; notation? - popen, subprocess works?

2006-08-24 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  However, when the code in the string was actually
  qsubcmds = 
echo
cd %(cwd)s
%(cmds) %(args)
rm -f %(files)s
   % vars()
 
  in which %(cmd)s folks a subprocess, when this string was write to some
  pipe, e.g.:
 
QSUB = Popen(qsubcmds, shell=True, stdin=PIPE)
print  QSUB.stdin, qsubcmds
(or Popen.communicate(qsubcmds))
 
  the rm -f  was not executed in my case.

Not sure why you are sending the mini shell script to itself on stdin?
That doesn't seem to make sense.

Come up with a simple example everyone can try and post it running in
an interactive python session.  Here are my attempts to replicate your
problem.

This runs fine...

 from subprocess import *
 cmds=echo one
... echo two
... echo three
... echo four
... 
 
 out = Popen(cmds, shell=True, stdin=PIPE)
 one
two
three
four

 

As does this using stdin

 cmds=read A
... read B
... read C
... echo $C $B $A
 out = Popen(cmds, shell=True, stdin=PIPE)
 out.communicate(one
... two
... three)
three two one
(None, None)
 

-- 
Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: radio buttons in curses

2006-08-24 Thread Fabian Braennstroem
Hi Steve,

* Steve Holden [EMAIL PROTECTED] wrote:
 Fabian Braennstroem wrote:
 Sorry, me again...
 Does nobody have an idea or is it to stupid?
 
 * Fabian Braennstroem [EMAIL PROTECTED] wrote:
 
Hi,

I want to add some radio and check buttons to my curses
script. As I understand it, there are no buttons in the
'basic' curses module. Now, I found the curses-extra module,
but I not able to download and install it.

Does anybody have an idea, where I can download the module
or, even better, how I can create radio and check buttons
with the 'ordinary' curses module? Would be nice...

Greetings!
 Fabian

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

 
 
 Greetings!
  Fabian
 
 Sounding a bit like a no, looks like. Did you Google much?

Yes, it looks like this ... actually, I did google and found
out that it does not work, so that I am looking for
curses-extra. Maybe, somebody has a copy and could send me
one? Would be nice!

Greetings!
 Fabian

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


Re: all ip addresses of machines in the local network

2006-08-24 Thread Amit Khemka
On 23 Aug 2006 21:46:21 -0700, damacy [EMAIL PROTECTED] wrote:
 hi, sandra.

 no, it's not as complicated as that. all i want to do is to load a
 database onto different machines residing in the same network. i hope
 there is a way doing it. or perhaps i have a poor understanding of how
 networks work.


I expect that you would know the IP range for your network. Then you
can simply 'ping' each IP in the range to find wether its alive.
Moreover by your description I guess you would actually want to find
all machines in your network that run a particular network service, to
allow you to distribute the database. In such case you can use
nmap with -p option, to find all the machines which are listening on
the particular port.

hth,
amit.



Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world's turn, endless the sun's Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help don't know what problem is Newbie

2006-08-24 Thread len
Sorry for the stupid question.  I was fixated on the SQL.

Thanks
Len Sumnler

Peter Otten wrote:
 len wrote:


  Have the following code:

 Short variable names increase the likelihood of name clashes:

  c = db.cursor()

  c = ''

  c = csz[0]

  c = csz[0] + ' ' + csz[1]
  c.execute(insert into Producer \
  (Producer_Sid, Producerno, Company, Street, Suitepo, City,
  State, Zip, \
  Phone, Taxid, Fax) \
  values ( + orec + ))
 
 Peter

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


Re: radio buttons in curses

2006-08-24 Thread Fredrik Lundh
Fabian Braennstroem wrote:

 Does nobody have an idea or is it to stupid?

have you looked at:

http://excess.org/urwid/

/F 



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


RE: Python and STL efficiency

2006-08-24 Thread Ames Andreas
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED]
 g] On Behalf Of Ray
 Sent: Wednesday, August 23, 2006 4:28 PM
 Subject: Re: Python and STL efficiency
 
 
 Tim N. van der Leeuw wrote:
  With the nr of loops corrected, Python on my laptop 
 performs worse than
  C++ under all circumstances, by a factor of about 2:
 
 *Phew*
 
 Great to know that my model of how the world works is still correct!
 (at least in relation to Python and C++!) :)

If you're really eager to see python succeed with this 'test' or 'benchmark', 
if you will, you can look at the results with VC7.1.  It clearly shows that 
much depends on the STL implementation, you use.

I use the implementations posted by Maric Michaud in 
http://mail.python.org/pipermail/python-list/2006-August/357593.html.  The 
tests, for which I appended 'with hash', use a hash_set instead of a plain set.

1) vc71 with dinkumware STL (which is vc's default STL):

print_occurence_of_strings
What do you know?
chicken crosses road
fool
so long...
print_occurence_of_unique_strings
What do you know?
chicken crosses road
fool
so long...
print_occurence_of_unique_strings_compared_by_address
What do you know?
chicken crosses road
fool
so long...
print_occurence_of_strings_with_hash
What do you know?
chicken crosses road
fool
so long...
print_occurence_of_unique_strings_with_hash
What do you know?
chicken crosses road
fool
so long...
strings : 10.921  Oops ...
unique strings : 1.047
compared by address : 0.328
strings with hash : 11.484    Oooops ...
unique strings with hash : 1.016

2) vc7.1 with STLport 5.02:

print_occurence_of_strings
What do you know?
chicken crosses road
fool
so long...
print_occurence_of_unique_strings
What do you know?
chicken crosses road
fool
so long...
print_occurence_of_unique_strings_compared_by_address
What do you know?
chicken crosses road
fool
so long...
print_occurence_of_strings_with_hash--- reorders
fool
What do you know?
chicken crosses road
so long...
print_occurence_of_unique_strings_with_hash --- reorders
so long...
What do you know?
chicken crosses road
fool
strings : 2.156
unique strings : 0.953
compared by address : 0.187
strings with hash : 2.078
unique strings with hash : 0.922

This seems to substantiate this post 
http://sourceforge.net/mailarchive/forum.php?thread_id=30201462forum_id=46178.

3) python 4.2 (python test.py; interestingly this is faster than with -OO)

so long...
What do you know
fool
chicken crosses road
Elapsed: 2.278332 seconds

It seems the unification of the strings via hash is not significantly better 
(compared to memcpy or whatever is used).

The results for the dinkumware STL are dominated by the sheer number of calls 
to HeapAlloc/HeapFree and to EnterCriticalSection/LeaveCriticalSection (I 
compiled with multithreading and linked statically).  The python version won't 
be concerned with the latter, I guess (although just by importing 'threading' 
performance gets about 3.5% worse).

STLport uses for example InterlockedExchange (obviously in the default 
allocator) and several orders of magnitude fewer calls to the heap allocation 
API.

It all boils down to the fact that I can write C++ or even assembler programs 
that perform worse (by any degree I want) than a functionally equivalent python 
program.  That's a trivial insight and it certainly doesn't provide evidence 
that python 'is faster' than c++/assembler.  Even if that's just because it 
*isn't* and can't be.

I always wonder where this rage comes from to prove oneself or whomever that 
python is the best programming language in any regard as if it hadn't enough 
other advantages.  It is certainly not the fastest/most memory efficient tool 
out there.  One of the biggest advantages of python to me is that, even if I 
run into a hotspot, the transition from python to C/C++ is so easy.  That means 
that in spite of its warts (GIL, memory efficiency ...) I don't easily come to 
a dead end using python.  This fact lets me use python's great strengths (like 
programmer efficiency etc.) without tossing and turning sleeplessly in my bed.

cheers,

aa

-- 
Andreas Ames | Programmer | Comergo GmbH |
Voice:  +49 69 7505 3213 | ames AT avaya DOT com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: all ip addresses of machines in the local network

2006-08-24 Thread Amit Khemka
On 8/24/06, Amit Khemka [EMAIL PROTECTED] wrote:
 On 23 Aug 2006 21:46:21 -0700, damacy [EMAIL PROTECTED] wrote:
  hi, sandra.
 
  no, it's not as complicated as that. all i want to do is to load a
  database onto different machines residing in the same network. i hope
  there is a way doing it. or perhaps i have a poor understanding of how
  networks work.
 

 I expect that you would know the IP range for your network. Then you
 can simply 'ping' each IP in the range to find wether its alive.
 Moreover by your description I guess you would actually want to find
 all machines in your network that run a particular network service, to
 allow you to distribute the database. In such case you can use
 nmap with -p option, to find all the machines which are listening on
 the particular port.

 hth,
 amit.
It seems that I am not too busy, so here is a code which may work with
a few tweaks here and there:
_
import os
# base and range of the ip addresses
baseIP = 10.0.0.
r = 6
interestingPort = 22 # port that you want to scan
myIPs = []

for i in range(r):
ip = baseIP+str(i)  # It may need some customization for your case
print scanning: %s %(ip)
for output in os.popen(nmap %s -p %s %(ip,
interestingPort)).readlines():
if output.__contains__('%s/tcp open'
%interestingPort):  # i guess it would be tcp
myIPs.append(ip)
__
print myIPs


hth,
amit.
-- 

Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world's turn, endless the sun's Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem of function calls from map()

2006-08-24 Thread Fredrik Lundh
Steve Holden wrote:

 Well I guess if people wanted to argue for keeping the functionals this
 should be on the list ...

who's arguing ?

is this perhaps a little like the now that we have lexical scoping, the default
argument object binding trick is no longer needed myth ?

/F 



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


Re: radio buttons in curses

2006-08-24 Thread Fabian Braennstroem
Hi Fredrik,

* Fredrik Lundh [EMAIL PROTECTED] wrote:
 Fabian Braennstroem wrote:

 Does nobody have an idea or is it to stupid?

 have you looked at:

 http://excess.org/urwid/

Thanks! I found this too and it seems to be helpful...


Greetings!
 Fabian

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


Re: What do you want in a new web framework?

2006-08-24 Thread Paul Boddie
Cliff Wells wrote:
 On Thu, 2006-08-24 at 04:04 +, Tim Roberts wrote:
  Cliff Wells [EMAIL PROTECTED] wrote:
  
  But there are interesting things in Ruby (and Ruby 2 should take care of
  lots of warts Ruby 1.8 has) that Python could learn from.  All-in-all,
  Ruby is mostly as good as Python in most ways and better than Python in
  a couple key ways.

The big difference between Ruby and Python is the lifecycle phase that
the languages/systems are in: Ruby arguably has room for a lot of basic
improvements in the architecture of the virtual machine and presumably
has a list of must add features that cover gaping holes with respect
to certain audiences [1], whereas Python has been around for ages and
has covered most of the critical gaps in the feature list (although we
can always suggest things which bother our own part of the community).
Whereas the Ruby people merely have to agree on how critical their
missing features are and to move in one widely agreed direction, the
Python people face a tougher choice as to what should be done next;
strategies include a tidying-up exercise to make the language more
coherent, a complete reimplementation, deep modifications to the
runtime, the introduction of radical new semantics.

The fewer obvious issues that a language has, the less energy there is
in the community to deal with those issues thoroughly, I think. I guess
the Perl community chose a bold new direction in line with the
observation that a big vision can inspire much more in people than lots
of incremental changes to an existing vision, but the energy required
to follow through on such a vision can be immense. In addition to all
this, a large existing community is more likely to want larger benefits
for smaller levels of disruption because of the amount of existing
code. Thus, the available energy for change is less in a mature project
than in a growing project because people have to constantly monitor the
breakage in their existing investments in the language.

  ...but you can't READ Ruby code.

 Yeah, that's one of the big reasons I haven't seriously considered
 trying it.  It's expressive, got interesting features... and appears
 unreadable to me.  I'm usually pretty good at deciphering most
 languages, even if I haven't used them before, but Ruby is one of the
 exceptions.

My feeling is that I'd rather learn more about Lisp or Scheme than Ruby
- the benefits are greater and for me Lisp and Scheme increasingly have
the edge on readability. Perhaps I'm just not tuned in to
Smalltalk-style syntaxes.

 This brings us back around to the web framework debates.  For many
 people Ruby fits their brains and for others Python does.  I think
 frameworks are similar.  I tried Django and while I thought it was a
 great product, it simply didn't fit how I think about that problem
 domain.

I thought that the most interesting thing about Django was the URL
mapping strategy it employs, although you have to be fond of regular
expressions to really appreciate it, I think. The template and
persistence mechanisms used have the principal advantage of just being
there in the same package when compared with other solutions, and I
don't think they'd have many fans if they were just some random
projects available from the Python Package Index.

 TurboGears on the other hand did, and really, it helped clarify
 a few things I had vague notions about.  I think we'll do better not
 trying to shoehorn people into one or the other.

The goal is to provide appropriate solutions for particular problem
cases, especially common cases like database-backed Web sites, rather
than choosing something which only does a particular flavour of
database-backed site and then claiming that it's a silver bullet. I've
written a number of Web applications for my own use, and many such
applications either don't use a relational database or use it in a way
that is completely orthogonal to some relatively simple
object-relational scheme. Some of these applications are admittedly
simple, but having to create various tables in relational databases as
an offering to some framework deity is pure unnecessary overhead that
should suggest, at least to the more objective among us, that any
solution requiring such baggage is perhaps not always the most optimal.

Paul

[1]
http://headius.blogspot.com/2006/06/unicode-in-ruby-unicode-in-jruby.html

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


Best Editor

2006-08-24 Thread JAG CHAN
Friends, I am trying to learn Python.
It will be of great help to me if you let me know which one would be best 
editor for learning Python.
Plese note that I would like to have multiplatform editor which will be 
useful for both LInux and Windows XP.
Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Expert

2006-08-24 Thread Frithiof Andreas Jensen

Perseo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi guys,

 we are looking for a python developer for a European project. This
 project is multilangual and free it is called EuroCv and it need a
 module for exporting data in PDF.

A brute-force approach could be to sidestep PDF and design a
template(s) in LaTex containing fields identified by strings. LaTeX
can produce many formats, one of those is PDF.

Then have your output module read the template, do a search  replace
of the fields with values (remembering to quote the characters that
LaTex will choke on and removing the codes for the blank fields) and
write the finished LaTeX document to disk. (Maybe there are even
templating modules in Python that will take care of this).

Then compile the documents with latex, run the resulting *.dvi file
through dvipdf and return a link to it. This is a compiler pattern.
You need a naming scheme to identify your file(s) but the rest is
pretty old.

The Python application scons (a make replacement) can control the
build process - in case that you are not on a unix box - one could
have build application periodically looking for *.tex files and
compile them into *pdf whenever one is deposited in the right place.
Scons support distributed builds b.t.w.


 As web developer I try to create this
 module but It's too complicate for me. Check out the service
 www.eurocv.eu for more details. Contact us by Skype chat system our
 nick is eurocv.

 Thanks



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


Re: Best Editor

2006-08-24 Thread Michiel Sikma
I personally use Eclipse with PyDev. It is a cross-platform solution  
because Eclipse is made with Java.

http://www.eclipse.org/
http://pydev.sourceforge.net/

Michiel

Op 24-aug-2006, om 13:29 heeft JAG CHAN het volgende geschreven:

 Friends, I am trying to learn Python.
 It will be of great help to me if you let me know which one would  
 be best
 editor for learning Python.
 Plese note that I would like to have multiplatform editor which  
 will be
 useful for both LInux and Windows XP.
 Thanks.
 -- 
 http://mail.python.org/mailman/listinfo/python-list

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


python

2006-08-24 Thread [EMAIL PROTECTED]
Regards,
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


Pygame, mouse events and threads

2006-08-24 Thread jedi200581
Hi,

  I'm trying to retreive mouse event in a python thread using pygame.
It's not working and I don't know why! Here is the code:

snippet on

import pygame, sys, os, threading
from pygame.locals import *
from threading import *

class Display(Thread) :
  Class managing display
  def __init__(self, xRes = 640, yRes = 480):
Thread.__init__(self)
#initializing display
self._xRes = xRes
self._yRes = yRes
pygame.display.init()
self._window = pygame.display.set_mode((xRes, yRes))
pygame.display.set_caption('Display')
self._screen = pygame.display.get_surface()
pygame.display.flip()

self._log = []
  def input(self, event):
if event.type == KEYDOWN:
  sys.exit(0)
else:
  print event
  def run(self):
print starting event handling thread
i = 0
while True:
  self.input(pygame.event.wait())

disp = Display()
disp.start()

snippet off

When I put the content of the run and input functions in the main
thread, it's working, why not in the thread?

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


setuid root

2006-08-24 Thread Tiago Simões Batista
Hello all

I have a situation that requires that a python script, that is
run from a webpage (via php exec()) must be run with root privileges.

The sysadmin already set the setuid bit on the script, but it
still fails when it tries to write to any file that only root has
write access to.

I read somewhere that any scripts that start with #! will no
honour the setuid bit...

I also tried os.setuid(0), with the setuid bit on, but this call
failed.

I am now out of ideas :(

Any sugestions?

Tiago



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


Re: python

2006-08-24 Thread utabintarbo

[EMAIL PROTECTED] wrote:
 Regards,
 [EMAIL PROTECTED]

Thanks!



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


Re: python

2006-08-24 Thread Michiel Sikma

Op 24-aug-2006, om 14:22 heeft utabintarbo het volgende geschreven:


 [EMAIL PROTECTED] wrote:
 Regards,
 [EMAIL PROTECTED]

 Thanks!

 

You're welcome.

Signed, Anonymous
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best Editor

2006-08-24 Thread Neil Cerutti
On 2006-08-24, JAG CHAN [EMAIL PROTECTED] wrote:
 Friends, I am trying to learn Python. It will be of great help
 to me if you let me know which one would be best editor for
 learning Python. Plese note that I would like to have
 multiplatform editor which will be useful for both LInux and
 Windows XP.

Start with IDLE, which will likely be available everywhere you
use Python. The full instructions for using IDLE take up about
two pages of text, which means it's lightweight, and it comes
preconfigured with good Python integration.

Learning a highly portable, industrial-strength program like Vim
or emacs is something I highly recommend, but it's not
necessarily a productive thing to do that at the same time you're
learning Python.

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


Re: Pygame, mouse events and threads

2006-08-24 Thread Ben Sizer
[EMAIL PROTECTED] wrote:

 When I put the content of the run and input functions in the main
 thread, it's working, why not in the thread?

Because event handling needs to be done in the main thread. So does
rendering. This is a limitation of the underlying system.

As a general rule, try to keep all your PyGame functions in the main
thread and push your other processing into background threads, if you
really need them.

-- 
Ben Sizer

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


Re: Pygame, mouse events and threads

2006-08-24 Thread jedi200581

Ben Sizer wrote:
 [EMAIL PROTECTED] wrote:

  When I put the content of the run and input functions in the main
  thread, it's working, why not in the thread?

 Because event handling needs to be done in the main thread. So does
 rendering. This is a limitation of the underlying system.

 As a general rule, try to keep all your PyGame functions in the main
 thread and push your other processing into background threads, if you
 really need them.

 --
 Ben Sizer

Well, that is a limitation... And is it something that will be fixed or
something that is inherent to pygame and not fixable?

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


Re: Python and STL efficiency

2006-08-24 Thread Neil Cerutti
On 2006-08-23, Mc Osten [EMAIL PROTECTED] wrote:
 Ray [EMAIL PROTECTED] wrote:
 Great to know that my model of how the world works is still
 correct! (at least in relation to Python and C++!) :)

 So please explain my results. I loop the same number of times.

Those of you experiencing a temporary obsession with this topic
are encouraged to study The Great Language Shootout, until the
obsession goes away. ;)

Your time might not be totally wasted; an opportunity to improve
the Python solutions may present itself.

http://shootout.alioth.debian.org/

-- 
Neil Cerutti
Strangely, in slow motion replay, the ball seemed to hang in the
air for even longer. --David Acfield
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: setuid root

2006-08-24 Thread Ove Svensson
Tiago Simões Batista [EMAIL PROTECTED] writes:


 Any sugestions?


http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html
-- 
http://mail.python.org/mailman/listinfo/python-list


[ANN]UliPad 3.3 is released

2006-08-24 Thread limodou
What's it?


It's an Editor based on wxPython. NewEdit is the old name, and UliPad
is the new name. UliPad uses Mixin and Plugin technique as its
architecture. Most of its classes can be extended via mixin and plugin
components, and finally become an integrity class at
creating the instance. So UliPad is very dynamic. You can write the
new features in new files, and hardly need to modify the existing
code. And if you want to extend the existing classes, you could write
mixins and plugins, and this will be bound to the target class that I
call Slot Class. This technique will make the changes centralized
and easily managed.

What are its features?


  *  Cross platform
o   based on wxPython, so it can run anywhere that wxPython
works, such as: Windows, Linux.
o   Unicode support.

  *  Most features of wxStyledTextCtrl(Scintilla)
o   Syntax highlighting, support Python, c/c++, html, plain
text, perl, ruby, css, javascript
o   Folding
o   Brace Matching
o   ...

  *  Extended selection
o   Extended word selection -- You can press
Ctrl+MouseDoubleClick to select a word including '.'
o   Matched selection -- Select text in quoted chars like:
(), [], {}, '', .
  *  Other editing extension
o   Duplicating text -- Just like Vim Ctrl+V, Ctrl+P, and
more. You can duplicate above or below char, word, line
o   Quoting text -- Add some quoted chars before and after
selected text, just as: , '', (), [], {}, and
o   Text convertion and view -- python - html, reStructured
Text - html, textile - html, and you can output or view
o   Utf-8 encoding auto detect
o   Changing document encoding
oAuto backup
oLast session support -- It'll save all the filenames as
closed, and reopen the files as next started.
oSmart judge the indent char -- It'll auto guess the
indent char, and sets it.
oFinding in files
oBookmark support

  *  Python support
obuilt-in python interactive window based on ?PyShell,
support Unicode
o   Auto completion
o   Function syntax calltips
o   Run, run with argument, stop python source
o   Auto change current path
o   Python class browser
o   Indent pasting support(New)

  *  Code snippets
o  You can manage your code snippets with categories, and
each category can have many items. Every item will represent a code
snippet. You can insert an item just by double-clicking on it. It even
supports importing and exporting.

  *  Simple project support
o  Can create a special file _project, so every file and
folder under the folder which has the _project can be considered as a
whole project.

  *  Extension mechanism
o  Script -- You can write easy script to manipulate the all
resource of UliPad, just like: text conversion, etc.
o  Plugin -- Customized function. More complex but more
powerful. Can easily merge with UliPad, and can be managed via menu.
o  Shell command -- Add often used shell commands, and execute them.

  *  Ftp support
o  You can edit remote files through ftp. You can add,
rename, delete, upload, download file/directory.

  *  Multilanguage support
o  Currently supports two languages: English and Chinese,
which can be auto-detected.

  *  Shipped plugins(must be configed as used them before)
o  Document links -- Python documentation and wxPython documentation.
o  Many plugins can be found at UliPad wiki page.

  *  Shipped scripts
o  Many scripts can be found at UliPad wiki page.

  *  Wizard (New)
o  You can make your own wizard template. The wizard can
input user data, combine with template, and output the result. And
wizard also support code framework created. This feature will help you
improving coding efficiency.

  *  Direcotry Browser(New)
o  Browse multiple directories, and you can really add,
delete, rename directories and files. Double click will open the file
in Editor window.
o  Support Copy, Cut, and Paste.
o  Search in Directory

  *  AutoComPlete(acp)(New)
o  Suport user autocomplete file, it can help to input code
very helpful and functional. Just like EditPlus, but may be more
powerful.
o  Manually apply some acp files to current document

  *  Column Edit Mode(New)

Where to download it?


download lastest version 3.3:
http://wiki.woodpecker.org.cn/moin/UliPad?action=AttachFiledo=gettarget=UliPad_3.3.zip
also have windows installer:
http://wiki.woodpecker.org.cn/moin/UliPad?action=AttachFiledo=gettarget=UliPad3.3.exe
wiki: http://wiki.woodpecker.org.cn/moin/UliPad
svn: http://cvs.woodpecker.org.cn/svn/woodpecker/ulipad/trunk
maillist: http://groups.google.com/group/ulipad

If you have any problem as using UliPad, welcome to join the UliPad
maillist to discuss.

Hope fun!



-- 
I like python!
My 

Re: MS SQL Server: NT Authentication. Possible?

2006-08-24 Thread Dirk Hagemann
 http://msdn.microsoft.com/msdnmag/issues/05/09/SecurityBriefs/
 http://msdn2.microsoft.com/en-us/library/bsz5788z.aspx

Thanks for the links Tim! This really seems to go in the right
direction. Tomorrow I will talk to my colleague who takes care of the
webserver.

Dirk

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


Re: Python Syntax Highlighting Module

2006-08-24 Thread frikker
thank you! These will be very helpful.

I'm not necessarily creating an editor from scratch, but maybe an
editor that has some additional custom functionality.

Thanks again,
blaine


gene tani wrote:
 [EMAIL PROTECTED] wrote:
  Hello,
  I have an idea for a project which involves an editor that supports
  syntax highlighting.  This would be for any language, particularly php,
  html, css, etc.  I would like to write this program using python.  It
  would only make sense to base this upon existing open source code.  My
  question is there a python module or examples on how to write a code
  editor which supports modulated syntax highlighting?
 
  Thank you,
  Blaine

 just a *few* examples

 http://lfw.org/python/cedit

 http://mathieu.fenniak.net/formatting-a-simple-function-in-python/
 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/200638
 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442482

 http://effbot.python-hosting.com/browser/stuff/sandbox/pythondoc/

 http://qbnz.com/highlighter/index.php
 http://pudge.lesscode.org/

 also look at GNU / emacs:

 http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el.html
 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298

 http://www.danbala.com/python/lpy/lpy.py.html
 http://www.gnu.org/software/src-highlite/

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


Re: Taking data from a text file to parse html page

2006-08-24 Thread Larry Bates
DH wrote:
 Hi,
 
 I'm trying to strip the html and other useless junk from a html page..
 Id like to create something like an automated text editor, where it
 takes the keywords from a txt file and removes them from the html page
 (replace the words in the html page with blank space) I'm new to python
 and could use a little push in the right direction, any ideas on how to
 implement this?
 
 Thanks!
 
See Beautiful Soup: http://www.crummy.com/software/BeautifulSoup/
it will parse even badly formed HTML and allow you to extract/change
information as you wish.

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


Re: Python and STL efficiency

2006-08-24 Thread skip

Amanjit So on linux its a lot better than that, because - I think -
Amanjit ptmalloc is used which is based on dmalloc which is efficient
Amanjit for those small size allocs (which malloc() and free() were
Amanjit never designed for).

And which for Python has been further optimized in obmalloc.  Again, Python
wins. ;-)

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


Re: Accessing application data portably

2006-08-24 Thread Larry Bates
Tom E H wrote:
 Larry Bates wrote:
 Well that's great, but how do you access the ini file portably?
 From my original post:

 Then I use ConfigParser in my application...
 
 Thanks, but where in the directory structure do you put the ini file on
 different platforms?  Presumably you have to hard-code that into the source
 and then do operating system type detection?
 
 i.e. if I make my config parser:
 
 import ConfigParser
 config = ConfigParser.ConfigParser()
 config.read(filename)
 
 What do you use for filename on Windows?  What on Linux?  OSX? etc.  How do
 you detect which operating system you are running on?
 
 Tom
 
I almost always have the .ini configuration file live in the same
directory/folder as the program or sometimes in a subdirectory of
the install directory (which I reference relative to where the
program is run from).  Typically I install a default .ini file
via program installer (I like Inno Installer on Windows).  I also
make all my programs accept a -i configuration file path argument
when they are run so you can override the default .ini file on the
command line.

example:

myprog -i C:\aaa\bbb\myprog.ini

As a default I do config.read('myprog.ini') it always reads from
the current directory (which is where the program is installed).
To access a subdirectory of the current directory I do something
like:

p=os.path.join(os.getcwd(), 'configfiles')
config.read(p)

I haven't put anything on OSX but this works fine on Windows
and Linux and should work on OSX.

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


Re: hide python code !

2006-08-24 Thread Slawomir Nowaczyk
On Wed, 16 Aug 2006 18:35:37 -0700
enigmadude [EMAIL PROTECTED] wrote:

# Slawomir Nowaczyk wrote:
#  On Thu, 10 Aug 2006 17:35:27 -0700
#  enigmadude [EMAIL PROTECTED] wrote:
# 
#  # 2. I've never done this, but you might be able to encrypt or otherwise
#  # turn you modules into binary form, and then use a clever import
#  # hook.
# 
#  Please observe that whatever the clever import hook is, it actually
#  needs to know the way to *decrypt* the module (secret key or
#  whatever). It means that if somebody decompiles the importing code, he
#  can just as well decompile the hidden one.

Please do not top-post...

# I'm pretty sure that just because someone is familiar with the PGP
# sources, for example, doesn't mean that they have the necessary keys to
# access other people's data across the internet. Also, I'm pretty sure I
# know how a prison door lock works, but if I'm behind bars and don't
# have the key, I'm still screwed.
# 
# I believe the same things applies here. Just because you can see the
# import code, depending upon what it does, if it requires (for example)
# a key in order to decrypt the binary data before the modules can be
# loaded, then no matter how much you understand the import code, the
# data itself (that is the binary encrypted modules) is still useless to
# you.

Not really. The thing is, whatever data is actually required to
perform the decryption, *must* be available in the importing code...
as this code needs to -- by definition -- be able to decrypt the
binaries into a form understandable by the CPU. After all, the code is
supposed to actually work.

As far as your analogy goes, you *do* have a key to the prison door,
because you are *expected* to be able to let yourself out.

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

War doesn't determine who's right, war determines who's left.

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


Re: Record Audio Analysis

2006-08-24 Thread Frank LaFond
Jo Chase wrote:
 I would like to record audio from a mic and perform some basic analysis on 
 the audio wave patterns produced.  What would be the easiest way to 
 accomplish this in Python? 

Take a look at http://pymedia.org

I think it allows the features you want.

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


Re: Pygame, mouse events and threads

2006-08-24 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb:
 Ben Sizer wrote:
 [EMAIL PROTECTED] wrote:

 When I put the content of the run and input functions in the main
 thread, it's working, why not in the thread?
 Because event handling needs to be done in the main thread. So does
 rendering. This is a limitation of the underlying system.

 As a general rule, try to keep all your PyGame functions in the main
 thread and push your other processing into background threads, if you
 really need them.
 Well, that is a limitation... And is it something that will be fixed or
 something that is inherent to pygame and not fixable?

I guess it is part of the SDL pygame sits upon. And I fail to see where 
that is a limitation. There can't be multiple event loops - only one. 
And if it has to be the main thread, do whatever you wanted to do there, 
and whatever your main thread was supposed to do is run in a separate 
thread.


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


Is there an elegant way to dir() module from inside?

2006-08-24 Thread volcano
I am looking for a way to discover which classes a module contains from
inside. I am building a testing class that should, when instatntiated
within any module, locate certain classes within the containing module.
Words of wisdom? Anybody?

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


Leo 4.4.1 beta 4 released

2006-08-24 Thread Edward K. Ream
Leo 4.4.1 beta 4 is now available at:

http://sourceforge.net/project/showfiles.php?group_id=3458package_id=29106

Leo is a text editor, data organizer, project manager and much more. See:

http://webpages.charter.net/edreamleo/intro.html

The highlights of Leo 4.4.1:

- Leo outputs decorators correctly, provided that the decorator is not a Leo 
directive.
- A new colorizer plugin controlled by jEdit language description files.
- A new shadow files plugin that allows derived files not to have sentinel 
lines.
- Multiple editors in Leo's body pane.
- Search commands now support regex replace patterns: \1, \2, etc.
- Support for external debuggers: see 
http://webpages.charter.net/edreamleo/debuggers.html
- The scripting plugin now creates a Debug Script button.
- Several new commands including run-unit-test, python-help, 
toggle-invisibles,
  and scroll-outline-left/right.
- The help-for-command commands now contains information for almost all 
commands.
- A new shortcut_button plugin.

Quote of the month:
---
Thanks for creating the most useful and amazing application that
I've come across in years. I use Leo every day.

Links:
--
4.4.1:http://webpages.charter.net/edreamleo/new-4-4-1.html
4.4:  http://webpages.charter.net/edreamleo/new-4-4.html
Leo:  http://webpages.charter.net/edreamleo/front.html
Home: http://sourceforge.net/projects/leo/
Download: http://sourceforge.net/project/showfiles.php?group_id=3458
CVS:  http://leo.tigris.org/source/browse/leo/
Quotes:   http://webpages.charter.net/edreamleo/testimonials.html


Edward K. Ream   email:  [EMAIL PROTECTED]
Leo: http://webpages.charter.net/edreamleo/front.html



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


Re: Python Expert

2006-08-24 Thread Perseo
Hi again,

I must create a webpage with this service not a standalone software. Is
it correct, anyway? have you a little example to show me? Thanks for
your suggestions.

Frithiof Andreas Jensen wrote:
 Perseo [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi guys,
 
  we are looking for a python developer for a European project. This
  project is multilangual and free it is called EuroCv and it need a
  module for exporting data in PDF.

 A brute-force approach could be to sidestep PDF and design a
 template(s) in LaTex containing fields identified by strings. LaTeX
 can produce many formats, one of those is PDF.

 Then have your output module read the template, do a search  replace
 of the fields with values (remembering to quote the characters that
 LaTex will choke on and removing the codes for the blank fields) and
 write the finished LaTeX document to disk. (Maybe there are even
 templating modules in Python that will take care of this).

 Then compile the documents with latex, run the resulting *.dvi file
 through dvipdf and return a link to it. This is a compiler pattern.
 You need a naming scheme to identify your file(s) but the rest is
 pretty old.

 The Python application scons (a make replacement) can control the
 build process - in case that you are not on a unix box - one could
 have build application periodically looking for *.tex files and
 compile them into *pdf whenever one is deposited in the right place.
 Scons support distributed builds b.t.w.


  As web developer I try to create this
  module but It's too complicate for me. Check out the service
  www.eurocv.eu for more details. Contact us by Skype chat system our
  nick is eurocv.
 
  Thanks
 

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


Re: Concatenating arrays

2006-08-24 Thread Robert Kern
Sheldon wrote:
 Good day everyone,
 
 I would like to know if anyone has a fast and concise way of
 concatenating two 2D arrays of same dimensions?
 Whenever I try:
 
 a = concatenate(b,c)

That is not the correct signature.

   a = concatenate((b, c))

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco

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


Re: Is there an elegant way to dir() module from inside?

2006-08-24 Thread davelist

On Aug 24, 2006, at 10:18 AM, volcano wrote:

 I am looking for a way to discover which classes a module contains  
 from
 inside. I am building a testing class that should, when  
 instatntiated
 within any module, locate certain classes within the containing  
 module.
 Words of wisdom? Anybody?


Check out the inspect module.

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

Dave

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


Re: Taking data from a text file to parse html page

2006-08-24 Thread DH
Frederic,
Good points...

I have a plain text file containing the html and words that I want
removed(keywords) from the html file, after processing the html file it
would save it as a plain text file.

So the program would import the keywords, remove them from the html
file and save the html  file as something.txt.

I would post the data but it's secret. I can post an example:

index.html (html page)


divpemquot;Python has been an important part of Google since the
beginning, and remains so as the system grows and evolves.
quot;/em/p
p-- Peter Norvig, a class=reference



replace.txt (keywords)

div id=quote class=homepage-box

divpemquot;

quot;/em/p

p-- Peter Norvig, a class=reference



something.txt(file after editing)



Python has been an important part of Google since the beginning, and
remains so as the system grows and evolves.



Larry,

I've looked into using BeatifulSoup but came to the conculsion that my
idea would work better in the end.


Thanks for the help.


Anthra Norell wrote:
 DH,
   Could you be more specific describing what you have and what you want? 
 You are addressing people, many of whom are good at
 stripping useless junk once you tell them what 'useless junk' is.
   Also it helps to post some of you data that you need to process and a 
 sample of the same data as it should look once it is
 processed.

 Frederic

 - Original Message -
 From: DH [EMAIL PROTECTED]
 Newsgroups: comp.lang.python
 To: python-list@python.org
 Sent: Thursday, August 24, 2006 2:11 AM
 Subject: Taking data from a text file to parse html page


  Hi,
 
  I'm trying to strip the html and other useless junk from a html page..
  Id like to create something like an automated text editor, where it
  takes the keywords from a txt file and removes them from the html page
  (replace the words in the html page with blank space) I'm new to python
  and could use a little push in the right direction, any ideas on how to
  implement this?
 
  Thanks!
 
  --
  http://mail.python.org/mailman/listinfo/python-list

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


RE: Best Editor

2006-08-24 Thread Caolan
Title: Re: Best Editor






I like ActiveState's KOMODO 
editor. It is multilanguage compiler editor. Its not free but it is inexpensive 
for what it does, IMO. I believe they have a 30day free trial and a version for 
both platforms you mentioned.

-Caolan.


From: 
[EMAIL PROTECTED] on behalf of Michiel 
SikmaSent: Thu 8/24/2006 4:41 AMTo: JAG CHANCc: 
python-list@python.orgSubject: Re: Best Editor

I personally use Eclipse with PyDev. It is a cross-platform 
solutionbecause Eclipse is made with Java.http://www.eclipse.org/http://pydev.sourceforge.net/MichielOp 
24-aug-2006, om 13:29 heeft JAG CHAN het volgende geschreven: 
Friends, I am trying to learn Python. It will be of great help to me if 
you let me know which one would be best editor for 
learning Python. Plese note that I would like to have multiplatform 
editor which will be useful for both LInux and Windows 
XP. Thanks. -- 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: Python and STL efficiency

2006-08-24 Thread Mc Osten
Neil Cerutti [EMAIL PROTECTED] wrote:

 Those of you experiencing a temporary obsession with this topic
 are encouraged to study The Great Language Shootout, until the
 obsession goes away. ;)

I think that everybody knows GLS. However, when I have results different
from what I expected, I try to understand where I did the wrong
assumption.

However, a recent post kind of explains what the problem is.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and STL efficiency

2006-08-24 Thread Mc Osten
Neil Cerutti [EMAIL PROTECTED] wrote:

 Those of you experiencing a temporary obsession with this topic
 are encouraged to study The Great Language Shootout, until the
 obsession goes away. ;)

I think that everybody knows GLS. However, when I have results different
from what I expected, I try to understand where I did the wrong
assumption.

But a recent post kind of explains what the problem is.

-- 
blog:  http://www.akropolix.net/rik0/blogs | Uccidete i filosofi,
site:  http://www.akropolix.net/rik0/  | tenetevi riso e
forum: http://www.akropolix.net/forum/ | bacchette per voi.
-- 
http://mail.python.org/mailman/listinfo/python-list


Newbie question about numpy

2006-08-24 Thread Paul Johnston
Hi I'm new to python and have just been taking a look at what it has
to offer.
I noted the lack of matrices so installed numpy
I know the documentation is chargable so wanted a quick play to see if
I should buy it 
However 

_
from numpy  import *

a = array([[1,2,3],[4,5,6],[1,2,3]])
b = array([[1,3,6],[2,5,1],[1,1,1]])

print 'a = \n',a,\n
print 'b = \n',b,\n

print 'a has shape ', a.shape
print 'b has shape ', b.shape, \n

print a * b is \n, a * b
_

Gives me 
_
a =
[[1 2 3]
 [4 5 6]
 [1 2 3]] 

b =
[[1 3 6]
 [2 5 1]
 [1 1 1]] 

a has shape  (3, 3)
b has shape  (3, 3) 

a * b is
[[ 1  6 18]
 [ 8 25  6]
 [ 1  2  3]]
_


I know its a long time since my degree but that's not matrix
multiplication is it ?

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


Re: Best Editor

2006-08-24 Thread JAG CHAN
Neil Cerutti [EMAIL PROTECTED] wrote in 
news:[EMAIL PROTECTED]:


 Start with IDLE, which will likely be available everywhere you
 use Python. The full instructions for using IDLE take up about
 two pages of text, which means it's lightweight, and it comes
 preconfigured with good Python integration.
 
 Learning a highly portable, industrial-strength program like Vim
 or emacs is something I highly recommend, but it's not
 necessarily a productive thing to do that at the same time you're
 learning Python.
 

Thanks friends.
As you say, as a beginner will start with IDLE.
-- 
http://mail.python.org/mailman/listinfo/python-list


libcurses.so installing Python 2.4.3

2006-08-24 Thread dmulcahy
Folks,

I am trying to build the binaries for Python 2.4.3 on a Sun E6900
running SPARC Solaris 9 and using gcc 3.4.2.

When the makefile tries to build the _curses extension it fails with a
symbol referencing error on mvwgetnstr, which it appears should exist
in libcurses.so.  For some reason it seems this function does not exist
in the version of libcurses.so shipped with Solaris 9.

Will I find it in some other library on Solaris or do I need to
download a different version of libcurses.so?

Any suggestions would be welcome.

Thanks,
Damien.

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


Re: Taking data from a text file to parse html page

2006-08-24 Thread Roberto Bonvallet
DH wrote:
  I'm trying to strip the html and other useless junk from a html page..
  Id like to create something like an automated text editor, where it
  takes the keywords from a txt file and removes them from the html page
  (replace the words in the html page with blank space)
[...]
 I've looked into using BeatifulSoup but came to the conculsion that my
 idea would work better in the end.

You could use BeautifulSoup anyway for the junk-removal part and then do
your magic.  Even if it is not exactly what you want, it is a good idea to
try to reuse modules that are good at what they do.

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


Re: setuid root

2006-08-24 Thread Patrick Useldinger
Tiago Simões Batista wrote:
 The sysadmin already set the setuid bit on the script, but it
 still fails when it tries to write to any file that only root has
 write access to.

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


telnetlib thread-safe?

2006-08-24 Thread Jerry
Can anyone tell me if the telnetlib module is thread-safe?  I've done
some looking, but don't know, and I don't know how to tell from reading
the module code.

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


Re: Taking data from a text file to parse html page

2006-08-24 Thread Fredrik Lundh
DH wrote:

 I have a plain text file containing the html and words that I want
 removed(keywords) from the html file, after processing the html file it
 would save it as a plain text file.
 
 So the program would import the keywords, remove them from the html
 file and save the html  file as something.txt.
 
 I would post the data but it's secret. I can post an example:
 
 index.html (html page)
 
 
 divpemquot;Python has been an important part of Google since the
 beginning, and remains so as the system grows and evolves.
 quot;/em/p
 p-- Peter Norvig, a class=reference
 
  
 replace.txt (keywords)
 
 div id=quote class=homepage-box
 
 divpemquot;
 
 quot;/em/p
 
 p-- Peter Norvig, a class=reference
 
 
 
 something.txt(file after editing)
 
 
 
 Python has been an important part of Google since the beginning, and
 remains so as the system grows and evolves.
 

reading and writing files is described in the tutorial; see

 http://pytut.infogami.com/node9.html

(scroll down to Reading and Writing Files)

to do the replacement, you can use repeated calls to the replace method

 http://pyref.infogami.com/str.replace

but that may cause problems if the replacement text contains things that 
should be replaced.  for an efficient way to do a parallel replace, see:

 http://effbot.org/zone/python-replace.htm#multiple


/F

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


Re: Newbie question about numpy

2006-08-24 Thread Gabriel Genellina

At Thursday 24/8/2006 12:38, Paul Johnston wrote:


from numpy  import *

a = array([[1,2,3],[4,5,6],[1,2,3]])
b = array([[1,3,6],[2,5,1],[1,1,1]])
print a * b is \n, a * b

I know its a long time since my degree but that's not matrix
multiplication is it ?


No, it's plain element-by-element multiplication.
You want matrixmultiply: 
http://numpy.scipy.org/numpydoc/numpy-9.html#pgfId-36542




Gabriel Genellina
Softlab SRL 






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


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

Re: Is there an elegant way to dir() module from inside?

2006-08-24 Thread Sion Arrowsmith
volcano [EMAIL PROTECTED] wrote:
I am looking for a way to discover which classes a module contains from
inside. I am building a testing class that should, when instatntiated
within any module, locate certain classes within the containing module.

globals().keys()

-- 
\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: sum and strings

2006-08-24 Thread Tim Chase
 Just because something is slow or sub-optimal doesn't mean it 
 should be an error.
 
 that's not an error because it would be slow or sub-optimal to add 
 custom objects, that's an error because you don't understand how sum 
 works.
 
 (hint: sum != reduce)

No, clearly sum!=reduce...no dispute there...

so we go ahead and get the sum([q1,q2]) working by specifying a 
starting value sum([q1,q2], Q()):

  class Q(object):
... def __init__(self, n=0, i=0,j=0,k=0):
... self.n = n
... self.i = i
... self.j = j
... self.k = k
... def __add__(self, other):
... return Q(self.n+other.n,
... self.i+other.i,
... self.j+other.j,
... self.k+other.k)
... def __repr__(self):
... return Q(%i,%i,%i,%i) % (
... self.n,
... self.i,
... self.j,
... self.k)
...
  q1 = Q(1,2,3,5)
  q2 = Q(7,11,13,17)
  q1+q2
Q(8,13,16,22)
  sum([q1,q2])
Traceback (most recent call last):
   File stdin, line 1, in ?
TypeError: unsupported operand type(s) for +: 'int' and 'Q'
  sum([q1,q2], Q())
Q(8,13,16,22)


Thus, sum seems to work just fine for objects containing an 
__add__ method.  However, strings contain an __add__ method.

  hasattr(, __add__)
True

yet, using the same pattern...

  sum([hello, world], )
Traceback (most recent call last):
   File stdin, line 1, in ?
TypeError: sum() can't sum strings [use ''.join(seq) instead]


Which seems like an arbitrary prejudice against strings...flying 
in the face of python's duck-typing.  If it has an __add__ 
method, duck-typing says you should be able to provide a starting 
place and a sequence of things to add to it, and get the sum.

However, a new sum2() function can be created...

  def sum2(seq, start=0):
... for item in seq:
... start += item
... return start
...

which does what one would expect the definition of sum() should 
be doing behind the scenes.

  # generate the expected error, same as above
  sum2([q1,q2])
Traceback (most recent call last):
   File stdin, line 1, in ?
   File stdin, line 3, in sum2
TypeError: unsupported operand type(s) for +=: 'int' and 'Q'
  # employ the same solution of a proper starting point
  sum2([q1,q2], Q())
Q(8,13,16,22)
  # do the same thing for strings
  sum2([hello, world], )
'helloworld'

and sum2() works just like sum(), only it happily takes strings 
without prejudice.

 From help(sum):
Returns the sum of a sequence of numbers (NOT strings) plus the 
value of parameter 'start'.  When the sequence is empty, returns 
start.

It would be as strange as if enumerate() didn't take strings, and 
instead forced you to use some other method for enumerating strings:

  for i,c in enumerate(hello): print i,c
Traceback (most recent call last):
   File stdin, line 1, in ?
TypeError: enumerate() can't enumerate strings [use 
hello.enumerator() instead]

Why the arbitrary breaking of duck-typing for strings in sum()? 
Why make them second-class citizens?

The interpreter is clearly smart enough to recognize when the 
condition occurs such that it can throw the error...thus, why not 
add a few more smarts and have it simply translate it into 
start+''.join(sequence) to maintain predictable behavior 
according to duck-typing?

-tkc




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


Re: Newbie question about numpy

2006-08-24 Thread Robert Kern
Paul Johnston wrote:
 Hi I'm new to python and have just been taking a look at what it has
 to offer.
 I noted the lack of matrices so installed numpy

You will want to ask numpy questions on the numpy list.

   http://www.scipy.org/Mailing_Lists

numpy arrays are not matrices; they are arrays. All of the arithmetic 
operations 
on them are done element-wise. The dot() function will do matrix multiplication.

There is a matrix class (with the constructor numpy.mat(some_array)) that 
derives from arrays and overrides the * operator to do matrix multiplication if 
that is what you want. I prefer using dot() on regular arrays, myself.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco

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


Re: Newbie question about numpy

2006-08-24 Thread Avell Diroll
Paul Johnston wrote:
(snip)
 I noted the lack of matrices so installed numpy
(snip)
 _
 from numpy  import *
 
 a = array([[1,2,3],[4,5,6],[1,2,3]])
 b = array([[1,3,6],[2,5,1],[1,1,1]])
(snip)
 print a * b is \n, a * b
 _
(snip)
 a * b is
 [[ 1  6 18]
  [ 8 25  6]
  [ 1  2  3]]
 _
 
 
 I know its a long time since my degree but that's not matrix
 multiplication is it ?

You consider that a and b are matrices, but for the python interpreter
they are arrays so a*b returns the multiplication of 2 arrays.

For matrices multiplication, you could get a hint by typing the
following in the interpreter :

 import numpy
 dir(numpy)
 help(numpy.matrixmultiply)#type q to exit

which could make you want to try the following code :

 from numpy  import *
 a = array([[1,2,3],[4,5,6],[1,2,3]])
 b = array([[1,3,6],[2,5,1],[1,1,1]])
 print matrixmultiply(a,b)

...
output :
...

array([[ 8, 16, 11],
   [20, 43, 35],
   [ 8, 16, 11]])
...

HIH,
avell

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


Re: telnetlib thread-safe?

2006-08-24 Thread Fredrik Lundh
Jerry wrote:

 Can anyone tell me if the telnetlib module is thread-safe?

define thread-safe.  how do you plan to use it?

/F

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


String formatting with nested dictionaries

2006-08-24 Thread [EMAIL PROTECTED]
I've got a bit of code which has a dictionary nested within another
dictionary.  I'm trying to print out specific values from the inner
dict in a formatted string and I'm running into a roadblock.  I can't
figure out how to get a value from the inner dict into the string.  To
make this even more complicated this is being compiled into a large
string including other parts of the outer dict.

mydict = {'inner_dict':{'Value1':1, 'Value2':2}, 'foo':'bar',
'Hammer':'nails'}

print foo is set to %(foo)s - Value One is: %(inner_dict['Value1'])s
and Value Two is: %(inner_dict['Value2'])s -- Hammers are used to pound
in %(Hammer)s % mydict

The above fails looking for a key named 'inner_dict['Value1']' which
doesn't exist.

I've looked through the docs and google and can't find anything
relating to this.

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


Re: sum and strings

2006-08-24 Thread Fredrik Lundh
Tim Chase wrote:

 The interpreter is clearly smart enough to recognize when the 
 condition occurs such that it can throw the error...thus, why not 
 add a few more smarts and have it simply translate it into 
 start+''.join(sequence) to maintain predictable behavior 
 according to duck-typing?

join doesn't use __add__ at all, so I'm not sure in what sense that 
would be more predictable.  I'm probably missing something, but I cannot 
think of any core method that uses a radically different algorithm based 
on the *type* of one argument.

besides, in all dictionaries I've consulted, the word sum means 
adding numbers.  are you sure it wouldn't be more predictable if sum 
converted strings to numbers ?

(after all, questions about type errors like cannot concatenate 'str' 
and 'int' objects and unsupported operand type(s) for +: 'int' and 
'str' are a *lot* more common than questions about sum() on string lists.)

/F

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


Re: Newbie question about numpy

2006-08-24 Thread Robert Kern
Avell Diroll wrote:

 For matrices multiplication, you could get a hint by typing the
 following in the interpreter :
 
 import numpy
 dir(numpy)
 help(numpy.matrixmultiply)#type q to exit

Note that the name matrixmultiply() has been deprecated in favor of dot() for 
many, many years now even in Numeric, numpy's predecessor. It has finally been 
removed in recent versions of numpy.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco

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


Re: sum and strings

2006-08-24 Thread Gabriel Genellina

At Thursday 24/8/2006 13:12, Tim Chase wrote:


The interpreter is clearly smart enough to recognize when the
condition occurs such that it can throw the error...thus, why not
add a few more smarts and have it simply translate it into
start+''.join(sequence) to maintain predictable behavior
according to duck-typing?


sequences don't have to be homogeneous, and iterators cant go back.
But let GvR say that in his own words: 
http://mail.python.org/pipermail/python-dev/2003-April/034854.html




Gabriel Genellina
Softlab SRL 






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


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

Re: String formatting with nested dictionaries

2006-08-24 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb:
 I've got a bit of code which has a dictionary nested within another
 dictionary.  I'm trying to print out specific values from the inner
 dict in a formatted string and I'm running into a roadblock.  I can't
 figure out how to get a value from the inner dict into the string.  To
 make this even more complicated this is being compiled into a large
 string including other parts of the outer dict.
 
 mydict = {'inner_dict':{'Value1':1, 'Value2':2}, 'foo':'bar',
 'Hammer':'nails'}
 
 print foo is set to %(foo)s - Value One is: %(inner_dict['Value1'])s
 and Value Two is: %(inner_dict['Value2'])s -- Hammers are used to pound
 in %(Hammer)s % mydict
 
 The above fails looking for a key named 'inner_dict['Value1']' which
 doesn't exist.
 
 I've looked through the docs and google and can't find anything
 relating to this.

Because it is not supported. You can only use one level of keys, and it 
must be strings. So you have to do it like this:


print foo is set to %(foo)s - Value One is: %(inner_dict['Value1'])s 
and Value Two is: %(inner_dict['Value2'])s -- Hammers are used to 
poundin %(Hammer)s % dict(Hammer=mydict['Hammer'], 
Value1=mydict[inner_dict][Value1], 
Value2=mydict[inner_dict][Value2])


Diez

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


Re: Best Editor

2006-08-24 Thread abisen
Wow I like the sound of Learning a highly portable,
industrial-strength program like Vim or emacs is something I highly
recommend. I use Aquamacs (it's emacs with Mac OS-X Interface) and
emacs on other platform. It works great for me.


Neil Cerutti wrote:
 On 2006-08-24, JAG CHAN [EMAIL PROTECTED] wrote:
  Friends, I am trying to learn Python. It will be of great help
  to me if you let me know which one would be best editor for
  learning Python. Plese note that I would like to have
  multiplatform editor which will be useful for both LInux and
  Windows XP.

 Start with IDLE, which will likely be available everywhere you
 use Python. The full instructions for using IDLE take up about
 two pages of text, which means it's lightweight, and it comes
 preconfigured with good Python integration.

 Learning a highly portable, industrial-strength program like Vim
 or emacs is something I highly recommend, but it's not
 necessarily a productive thing to do that at the same time you're
 learning Python.
 
 -- 
 Neil Cerutti

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


Re: smtplib needs me to put from/to headers in the message?

2006-08-24 Thread Carl J. Van Arsdall
Dennis Lee Bieber wrote:
 On Wed, 23 Aug 2006 20:23:57 +, Tobiah [EMAIL PROTECTED] declaimed
 the following in comp.lang.python:

   
 Thank you for the valuable clarification, and the pointers.
 I will look into the RFC's.  I wonder though, whether that
 will solve my main question, which is why the python.org
 example mandates that I specify 'from' and 'to' twice.

 

   Though it might be useful to extend the library with an optional
 parameter that specifies parse message for addresses to use...
   

I actually agree with this, not to say that it wouldn't be difficult to 
write that function, but I think it would be a definite nicety. 

I've always thought that the best way to do it would be to construct the 
message in its entirety, this would include to, from, etc.  Then 
whatever smtp library is available simply takes that message and a 
server and handles the rest.  I don't think that the current 
functionality should be stripped out or anything, but that this other 
interface exist for a much more intuitive emailing system.

-carl



-- 

Carl J. Van Arsdall
[EMAIL PROTECTED]
Build and Release
MontaVista Software

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


Re: String formatting with nested dictionaries

2006-08-24 Thread Gabriel Genellina

At Thursday 24/8/2006 13:22, [EMAIL PROTECTED] wrote:


I've got a bit of code which has a dictionary nested within another
dictionary.  I'm trying to print out specific values from the inner
dict in a formatted string and I'm running into a roadblock.  I can't
figure out how to get a value from the inner dict into the string.  To
make this even more complicated this is being compiled into a large
string including other parts of the outer dict.

mydict = {'inner_dict':{'Value1':1, 'Value2':2}, 'foo':'bar',
'Hammer':'nails'}

print foo is set to %(foo)s - Value One is: %(inner_dict['Value1'])s
and Value Two is: %(inner_dict['Value2'])s -- Hammers are used to pound
in %(Hammer)s % mydict

The above fails looking for a key named 'inner_dict['Value1']' which
doesn't exist.


I can think of two ways:

a) Flatten your dictionary. That is, move the contents of inner_dict 
onto the outer dict:

mydict.update(mydict['inner_dict'])
Then use single names for interpolation

b) Do the interpolation in two steps.

template = foo is set to %(foo)s - Value One is: %(Value1)s
and Value Two is: %(Value2)s -- Hammers are used to pound
in %(Hammer)s
output = template % mydict['inner_dict']
output = output % mydict

Both methods assume that the inner dict takes precedence in case of 
name clashes; reverse the order if you want the opposite.



Gabriel Genellina
Softlab SRL 






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


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

Matrice Multiplication Problem

2006-08-24 Thread mclaugb
I want to multiply two arrays:  a matrice and the conjugate of its 
transpose.  Then i wish to invert the resulting matrix.

In Matlab, the statement is :  Z= inv(M .' * M)

To implement in python, I simply cannot get this to work.  Here is my code:

from numpy import *
import scipy as Sci
from scipy.linalg import lu
m=array([[4,6+7j],[3+3j,7],[2+2j,4-7j]])
z=m.conj().transpose()
q=z*m


Traceback (most recent call last):
  File C:\Program Files\ActiveState Komodo 
3.5\lib\support\dbgp\pythonlib\dbgp\client.py, line 3241, in runcode
locals = self.frame.f_locals)
  File C:\Program Files\ActiveState Komodo 
3.5\lib\support\dbgp\pythonlib\dbgp\client.py, line 1583, in runcode
h_exec(code, globals=globals, locals=locals, module=module)
  File C:\Program Files\ActiveState Komodo 
3.5\lib\support\dbgp\pythonlib\dbgp\client.py, line 520, in __init__
exec code in globals, locals
  File console, line 0, in __main__
ValueError: index objects are not broadcastable to a single shape


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


Re: Matrice Multiplication Problem

2006-08-24 Thread Robert Kern
mclaugb wrote:
 I want to multiply two arrays:  a matrice and the conjugate of its 
 transpose.  Then i wish to invert the resulting matrix.

You will want to ask numpy questions on the numpy mailing list.

   http://www.scipy.org/Mailing_Lists

 In Matlab, the statement is :  Z= inv(M .' * M)
 
 To implement in python, I simply cannot get this to work.  Here is my code:
 
 from numpy import *
 import scipy as Sci
 from scipy.linalg import lu
 m=array([[4,6+7j],[3+3j,7],[2+2j,4-7j]])
 z=m.conj().transpose()
 q=z*m

numpy arrays are not matrices. * performs elementwise multiplication. Use 
numpy.dot(z, m).

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth.
   -- Umberto Eco

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


array tofile to a socket?

2006-08-24 Thread KraftDiner
Can pythons array.tofile method be used for a TCP/IP Socket?
ie can the socket be a file object?

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


Re: sum and strings

2006-08-24 Thread Fredrik Lundh
Gabriel Genellina wrote:

 sequences don't have to be homogeneous, and iterators cant go back.
 But let GvR say that in his own words: 
 http://mail.python.org/pipermail/python-dev/2003-April/034854.html

you could of course dispatch on the type of the second argument (the 
start value), but that'd be at least as silly.  here's the relevant 
pronouncement:

   http://mail.python.org/pipermail/python-dev/2003-April/034853.html

and here's an elaboration by the martellibot:

   http://mail.python.org/pipermail/python-dev/2003-April/034855.html

(and note that the python-dev consensus is that sum is for numbers and 
join is for strings.  anyone who cares about writing readable code knows 
that names matter; different things should have different names.)

(I still think a join built-in would be nice, though.  but anyone who 
argues that join should support numbers too will be whacked with a 
great big halibut.)

/F

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


Re: array tofile to a socket?

2006-08-24 Thread Gabriel Genellina

At Thursday 24/8/2006 14:08, KraftDiner wrote:


Can pythons array.tofile method be used for a TCP/IP Socket?
ie can the socket be a file object?


I've never tried, but usually any object with a write() method works 
fine in these cases.




Gabriel Genellina
Softlab SRL 






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


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

lambda

2006-08-24 Thread fegge
what is a lambda expression?

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


Re: array tofile to a socket?

2006-08-24 Thread Gabriel Genellina

At Thursday 24/8/2006 14:08, KraftDiner wrote:


Can pythons array.tofile method be used for a TCP/IP Socket?
ie can the socket be a file object?


I've never tried, but usually any object with a write() method works 
fine in these cases.




Gabriel Genellina
Softlab SRL 






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


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

Re: lambda

2006-08-24 Thread Fredrik Lundh
fegge wrote:

 what is a lambda expression?

that's explained in the documentation, of course; see e.g.

 http://pyref.infogami.com/lambda

/F

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


Re: lambda

2006-08-24 Thread Larry Bates
fegge wrote:
 what is a lambda expression?
 
You really should try Google first (python lambda):

http://www.secnetix.de/~olli/Python/lambda_functions.hawk
http://diveintopython.org/power_of_introspection/lambda_functions.html

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


Re: lambda

2006-08-24 Thread Laszlo Nagy

 what is a lambda expression?
labmda is a reserved word and AFAIK it is an operatior.
By using lamba, you can create an anonymous function. That is, a 
function without name.

For example, doing

def create_adder(amount):
def adder(x):
   return x + amount
return adder


is equvalent to:

def create_adder(amount):
   return lambda x : x + amount

In the former case:

  f1 = create_adder(4)
 f1
function adder at 0x00BE6930
  f1(2)
6

In the later case:

  f2 = create_adder(4)
  f2
function lambda at 0x00BE66F0
  f2(2)
6

For example, if you want create a new list by adding 4 to the elements 
of another list:

  another = [1,2,3,4,5]
  newlist = map( lambda x: x+4 , another)
  newlist
[5, 6, 7, 8, 9]

Best,

   Laszlo

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


Re: Taking data from a text file to parse html page

2006-08-24 Thread DH
 I found this
http://groups.google.com/group/comp.lang.python/browse_thread/thread/d1bda6ebcfb060f9/ad0ac6b1ac8cff51?lnk=gstq=replace+text+filernum=8#ad0ac6b1ac8cff51

Credit Jeremy Moles
---

finds = ({, }, (, ))
lines = file(foo.txt, r).readlines()

for line in lines:
for find in finds:
if find in line:
line.replace(find, )

print lines

---

I want something like
---

finds = file(replace.txt)
lines = file(foo.txt, r).readlines()

for line in lines:
for find in finds:
if find in line:
line.replace(find, )

print lines

---



Fredrik Lundh wrote:
 DH wrote:

  I have a plain text file containing the html and words that I want
  removed(keywords) from the html file, after processing the html file it
  would save it as a plain text file.
 
  So the program would import the keywords, remove them from the html
  file and save the html  file as something.txt.
 
  I would post the data but it's secret. I can post an example:
 
  index.html (html page)
 
  
  divpemquot;Python has been an important part of Google since the
  beginning, and remains so as the system grows and evolves.
  quot;/em/p
  p-- Peter Norvig, a class=reference
  
 
  replace.txt (keywords)
  
  div id=quote class=homepage-box
 
  divpemquot;
 
  quot;/em/p
 
  p-- Peter Norvig, a class=reference
 
  
 
  something.txt(file after editing)
 
  
 
  Python has been an important part of Google since the beginning, and
  remains so as the system grows and evolves.
  

 reading and writing files is described in the tutorial; see

  http://pytut.infogami.com/node9.html

 (scroll down to Reading and Writing Files)

 to do the replacement, you can use repeated calls to the replace method

  http://pyref.infogami.com/str.replace

 but that may cause problems if the replacement text contains things that
 should be replaced.  for an efficient way to do a parallel replace, see:

  http://effbot.org/zone/python-replace.htm#multiple
 
 
 /F

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


Re: String formatting with nested dictionaries

2006-08-24 Thread [EMAIL PROTECTED]

Gabriel Genellina wrote:
 At Thursday 24/8/2006 13:22, [EMAIL PROTECTED] wrote:

 I've got a bit of code which has a dictionary nested within another
 dictionary.  I'm trying to print out specific values from the inner
 dict in a formatted string and I'm running into a roadblock.  I can't
 figure out how to get a value from the inner dict into the string.  To
 make this even more complicated this is being compiled into a large
 string including other parts of the outer dict.
 
 mydict = {'inner_dict':{'Value1':1, 'Value2':2}, 'foo':'bar',
 'Hammer':'nails'}
 
 print foo is set to %(foo)s - Value One is: %(inner_dict['Value1'])s
 and Value Two is: %(inner_dict['Value2'])s -- Hammers are used to pound
 in %(Hammer)s % mydict
 
 The above fails looking for a key named 'inner_dict['Value1']' which
 doesn't exist.

 I can think of two ways:

 a) Flatten your dictionary. That is, move the contents of inner_dict
 onto the outer dict:
 mydict.update(mydict['inner_dict'])
 Then use single names for interpolation

 b) Do the interpolation in two steps.

 template = foo is set to %(foo)s - Value One is: %(Value1)s
 and Value Two is: %(Value2)s -- Hammers are used to pound
 in %(Hammer)s
 output = template % mydict['inner_dict']
 output = output % mydict

 Both methods assume that the inner dict takes precedence in case of
 name clashes; reverse the order if you want the opposite.


 Gabriel Genellina
 Softlab SRL


Thanks,  I started going with a) only doing it the long way.
(mydict['Value1'] = mydict['inner_dict']['Value1'])  mydict.update() is
*much* simpler and less prone to errors too.

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


Re: telnetlib thread-safe?

2006-08-24 Thread Jerry
Fredrik Lundh wrote:
 define thread-safe.  how do you plan to use it?

I would like to write a program that spawns ~10 threads.  Each thread
would get a host to connect to from a Queue object and run then do it's
thing (i.e. connecting to the host, running some commands, returning
back a success or fail based on the results).

I just want to make sure that telnetlib is safe for this.

--
Jerry

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


Python chess

2006-08-24 Thread Paolo Pantaleo
Well Python is not a good language for writing a chess engine (even if
a chess engine exists:
http://www.kolumbus.fi/jyrki.alakuijala/pychess.html), but it could be
grat for chess interfaces, for drawing boards, and similar things. I
foudn out a library for these things
(http://www.alcyone.com/software/chess/). Does anyone konw about more
chess related modules?

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


Re: What do you want in a new web framework?

2006-08-24 Thread Cliff Wells
On Thu, 2006-08-24 at 04:28 -0700, Paul Boddie wrote:
 Cliff Wells wrote:
  On Thu, 2006-08-24 at 04:04 +, Tim Roberts wrote:
   Cliff Wells [EMAIL PROTECTED] wrote:
   
   But there are interesting things in Ruby (and Ruby 2 should take care of
   lots of warts Ruby 1.8 has) that Python could learn from.  All-in-all,
   Ruby is mostly as good as Python in most ways and better than Python in
   a couple key ways.
 
 The big difference between Ruby and Python is the lifecycle phase that
 the languages/systems are in: Ruby arguably has room for a lot of basic
 improvements in the architecture of the virtual machine and presumably
 has a list of must add features that cover gaping holes with respect
 to certain audiences [1], whereas Python has been around for ages and
 has covered most of the critical gaps in the feature list (although we
 can always suggest things which bother our own part of the community).
 Whereas the Ruby people merely have to agree on how critical their
 missing features are and to move in one widely agreed direction, the
 Python people face a tougher choice as to what should be done next;
 strategies include a tidying-up exercise to make the language more
 coherent, a complete reimplementation, deep modifications to the
 runtime, the introduction of radical new semantics.

All true, but there's a more fundamental difference that's going to show
more as a larger number of people become used to Ruby's semantics: any
Ruby statement can be used as an expression.  This is firmly from the
Lisp family of languages whereas Python's statement-based syntax is
firmly in the Fortran branch.  With the exception of Lisp itself, no
language has seen the popularity of this style of programming until
Ruby.  I think this represents a real danger to Python's mindshare.
Once people have tried expression-based languages, they tend to be
loathe to return to statement-based languages.  To date,
expression-based languages have been mostly of interest in academia or
to a small group of elitists and so weren't practical to use for
day-to-day work.  Ruby has changed that and I think we're just starting
to see the fallout.  Rails may have brought them there, but Ruby itself
is keeping them there.  My fear is that the expression-based family of
languages is the Homo Sapiens to our statement-based Neanderthals and we
can either evolve or disappear.  Python is unique in many ways and I'd
hate to see those unique features lost because we're stuck on the wrong
evolutionary branch.

 The fewer obvious issues that a language has, the less energy there is
 in the community to deal with those issues thoroughly, I think. I guess
 the Perl community chose a bold new direction in line with the
 observation that a big vision can inspire much more in people than lots
 of incremental changes to an existing vision, but the energy required
 to follow through on such a vision can be immense. In addition to all
 this, a large existing community is more likely to want larger benefits
 for smaller levels of disruption because of the amount of existing
 code. Thus, the available energy for change is less in a mature project
 than in a growing project because people have to constantly monitor the
 breakage in their existing investments in the language.
 
   ...but you can't READ Ruby code.
 
  Yeah, that's one of the big reasons I haven't seriously considered
  trying it.  It's expressive, got interesting features... and appears
  unreadable to me.  I'm usually pretty good at deciphering most
  languages, even if I haven't used them before, but Ruby is one of the
  exceptions.
 
 My feeling is that I'd rather learn more about Lisp or Scheme than Ruby
 - the benefits are greater and for me Lisp and Scheme increasingly have
 the edge on readability. Perhaps I'm just not tuned in to
 Smalltalk-style syntaxes.

I'm in the same camp.  As I mentioned earlier, it's been mostly inertia
and the wealth of the Python community that's kept me with Python.
That's why I was so excited when I found Logix.  Lisp-like features with
Python's syntax that generates Python bytecode.  Actually Logix is
perhaps too far the other direction as it supports Lisp-style macros and
the creation of arbitrary syntax, which perhaps would justify some of
the fears people have of Lisp-like languages.  
The part I found appealing was having Python-like syntax in an
expression-based language, with the capability to integrate completely
with Python libraries.  Absolutely the best of both worlds.  I've been
trying to contact the author of Logix to find out what the status of the
project is or if he's abandoned it.  If you haven't looked at it you
really ought to.

http://livelogix.net/logix/


  This brings us back around to the web framework debates.  For many
  people Ruby fits their brains and for others Python does.  I think
  frameworks are similar.  I tried Django and while I thought it was a
  great product, it simply didn't fit how I think about that problem
  

can't destroy a wxMiniFrame

2006-08-24 Thread Flavio
Hi,

I have a miniframe composed mainly of combo boxes, that I need to
destroy and recreate multiple time with different choice lists for the
combo boxes.

My problem is that even after destroying a miniframe with the Destroy()
method, when it is recreated, the combo boxes show the same lists of
its previous incarnation...

how can I completely destroy a miniframe?

Flavio

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


Re: can't destroy a wxMiniFrame

2006-08-24 Thread Laszlo Nagy
Flavio írta:
 Hi,

 I have a miniframe composed mainly of combo boxes, that I need to
 destroy and recreate multiple time with different choice lists for the
 combo boxes.

 My problem is that even after destroying a miniframe with the Destroy()
 method, when it is recreated, the combo boxes show the same lists of
 its previous incarnation...

 how can I completely destroy a miniframe?
   
 From what you wrote, I think that you did not create a new miniframe. 
Although you called Destroy(), you tried to display it again. This is 
what the documentation says about destroy.

Destroys the window safely. Use this function instead of the delete 
operator, since different window classes can be destroyed differently. 
*Frames and dialogs are not destroyed immediately* when this function is 
called -- they are added to a list of windows to be deleted on idle 
time, when all the window's events have been processed. This prevents 
problems with events being sent to non-existent windows.


Regards,

   Laszlo

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


[ANN]pygccxml 0.8.1

2006-08-24 Thread Roman Yakovenko
I'm glad to announce the new version of pygccxml is available.

Download page: http://www.language-binding.net/pygccxml/download.html

What is it?
...The purpose of the  GCC-XML  extension is to generate an XML
description of a C++ program from GCC's internal representation. Since
XML is easy to parse, other development tools will be able to work
with C++ programs without the burden of a complicated C++ parser...

The purpose of  pygccxml  is to read GCC-XML generated file and
provide a simple framework to navigate C++ declarations using Python
classes.

Project home page: http://www.language-binding.net/pygccxml/pygccxml.html

Changes:
1. The project has been ported to Mac OS.
2. New type traits that works with STD containers were added.
3. Logging and user messages related functionality were improved.
4. Support for Java native types was added.
5. Cache classes implementation and performance were improved.

You can find the full list of changes here:
http://language-binding.net/pygccxml/history/history.html#version-0-8-1

--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: telnetlib thread-safe?

2006-08-24 Thread Diez B. Roggisch
Jerry schrieb:
 Fredrik Lundh wrote:
 define thread-safe.  how do you plan to use it?
 
 I would like to write a program that spawns ~10 threads.  Each thread
 would get a host to connect to from a Queue object and run then do it's
 thing (i.e. connecting to the host, running some commands, returning
 back a success or fail based on the results).
 
 I just want to make sure that telnetlib is safe for this.

Usually, OO-style libs that don't share state between objects are pretty 
safe - and  I'd presume that this holds for telnetlib, too.

There is of course no way except looking into the source to _know_ that 
for sure. So - try it out.

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


Re: [wxPython-users] [ANN]UliPad 3.3 is released

2006-08-24 Thread Mario Lacunza
Hi,Is possible then you correct the path for download the sources Zip file?? I want to test this tool but I dont could donwload it...Thansk!2006/8/23, limodou 
[EMAIL PROTECTED]:What's it?
It's an Editor based on wxPython. NewEdit is the old name, and UliPadis the new name. UliPad uses Mixin and Plugin technique as itsarchitecture. Most of its classes can be extended via mixin and plugincomponents, and finally become an integrity class at
creating the instance. So UliPad is very dynamic. You can write thenew features in new files, and hardly need to modify the existingcode. And if you want to extend the existing classes, you could writemixins and plugins, and this will be bound to the target class that I
call Slot Class. This technique will make the changes centralizedand easily managed.What are its features?*Cross platformo based on wxPython, so it can run anywhere that wxPython
works, such as: Windows, Linux.o Unicode support.*Most features of wxStyledTextCtrl(Scintilla)o Syntax highlighting, support Python, c/c++, html, plaintext, perl, ruby, css, _javascript_
o Foldingo Brace Matchingo ...*Extended selectiono Extended word selection -- You can pressCtrl+MouseDoubleClick to select a word including '.'o Matched selection -- Select text in quoted chars like:
(), [], {}, '', .*Other editing extensiono Duplicating text -- Just like Vim Ctrl+V, Ctrl+P, andmore. You can duplicate above or below char, word, lineo Quoting text -- Add some quoted chars before and after
selected text, just as: , '', (), [], {}, ando Text convertion and view -- python - html, reStructuredText - html, textile - html, and you can output or viewo Utf-8 encoding auto detect
o Changing document encodingoAuto backupoLast session support -- It'll save all the filenames asclosed, and reopen the files as next started.oSmart judge the indent char -- It'll auto guess the
indent char, and sets it.oFinding in filesoBookmark support*Python supportobuilt-in python interactive window based on ?PyShell,support Unicodeo Auto completion
o Function syntax calltipso Run, run with argument, stop python sourceo Auto change current patho Python class browsero Indent pasting support(New)
*Code snippetsoYou can manage your code snippets with categories, andeach category can have many items. Every item will represent a codesnippet. You can insert an item just by double-clicking on it. It even
supports importing and exporting.*Simple project supportoCan create a special file _project, so every file andfolder under the folder which has the _project can be considered as awhole project.
*Extension mechanismoScript -- You can write easy script to manipulate the allresource of UliPad, just like: text conversion, etc.oPlugin -- Customized function. More complex but more
powerful. Can easily merge with UliPad, and can be managed via menu.oShell command -- Add often used shell commands, and execute them.*Ftp supportoYou can edit remote files through ftp. You can add,
rename, delete, upload, download file/directory.*Multilanguage supportoCurrently supports two languages: English and Chinese,which can be auto-detected.*Shipped plugins(must be configed as used them before)
oDocument links -- Python documentation and wxPython documentation.oMany plugins can be found at UliPad wiki page.*Shipped scriptsoMany scripts can be found at UliPad wiki page.
*Wizard (New)oYou can make your own wizard template. The wizard caninput user data, combine with template, and output the result. Andwizard also support code framework created. This feature will help you
improving coding efficiency.*Direcotry Browser(New)oBrowse multiple directories, and you can really add,delete, rename directories and files. Double click will open the filein Editor window.
oSupport Copy, Cut, and Paste.oSearch in Directory*AutoComPlete(acp)(New)oSuport user autocomplete file, it can help to input codevery helpful and functional. Just like EditPlus, but may be more
powerful.oManually apply some acp files to current document*Column Edit Mode(New)Where to download it?download lastest version 3.3:
http://wiki.woodpecker.org.cn/moin/UliPad?action="">also have windows installer:
http://wiki.woodpecker.org.cn/moin/UliPad?action="">wiki: http://wiki.woodpecker.org.cn/moin/UliPadsvn: 
http://cvs.woodpecker.org.cn/svn/woodpecker/ulipad/trunkmaillist: http://groups.google.com/group/ulipadIf you have any problem as using UliPad, welcome to join the UliPad
maillist to discuss.Hope fun!--I like python!My Blog: http://www.donews.net/limodouMy Django Site: http://www.djangocn.org
NewEdit Maillist: http://groups.google.com/group/NewEdit-To unsubscribe, e-mail: 
[EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]
-- Saludos / Best regardsMario LacunzaDesarrollador de Sistemas - WebmasterDesarrollador 2 EstrellasVS2005Email: mlacunza [AT] gmail [DOT] com
Website: mlacunzav[AT]cogia[AT]netBlog: 

Why can't I subclass off of date ?

2006-08-24 Thread davidfinance
Ok, maybe this is a stupid question, but why can't I make a subclass of
datetime.date and override the __init__ method?

---

from datetime import date

class A(date):
def __init__(self, a, b, c, d):
print a, b, c, d
date.__init__(self, 2006, 12, 11)

d = A(1, 2, 3, 4)

---

$ python break_date.py
Traceback (most recent call last):
  File break_date.py, line 9, in ?
d = A(1, 2, 3, 4)
TypeError: function takes exactly 3 arguments (4 given)


If I make A a subclass of some toy class that is constructed with three
arguments, it works fine.  Why can't I make date the subclass?

Thanks for any advice.

David

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


Re: [wxPython-users] [ANN]UliPad 3.3 is released

2006-08-24 Thread Mario Lacunza
Sorry, I correct me:Your link in the message not found, but the link in the web site work Ok.Thanks!2006/8/24, Mario Lacunza [EMAIL PROTECTED]
:Hi,Is possible then you correct the path for download the sources Zip file?? 
I want to test this tool but I dont could donwload it...Thansk!2006/8/23, limodou 
[EMAIL PROTECTED]:
What's it?
It's an Editor based on wxPython. NewEdit is the old name, and UliPadis the new name. UliPad uses Mixin and Plugin technique as itsarchitecture. Most of its classes can be extended via mixin and plugincomponents, and finally become an integrity class at
creating the instance. So UliPad is very dynamic. You can write thenew features in new files, and hardly need to modify the existingcode. And if you want to extend the existing classes, you could writemixins and plugins, and this will be bound to the target class that I
call Slot Class. This technique will make the changes centralizedand easily managed.What are its features?*Cross platformo based on wxPython, so it can run anywhere that wxPython
works, such as: Windows, Linux.o Unicode support.*Most features of wxStyledTextCtrl(Scintilla)o Syntax highlighting, support Python, c/c++, html, plaintext, perl, ruby, css, _javascript_
o Foldingo Brace Matchingo ...*Extended selectiono Extended word selection -- You can pressCtrl+MouseDoubleClick to select a word including '.'o Matched selection -- Select text in quoted chars like:
(), [], {}, '', .*Other editing extensiono Duplicating text -- Just like Vim Ctrl+V, Ctrl+P, andmore. You can duplicate above or below char, word, lineo Quoting text -- Add some quoted chars before and after
selected text, just as: , '', (), [], {}, ando Text convertion and view -- python - html, reStructuredText - html, textile - html, and you can output or viewo Utf-8 encoding auto detect
o Changing document encodingoAuto backupoLast session support -- It'll save all the filenames asclosed, and reopen the files as next started.oSmart judge the indent char -- It'll auto guess the
indent char, and sets it.oFinding in filesoBookmark support*Python supportobuilt-in python interactive window based on ?PyShell,support Unicodeo Auto completion
o Function syntax calltipso Run, run with argument, stop python sourceo Auto change current patho Python class browsero Indent pasting support(New)

*Code snippetsoYou can manage your code snippets with categories, andeach category can have many items. Every item will represent a codesnippet. You can insert an item just by double-clicking on it. It even
supports importing and exporting.*Simple project supportoCan create a special file _project, so every file andfolder under the folder which has the _project can be considered as awhole project.
*Extension mechanismoScript -- You can write easy script to manipulate the allresource of UliPad, just like: text conversion, etc.oPlugin -- Customized function. More complex but more
powerful. Can easily merge with UliPad, and can be managed via menu.oShell command -- Add often used shell commands, and execute them.*Ftp supportoYou can edit remote files through ftp. You can add,
rename, delete, upload, download file/directory.*Multilanguage supportoCurrently supports two languages: English and Chinese,which can be auto-detected.*Shipped plugins(must be configed as used them before)
oDocument links -- Python documentation and wxPython documentation.oMany plugins can be found at UliPad wiki page.*Shipped scriptsoMany scripts can be found at UliPad wiki page.
*Wizard (New)oYou can make your own wizard template. The wizard caninput user data, combine with template, and output the result. Andwizard also support code framework created. This feature will help you
improving coding efficiency.*Direcotry Browser(New)oBrowse multiple directories, and you can really add,delete, rename directories and files. Double click will open the filein Editor window.
oSupport Copy, Cut, and Paste.oSearch in Directory*AutoComPlete(acp)(New)oSuport user autocomplete file, it can help to input codevery helpful and functional. Just like EditPlus, but may be more
powerful.oManually apply some acp files to current document*Column Edit Mode(New)Where to download it?download lastest version 3.3:

http://wiki.woodpecker.org.cn/moin/UliPad?action="">also have windows installer:

http://wiki.woodpecker.org.cn/moin/UliPad?action="">wiki: 
http://wiki.woodpecker.org.cn/moin/UliPadsvn: 
http://cvs.woodpecker.org.cn/svn/woodpecker/ulipad/trunkmaillist: http://groups.google.com/group/ulipad
If you have any problem as using UliPad, welcome to join the UliPad
maillist to discuss.Hope fun!--I like python!My Blog: http://www.donews.net/limodou
My Django Site: http://www.djangocn.org
NewEdit Maillist: http://groups.google.com/group/NewEdit-
To unsubscribe, e-mail: 
[EMAIL PROTECTED]For additional commands, e-mail: 
[EMAIL PROTECTED]
-- Saludos / Best regardsMario 

Re: Python Syntax Highlighting Module

2006-08-24 Thread Cliff Wells
On Mon, 2006-08-21 at 08:19 -0700, gene tani wrote:
 [EMAIL PROTECTED] wrote:
  Hello,
  I have an idea for a project which involves an editor that supports
  syntax highlighting.  This would be for any language, particularly php,
  html, css, etc.  I would like to write this program using python.  It
  would only make sense to base this upon existing open source code.  My
  question is there a python module or examples on how to write a code
  editor which supports modulated syntax highlighting?
 
  Thank you,
  Blaine
 
 just a *few* examples

If I were to start a GUI editor project, I'd undoubtedly start by
looking at Scintilla:

http://www.scintilla.org/

Also see:
http://scintilla.sourceforge.net/ScintillaRelated.html

Regards,
Cliff
-- 

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


Re: setuid root

2006-08-24 Thread Tiago Batista
On Thu, 24 Aug 2006 17:48:26 +0200
Patrick Useldinger [EMAIL PROTECTED] wrote:

 Tiago Simões Batista wrote:
  The sysadmin already set the setuid bit on the script, but it
  still fails when it tries to write to any file that only root has
  write access to.
 
 use sudo.
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 

Thank you, both fot you and for Ove Svensson.

I was looking for a simpler way, that required as little intervention as 
possible from the main sysadmin. Given the situation I am facing, I will 
probably use sudo, it keeps things cleaner...

Again, thank you

Tiago


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

  1   2   >