Re: library to do easy shell scripting in Python

2008-04-23 Thread Matt Nordhoff
Wow, this message turned out to be *LONG*. And it also took a long time to write. But I had fun with it, so ok. :-) Michael Torrie wrote: > Recently a post that mentioned a recipe that extended subprocess to > allow killable processes caused me to do some thinking. Some of my > larger bash script

DO YOU KNOW ANY THING ABOUT ISLAM???

2008-04-23 Thread ABDULLAH
What you are about to read might sound unusual but it could be very enlightened. So I would be thankful if you give my article 5 minute of your value time. THANK YOU Islam is a total system of living. A Muslim is supposed to live in peace and harmony with all these segments; hence, a Muslim is any

Re: What happened with python? messed strings?

2008-04-23 Thread gagsl-py2
(top posting fixed; please keep discussion on this list) --- [EMAIL PROTECTED] escribió: > In article > <[EMAIL PROTECTED]> > you wrote: > > En Sun, 20 Apr 2008 15:54:20 -0300, > <[EMAIL PROTECTED]> escribi?: > > > > I used extensively python and now I find this > mess with strings, > > > I can't

Re: python-ldap - Operations Error

2008-04-23 Thread theiviaxx
Thanks for that last link, i'll try that tomorrow :) As for the tgolden modules, i will use that in a pinch, but it means our server has to be a windows box. just trying to keep this as open as possible :) Thanks again -- http://mail.python.org/mailman/listinfo/python-list

couple of optparse questions

2008-04-23 Thread Eyal Teutsch
I have a bunch of command line scripts which I would like them to partially share command line options. For the sake of example, let's say I have the following 2 scripts: monitor_io.py - accepts 'interval' and 'disk' arguments: monitor_io.py -i 30 -d disk1 monitor_processes.py - accepts 'interval'

Re: @classmethod question

2008-04-23 Thread Gabriel Genellina
En Thu, 24 Apr 2008 00:27:13 -0300, Scott SA <[EMAIL PROTECTED]> escribió: I'm using the @classemethod decorator for some convenience methods and for some reason, either mental block or otherwise, can't seem to figure out how to elegantly detect if the call is from an instance or not. Here'

Re: @classmethod question

2008-04-23 Thread Ivan Illarionov
On 24 апр, 07:27, Scott SA <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using the @classemethod decorator for some convenience methods and for > some reason, either mental block or otherwise, can't seem to figure out how > to elegantly detect if the call is from an instance or not. > > Here's the pro

Re: Parsing tuple from string?

2008-04-23 Thread George Sakkis
On Apr 24, 12:21 am, Daniel <[EMAIL PROTECTED]> wrote: > On Apr 23, 4:22 pm, George Sakkis <[EMAIL PROTECTED]> wrote:> On Apr 23, 6:24 > pm, Daniel <[EMAIL PROTECTED]> wrote: > > > > I have a list of strings, which I need to convert into tuples.  If the > > > string is not in python tuple format

Re: Curious relation

2008-04-23 Thread Dan Bishop
On Apr 23, 11:51 pm, Greg J <[EMAIL PROTECTED]> wrote: > I was reading the programming Reddit tonight and came across this > (http://reddit.com/info/6gwk1/comments/): > > >>> ([1]>2)==True > True > >>> [1]>(2==True) > True > >>> [1]>2==True > > False > > Odd, no? > > So, can anyone here shed light

Re: python-doc

2008-04-23 Thread Gabriel Genellina
En Wed, 23 Apr 2008 11:02:46 -0300, korean_dave <[EMAIL PROTECTED]> escribió: Hi all. I am using this to try to document my python-coded apps. http://effbot [DOT] org/zone/pythondoc [DOT] htm i am using windows XP professional. I have put the install directory of pythondoc.py in my path file.

Curious relation

2008-04-23 Thread Greg J
I was reading the programming Reddit tonight and came across this (http://reddit.com/info/6gwk1/comments/): >>> ([1]>2)==True True >>> [1]>(2==True) True >>> [1]>2==True False Odd, no? So, can anyone here shed light on this one? -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem using copy.copy with my own class

2008-04-23 Thread George Sakkis
On Apr 23, 9:48 pm, Jeffrey Barish <[EMAIL PROTECTED]> wrote: > > Here it is: > > import copy > > class Test(int): >     def __new__(cls, arg1, arg2): >         return int.__new__(cls, arg1) > >     def __init__(self, arg1, arg2): >         self.arg2 = arg2 > > if __name__ == '__main__': >     t =

Re: Problem using copy.copy with my own class

2008-04-23 Thread Gabriel Genellina
En Thu, 24 Apr 2008 01:21:15 -0300, Gabriel Genellina <[EMAIL PROTECTED]> escribió: I agree. In case arg2 were really meaningful, use __getnewargs__ (see ) I forget to include the link: -- Gabriel Genellina -- http://mail.python.org/mailman/lis

Re: Parsing tuple from string?

2008-04-23 Thread Daniel
On Apr 23, 4:22 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Apr 23, 6:24 pm, Daniel <[EMAIL PROTECTED]> wrote: > > > I have a list of strings, which I need to convert into tuples. If the > > string is not in python tuple format (i.e. "('one', 'two')", "("one", > > 'two')", etc.), then I can

Re: Problem using copy.copy with my own class

2008-04-23 Thread Gabriel Genellina
En Thu, 24 Apr 2008 00:32:37 -0300, Michael Torrie <[EMAIL PROTECTED]> escribió: Jeffrey Barish wrote: Marc 'BlackJack' Rintsch wrote: Please simplify the code to a minimal example that still has the problem and *show it to us*. It's hard to spot errors in code that nobody except you kn

Re: dynamically importing a module and function

2008-04-23 Thread [EMAIL PROTECTED]
On Mon, Apr 21, 2008 at 4:47 PM, John Machin <[EMAIL PROTECTED]> wrote: > > > saved = sys.path > > > sys.path = data['cwd'] > > > module = __import__(data['module']) > > > sys.path = saved > > > > > > > > import os > > > > > os.chdir('/home/mark/work/proj1') > > > > > import sys > > > > > sys.p

Re: function that accepts any amount of arguments?

2008-04-23 Thread Steve Holden
globalrev wrote: if i want a function that can take any amount of arguments how do i do? lets say i want a function average that accepts any number of integers and returns the average. Use a parameter of the form *args - the asterisk tells the interpreter to collect positional arguments into

Re: logging doc problem

2008-04-23 Thread Gabriel Genellina
En Wed, 23 Apr 2008 23:08:49 -0300, James Stroud <[EMAIL PROTECTED]> escribió: Am I missing something or are the docs for logging hopelessly outdated? http://docs.python.org/lib/node406.html For example, quoting the docs """ import logging logging.debug('A debug message') logging.info('Som

Re: function that accepts any amount of arguments?

2008-04-23 Thread Paul McNett
globalrev wrote: if i want a function that can take any amount of arguments how do i do? Put an asterisk before the argument name. lets say i want a function average that accepts any number of integers and returns the average. def avg(*args): return sum(args) / len(args) There are some

function that accepts any amount of arguments?

2008-04-23 Thread globalrev
if i want a function that can take any amount of arguments how do i do? lets say i want a function average that accepts any number of integers and returns the average. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Success stories

2008-04-23 Thread Gabriel Genellina
En Wed, 23 Apr 2008 08:43:56 -0300, Paul Boddie <[EMAIL PROTECTED]> escribió: On 23 Apr, 11:12, Mark Wooding <[EMAIL PROTECTED]> wrote: Gabriel Genellina <[EMAIL PROTECTED]> wrote: > Because Python doesn't follow the "boxed variables" model. Be careful here. `Boxed types' or `boxed objects'

Re: Problem using copy.copy with my own class

2008-04-23 Thread Michael Torrie
Jeffrey Barish wrote: > Marc 'BlackJack' Rintsch wrote: >> Please simplify the code to a minimal example that still has the problem >> and *show it to us*. It's hard to spot errors in code that nobody except >> you knows. > > Here it is: > > import copy > > class Test(int): > def __new__(cl

@classmethod question

2008-04-23 Thread Scott SA
Hi, I'm using the @classemethod decorator for some convenience methods and for some reason, either mental block or otherwise, can't seem to figure out how to elegantly detect if the call is from an instance or not. Here's the problem: Within the class definition, 'isinstance' has nothing to co

Re: Lists: why is this behavior different for index and slice assignments?

2008-04-23 Thread John Salerno
John Machin wrote: Deletion occurs *only* in the corner case where there are no "assigned elements" i.e. only if the RHS list (sequence) is *empty*. Oh, it was my understanding that deletion always occurs, even when the section is being assigned a non-empty value, i.e. delete the slice and

Re: Partition list with predicate

2008-04-23 Thread Steve Holden
Jared Grubb wrote: That almost works, except that a predicate can have "memory". For example, the predicate could be "extract every other object", which doesn't care about the value of the object (so you cant remove them later based on value!). Or your predicate might be "remove the first 5 ob

library to do easy shell scripting in Python

2008-04-23 Thread Michael Torrie
Recently a post that mentioned a recipe that extended subprocess to allow killable processes caused me to do some thinking. Some of my larger bash scripts are starting to become a bit unwieldy (hundreds of lines of code). Yet for many things bash just works out so well because it is so close to t

Re: Ideas for parsing this text?

2008-04-23 Thread Paul McGuire
On Apr 23, 8:00 pm, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > I have a set of files with this kind of content (it's dumped from WebSphere): > > [propertySet "[[resourceProperties "[[[description "This is a required > property. This is an actual database name, and its not the locally > catalogued

logging doc problem

2008-04-23 Thread James Stroud
Am I missing something or are the docs for logging hopelessly outdated? http://docs.python.org/lib/node406.html For example, quoting the docs """ import logging logging.debug('A debug message') logging.info('Some information') logging.warning('A shot across the bows') """ And the result is %

Re: Python Success stories

2008-04-23 Thread Istvan Albert
On Apr 23, 2:08 pm, Bob Woodham <[EMAIL PROTECTED]> wrote: > x = x++; > > has unspecified behaviour in C. That is, it is not specified > whether the value of x after execution of the statement is the > old value of x or one plus the old value of x. unspecified means that the result could be anyt

Re: Problem using copy.copy with my own class

2008-04-23 Thread Jeffrey Barish
Marc 'BlackJack' Rintsch wrote: > Please simplify the code to a minimal example that still has the problem > and *show it to us*. It's hard to spot errors in code that nobody except > you knows. Here it is: import copy class Test(int): def __new__(cls, arg1, arg2): return int.__new_

Re: Partition list with predicate

2008-04-23 Thread Jared Grubb
That almost works, except that a predicate can have "memory". For example, the predicate could be "extract every other object", which doesn't care about the value of the object (so you cant remove them later based on value!). Or your predicate might be "remove the first 5 objects that are even", wh

Re: Explicit variable declaration

2008-04-23 Thread Filip Gruszczyński
> If you want to just declare that name exist, but doesn't want to > declare the type, why don't you just do this: > > def somefunc(): > nonlocal = nonlocal > local = 0 # or None or [] or an initial value > # > return nonlocal * local Err.. I don't quite get. How it may help me?

Re: Python Success stories

2008-04-23 Thread AlFire
Bob Woodham wrote: x = x++; has unspecified behaviour in C. what about C++ -- http://mail.python.org/mailman/listinfo/python-list

Re: Ideas for parsing this text?

2008-04-23 Thread George Sakkis
On Apr 23, 9:00 pm, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > I have a set of files with this kind of content (it's dumped from WebSphere): > > [snipped] > > I'm trying to figure out the best way to feed it all into > dictionaries, without having to know exactly what the contents of the > file a

Re: Python Success stories

2008-04-23 Thread Jon Ribbens
On 2008-04-23, Mark Wooding <[EMAIL PROTECTED]> wrote: > Python is actually one of the few to define one but not the other. (The > other one I can think of is Acorn's BBC BASIC, for whatever that's > worth; it too lacks `++'.) You should've added it in Termite Basic then :-p -- http://mail.python

Re: Python Success stories

2008-04-23 Thread AlFire
Cristina Yenyxe González García wrote: 2008/4/23, Reedick, Andrew <[EMAIL PROTECTED]>: IIRC, Python is used in games like Eve Online (SciFi MMO) and Vampire: Bloodlines (RPG.) Years later, a dedicated fan is still fixing/updating the Bloodlines python scripts that control the dialogue and scr

Re: Partition list with predicate

2008-04-23 Thread Brian
On Wed, Apr 23, 2008 at 9:08 PM, Jared Grubb <[EMAIL PROTECTED]> wrote: > I guess I forgot one requirement: the removed elements need to be > remembered. > > Basically, I have a list of objects in a buffer, one class operates on > some of the objects, but other classes use others. So, a class must

Re: Where to get BeautifulSoup--www.crummy.com appears to be down.

2008-04-23 Thread sturlamolden
On Apr 22, 8:36 pm, Kenneth McDonald <[EMAIL PROTECTED]> wrote: > Sadly. I can easily access: http://www.crummy.com/software/BeautifulSoup/ -- http://mail.python.org/mailman/listinfo/python-list

Re: python-ldap - Operations Error

2008-04-23 Thread Jason Scheirer
On Apr 23, 5:16 pm, [EMAIL PROTECTED] wrote: > Hello all, I am trying to integrate TurboGears with our Active > Directory here at the office.  TurboGears aside, i cannot get this to > work.  The simplest thing i can do to test this is: > > >>> import ldap > >>> l = ldap.initialize("ldap://server.ne

Re: Partition list with predicate

2008-04-23 Thread Jared Grubb
I guess I forgot one requirement: the removed elements need to be remembered. Basically, I have a list of objects in a buffer, one class operates on some of the objects, but other classes use others. So, a class must extract the ones it can handle, and leave the rest in the buffer for the other cl

Ideas for parsing this text?

2008-04-23 Thread Eric Wertman
I have a set of files with this kind of content (it's dumped from WebSphere): [propertySet "[[resourceProperties "[[[description "This is a required property. This is an actual database name, and its not the locally catalogued database name. The Universal JDBC Driver does not rely on information c

python-ldap - Operations Error

2008-04-23 Thread theiviaxx
Hello all, I am trying to integrate TurboGears with our Active Directory here at the office. TurboGears aside, i cannot get this to work. The simplest thing i can do to test this is: >>> import ldap >>> l = ldap.initialize("ldap://server.net";) >>> l.simple_bind(DN, "secret") 1 >>> l.result(1) (

Re: Parsing tuple from string?

2008-04-23 Thread George Sakkis
On Apr 23, 6:24 pm, Daniel <[EMAIL PROTECTED]> wrote: > I have a list of strings, which I need to convert into tuples.  If the > string is not in python tuple format (i.e. "('one', 'two')", "("one", > 'two')", etc.), then I can just make it a 1-tuple (i.e. return > (string,) ).  If it is in python

Re: Python script to automate use of Google Translate? (or other translator)

2008-04-23 Thread Stef Mientki
Trent Nelson wrote: I have the need to occasionally translate a single word programatically. Would anyone have a Python script that would let me do this using Google (or another) translation service? As a matter of fact, yes, I do! This happens to be my most favourite piece of Python c

Re: Python generators (coroutines)

2008-04-23 Thread rocco . rossi
> Anyway, if you have a blocking operation, the only solution is to use > a thread or a separate process. > > Michele Simionato That's what I thought. It was in fact rather obvious, but I wanted to be sure that I hadn't overlooked some arcane possibility (ex. with the use of exceptions or somet

Parsing tuple from string?

2008-04-23 Thread Daniel
I have a list of strings, which I need to convert into tuples. If the string is not in python tuple format (i.e. "('one', 'two')", "("one", 'two')", etc.), then I can just make it a 1-tuple (i.e. return (string,) ). If it is in python tuple format, I need to parse it and return the appropriate tu

Re: python-ldap: searching without specifying an OU?

2008-04-23 Thread Michael Ströder
hotani wrote: It seems the only way I can bind is by using this format: simple_bind_s('[EMAIL PROTECTED]','password') Believe me: This is not true. If I try using a DN, it fails every time. This will not work: simple_bind_s('cn=user,dc=server,dc=local', 'password') Check the DN you're using

Re: python-ldap: searching without specifying an OU?

2008-04-23 Thread Michael Ströder
hotani wrote: This fixed it! http://peeved.org/blog/2007/11/20/ By adding this line after 'import ldap', I was able to search from the root level: ldap.set_option(ldap.OPT_REFERRALS, 0) Uumh, yes. I'm always switching off OpenLDAP client lib's internal referral chasing. But be prepared to a

Re: Java or C++?

2008-04-23 Thread John Nagle
Bob Martin wrote: in 342367 20080414 074410 [EMAIL PROTECTED] wrote: Hello, I was hoping to get some opinions on a subject. I've been programming Python for almost two years now. Recently I learned Perl, but frankly I'm not very comfortable with it. Now I want to move on two (sic) either Java or

Re: Where to get BeautifulSoup--www.crummy.com appears to be down.

2008-04-23 Thread John Nagle
Tim Golden wrote: John Nagle wrote: Mike Driscoll wrote: Ken, On Tue, Apr 22, 2008 at 1:36 PM, Kenneth McDonald <[EMAIL PROTECTED]> wrote: Sadly. Thanks, Ken -- http://mail.python.org/mailman/listinfo/python-list I've attached the 2.4 version. I also have some Windows binaries for Bea

Re: Python development tools

2008-04-23 Thread castironpi
On Apr 23, 3:52 pm, Torsten Bronger <[EMAIL PROTECTED]> wrote: > Hall�chen! > > [EMAIL PROTECTED] writes: > > On 23 avr, 19:39, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > >> Are there any completely free developent tools for python scripts > >> like IDLE. I have used IDLE , but I want t

Re: Python development tools

2008-04-23 Thread Torsten Bronger
Hallöchen! [EMAIL PROTECTED] writes: > On 23 avr, 19:39, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > >> Are there any completely free developent tools for python scripts >> like IDLE. I have used IDLE , but I want to try out others >> also. I saw stuff like PyCrust, but I don't see that it

Re: Partition list with predicate

2008-04-23 Thread castironpi
On Apr 23, 2:26 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Terry Reedy wrote: > > "Jared Grubb" <[EMAIL PROTECTED]> wrote in message > >news:[EMAIL PROTECTED] > > | I want a function that removes values from a list if a predicate > > evaluates > > | to True. > > > Forget the rigamarole you poste

Re: Pythonically extract data from a list of tuples (getopt)

2008-04-23 Thread Mike Kent
You could use http://docs.python.org/lib/module-optparse.html -- http://mail.python.org/mailman/listinfo/python-list

Pythonically extract data from a list of tuples (getopt)

2008-04-23 Thread Mark Reed
So the return value from getopt.getopt() is a list of tuples, e.g. >>> import getopt >>> opts = getopt.getopt('-a 1 -b 2 -a 3'.split(), 'a:b:')[0]; opts [('-a', '1'), ('-b', '2'), ('-a', '3')] what's the idiomatic way of using this result? I can think of several possibilities. For options not a

Re: print some text

2008-04-23 Thread castironpi
On Apr 23, 2:05 pm, barronmo <[EMAIL PROTECTED]> wrote: > I'm a beginner searching for an easy way to print the contents of a > text control.  So far I've come up with the following(difficulties): > > 1) using wxPython >      -convert to HTML and then print (I don't know anything about > HTML) >  

RE: Python development tools

2008-04-23 Thread Trent Nelson
> Are there any completely free developent tools for python > scripts like IDLE. I have used IDLE , but I want to try out > others also. I saw stuff like PyCrust, but I don't see that > it can run the script as well. > Thanks, Ignoring the 'free' part of your question, I've recently moved from Py

Re: Python development tools

2008-04-23 Thread [EMAIL PROTECTED]
On 23 avr, 19:39, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Are there any completely free developent tools for python scripts like > IDLE. I have used IDLE , but I want to try out others also. I saw > stuff like PyCrust, but I don't see that it can run the script as > well. > Thanks, emacs

Re: Python development tools

2008-04-23 Thread kperkins257
On Apr 23, 1:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Are there any completely free developent tools for python scripts like > IDLE. I have used IDLE , but I want to try out others also. I saw > stuff like PyCrust, but I don't see that it can run the script as > well. > Thanks, > > R

Re: DTD validation and xmlproc

2008-04-23 Thread Stefan Behnel
mmm wrote: > I am willing to learn and use new xml procedures, but I found nothng > pre-written to validate agaisnt a given DTD file. > > Any advice would be welcome, even a good tutorial on XML validation > usiog Python. Regarding that part, try lxml. http://codespeak.net/lxml http://codespeak.

Re: problem with dictionaries

2008-04-23 Thread Terry Reedy
"Simon Strobl" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Any hints? For future reference, I would consider using sample data in the file itself for debugging -- to separate an algorithm problem from a file problem: | | | #!/u

Re: Calling Python code from inside php

2008-04-23 Thread Diez B. Roggisch
A simple yet dangerous and rather rubbish solution (possibly more of a hack than a real implementation) could be achieved by using a technique described above: What is rubbish about that - except from the obvious cleansing of input variables that has to take place? Python has a whole module d

Re: Python "make" like tools (was Re: [ANN] DoIt 0.1.0 Released (build tool))

2008-04-23 Thread Eduardo Schettino
On Wed, Apr 23, 2008 at 8:39 PM, Ville M. Vainio <[EMAIL PROTECTED]> wrote: > > Yeah, decorators get around this. > > > Perhaps you could do: > > for f in pyFiles: > @task("checker") > @depend(f) > def check(): > c("pychecker %s" % f) > > Never underestimate the magic that is nested s

Re: Partition list with predicate

2008-04-23 Thread Steve Holden
Terry Reedy wrote: "Jared Grubb" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I want a function that removes values from a list if a predicate evaluates | to True. Forget the rigamarole you posted, which has several defects. If you must modify the list in place, because you ha

Re: Python development tools

2008-04-23 Thread bvidinli
i saw boa constructor to be most close to delphi in python editors.. it is still far away from delphi but, it is closest anyway. 2008/4/23, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Are there any completely free developent tools for python scripts like > IDLE. I have used IDLE , but I want to try

Re: Calling Python code from inside php

2008-04-23 Thread Tobiah
On Wed, 23 Apr 2008 20:42:44 +0200, Diez B. Roggisch wrote: > vijay schrieb: >> Hi >> I have a python code performing some computation for me.I have a >> html page which passes certain argumnets to a php page.This php page >> needs to pass on the value to the Python class and get the result >>

Re: Calling Python code from inside php

2008-04-23 Thread alexelder
On Apr 23, 7:42 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > vijay schrieb: > > > Hi > > I have a python code performing some computation for me.I have a > > html page which passes certain argumnets to a php page.This php page > > needs to pass on the value to the Python class and get th

Re: Python generators (coroutines)

2008-04-23 Thread Michele Simionato
On Apr 23, 8:26 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Wed, 23 Apr 2008 10:53:03 -0700 (PDT), Michele Simionato: > You could have #2. It's a trivial variation of sending a value. For > example, > > http://twistedmatrix.com/trac/browser/trunk/twisted/internet/defer.py... > > Jean-

Re: Partition list with predicate

2008-04-23 Thread Terry Reedy
"Jared Grubb" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I want a function that removes values from a list if a predicate evaluates | to True. Forget the rigamarole you posted, which has several defects. If you must modify the list in place, because you have multiple referenc

Re: Calling Python code from inside php

2008-04-23 Thread MC
Hi! If you are under Windows, you can: - call Python's functions via Active-Scripting - call a Python COM server (functions or properties) For that, use Pywin32. And, in all cases, call functions can use parameters. -- @-salutations Michel Claveau -- http://mail.python.org/mailman/lis

print some text

2008-04-23 Thread barronmo
I'm a beginner searching for an easy way to print the contents of a text control. So far I've come up with the following(difficulties): 1) using wxPython -convert to HTML and then print (I don't know anything about HTML) -use wx.Printout (Seems complicated; may be beyond my abilities)

Re: python-ldap: searching without specifying an OU?

2008-04-23 Thread hotani
This fixed it! http://peeved.org/blog/2007/11/20/ By adding this line after 'import ldap', I was able to search from the root level: ldap.set_option(ldap.OPT_REFERRALS, 0) -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling Python code from inside php

2008-04-23 Thread Diez B. Roggisch
vijay schrieb: Hi I have a python code performing some computation for me.I have a html page which passes certain argumnets to a php page.This php page needs to pass on the value to the Python class and get the result back. How do I go about this?? Write a commandline-app in python, that do

Re: Calling Python code from inside php

2008-04-23 Thread Nick Stinemates
On Wed, Apr 23, 2008 at 11:09:53AM -0700, vijay wrote: > Hi > I have a python code performing some computation for me.I have a > html page which passes certain argumnets to a php page.This php page > needs to pass on the value to the Python class and get the result > back. > How do I go about t

Re: Python generators (coroutines)

2008-04-23 Thread Jean-Paul Calderone
On Wed, 23 Apr 2008 10:53:03 -0700 (PDT), Michele Simionato <[EMAIL PROTECTED]> wrote: On Apr 23, 4:17 pm, [EMAIL PROTECTED] wrote: I would really like to know more about python 2.5's new generator characteristics that make them more powerful and analogous to coroutines. Is it possible for inst

Re: Unix Device File Emulation

2008-04-23 Thread blaine
On Apr 23, 2:01 pm, "Martin Blume" <[EMAIL PROTECTED]> wrote: > "blaine" schrieb > > > > > > while 1: > > > r = self.fifodev.readline() > > > if r: print r > > > > According to my docs, readline() returns an empty > > > string at the end of the file. > > > Also, you might want to sleep() between

Calling Python code from inside php

2008-04-23 Thread vijay
Hi I have a python code performing some computation for me.I have a html page which passes certain argumnets to a php page.This php page needs to pass on the value to the Python class and get the result back. How do I go about this?? Cheers Vijay -- http://mail.python.org/mailman/listinfo/pyt

Re: Python Success stories

2008-04-23 Thread Bob Woodham
On 2008-04-22, Paul Hankin <[EMAIL PROTECTED]> wrote: > On Apr 22, 5:50 pm, Jérémy Wagner <[EMAIL PROTECTED]> wrote: >> Sure. Python is more readable than Perl, though I have found Python >> to have a weird behavior regarding this little issue : >> >> How can you explain that Python doesn't support

Re: Unix Device File Emulation

2008-04-23 Thread Martin Blume
"blaine" schrieb > > > > while 1: > > r = self.fifodev.readline() > > if r: print r > > > > According to my docs, readline() returns an empty > > string at the end of the file. > > Also, you might want to sleep() between reads a > > little bit. > > > > Oh ok, that makes sense. Hmm. So do I n

Re: Python development tools

2008-04-23 Thread Mike Driscoll
On Apr 23, 12:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Are there any completely free developent tools for python scripts like > IDLE. I have used IDLE , but I want to try out others also. I saw > stuff like PyCrust, but I don't see that it can run the script as > well. > Thanks, > >

Re: python-ldap: searching without specifying an OU?

2008-04-23 Thread hotani
It seems the only way I can bind is by using this format: simple_bind_s('[EMAIL PROTECTED]','password') If I try using a DN, it fails every time. This will not work: simple_bind_s('cn=user,dc=server,dc=local', 'password') Errors out with "invalid credentials": ldap.INVALID_CREDENTIALS: {'info': '

Re: Python generators (coroutines)

2008-04-23 Thread Michele Simionato
On Apr 23, 4:17 pm, [EMAIL PROTECTED] wrote: > I would really like to know more about python 2.5's new generator > characteristics that make them more powerful and analogous to > coroutines. Is it possible for instance to employ them in situations > where I would normally use a thread with a blocki

Python development tools

2008-04-23 Thread [EMAIL PROTECTED]
Are there any completely free developent tools for python scripts like IDLE. I have used IDLE , but I want to try out others also. I saw stuff like PyCrust, but I don't see that it can run the script as well. Thanks, RR -- http://mail.python.org/mailman/listinfo/python-list

OEM Handheld Mics - Chinese Handheld Mics Manufacturer

2008-04-23 Thread blog630
OEM Handheld Mics - Chinese Handheld Mics Manufacturer Handheld Microphone WebSite Link: http://www.chinese-microphone.com/Handheld-Microphones.html China GuangZhou TianTuo Microphone Manufacturing Co., Ltd WebSite: http://www.chinese-microphone.com/ Microphone Products are: Wireless Microphone

China Wireless Mics - Wholesale Wireless Mics Manufacturer

2008-04-23 Thread blog630
China Wireless Mics - Wholesale Wireless Mics Manufacturer Wireless Microphone WebSite Link: http://www.chinese-microphone.com/Wireless-Microphones.html China GuangZhou TianTuo Microphone Manufacturing Co., Ltd WebSite: http://www.chinese-microphone.com/ Microphone Products are: Wireless Microp

Re: Partition list with predicate

2008-04-23 Thread Tim Golden
Jared Grubb wrote: I want a function that removes values from a list if a predicate evaluates to True. The best I could come up with is: Have a look at the itertools module, and the ifilter function in particular. TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to get BeautifulSoup--www.crummy.com appears to be down.

2008-04-23 Thread Mike Driscoll
On Apr 23, 11:47 am, John Nagle <[EMAIL PROTECTED]> wrote: > Mike Driscoll wrote: > > Ken, > > > On Tue, Apr 22, 2008 at 1:36 PM, Kenneth McDonald > > <[EMAIL PROTECTED]> wrote: > >> Sadly. > > >>  Thanks, > >>  Ken > >>  -- > >>  http://mail.python.org/mailman/listinfo/python-list > > > I've attac

Re: Where to get BeautifulSoup--www.crummy.com appears to be down.

2008-04-23 Thread Tim Golden
John Nagle wrote: Mike Driscoll wrote: Ken, On Tue, Apr 22, 2008 at 1:36 PM, Kenneth McDonald <[EMAIL PROTECTED]> wrote: Sadly. Thanks, Ken -- http://mail.python.org/mailman/listinfo/python-list I've attached the 2.4 version. I also have some Windows binaries for Beautiful Soup uploade

Re: Where to get BeautifulSoup--www.crummy.com appears to be down.

2008-04-23 Thread Steve Holden
John Nagle wrote: Mike Driscoll wrote: Ken, On Tue, Apr 22, 2008 at 1:36 PM, Kenneth McDonald <[EMAIL PROTECTED]> wrote: Sadly. Thanks, Ken -- http://mail.python.org/mailman/listinfo/python-list I've attached the 2.4 version. I also have some Windows binaries for Beautiful Soup uploade

Partition list with predicate

2008-04-23 Thread Jared Grubb
I want a function that removes values from a list if a predicate evaluates to True. The best I could come up with is: def extract(lst, pred): idx = 0 ret = [] for obj in lst[:]: if pred(obj): ret.append(obj) lst.pop(idx) else: idx +=

Re: Choosing log file destination in logging configuration file

2008-04-23 Thread Vinay Sajip
On Apr 22, 9:48 pm, [EMAIL PROTECTED] wrote: > On Apr 22, 12:57 pm, Miki <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > So far so good. In the relevant applications, the code looks something > > > like this: > > >logging.config.fileConfig('log.ini') > > > logger =logging.getLogger('log.regular

Re: Explicit variable declaration

2008-04-23 Thread Lie
On Apr 23, 4:52 pm, "Filip Gruszczyński" <[EMAIL PROTECTED]> wrote: > > You mean the type? Not in 2.x, but in 3.x, there are function > > annotations: > > > def a_function(arg1: int, arg2: str) -> None: pass > > Nope, I don't like types ;-) 3.x seems pretty revolutionary, and this > typing can b

Re: help needed with classes/inheritance

2008-04-23 Thread Paul McGuire
On Apr 23, 10:44 am, barbaros <[EMAIL PROTECTED]> wrote: > > If I understand correctly, in the above implementation I cannot > define firstly a (non-oriented) body, and then build, on top of it, > two bodies with opposite orientations. The point is, I want > both oriented bodies to share the same b

Re: Unix Device File Emulation

2008-04-23 Thread blaine
On Apr 23, 12:27 pm, "Martin Blume" <[EMAIL PROTECTED]> wrote: > "blaine" schrieb > > > > > > > # Fake Nokia Screen Emulator > > import sys, os > > > class nokia_fkscrn: > > def __init__(self, file): > > if not os.path.exists(file): > > os.mkfifo(file) > > self.fifodev = open(file,

Re: Where to get BeautifulSoup--www.crummy.com appears to be down.

2008-04-23 Thread John Nagle
Mike Driscoll wrote: Ken, On Tue, Apr 22, 2008 at 1:36 PM, Kenneth McDonald <[EMAIL PROTECTED]> wrote: Sadly. Thanks, Ken -- http://mail.python.org/mailman/listinfo/python-list I've attached the 2.4 version. I also have some Windows binaries for Beautiful Soup uploaded to my website: ht

Re: MESSAGE RESPONSE

2008-04-23 Thread Grant Edwards
On 2008-04-22, Blubaugh, David A. <[EMAIL PROTECTED]> wrote: > Is there a way to block these messages. I do not want to be caught > with filth such as this material. I could lose my job with Belcan with > evil messages such as these messages. No, not really. That's one reason I never use my w

Re: Unix Device File Emulation

2008-04-23 Thread Martin Blume
"blaine" schrieb > > # Fake Nokia Screen Emulator > import sys, os > > class nokia_fkscrn: > def __init__(self, file): > if not os.path.exists(file): > os.mkfifo(file) > self.fifodev = open(file, 'r') > def read(self): > while 1: > r = self.fifodev.readline() > p

Re: MESSAGE RESPONSE

2008-04-23 Thread Dan Upton
On Wed, Apr 23, 2008 at 10:24 AM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Blubaugh, David A. schrieb: > > > Is there a way to block these messages. I do not want to be caught > > with filth such as this material. I could lose my job with Belcan with > > evil messages such as these messages

Re: Explicit variable declaration

2008-04-23 Thread Filip Gruszczyński
Wow! This is extremely easy and seems to do exactly what I need. Those decorators are pretty powerful then. Thanks for your help, I'll try to use this. > def uses(names): > def decorator(f): > used = set(f.func_code.co_varnames) > declared = set(names.split()) > undecl

Re: Unix Device File Emulation

2008-04-23 Thread blaine
On Apr 23, 11:17 am, "Ville M. Vainio" <[EMAIL PROTECTED]> wrote: > blaine wrote: > > example usage: echo 'line 0 0 10 10' > /dev/screen > > > On the actual embedded device this is handled by a kernel module. We > > can spit commands into it as fast as we can and the kernel module can > > keep up.

  1   2   >