Re: sql using characters like é and ã

2005-12-12 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > Hello, I am switching from VB to python. > I managed to crank my files into a sqlite > dbase, converting the original names to > unicode with s=unicode(s,"latin-1"). > Everything is working fine, but when > I query the dbase with dbapi2 and want > to retrieve names this

Re: Developing a network protocol with Python

2005-12-12 Thread Diez B. Roggisch
> Am I on the right way to develop a new protocol? > Are there any common mistakes that programmers do? > Is there a howto where I can read more about this? If you _must_ develop your own protocol, use at least twisted. But I'd go for an existing solutions out there - namely pyro. No need to inve

Re: Python is incredible!

2005-12-12 Thread Fredrik Lundh
"Tolga" wrote: > Let's suppose that I actually want to leave Lisp totally but what about > AI sources? Most of them are based on Lisp. Oh yes, yes, I know, one > may study AI with any language, even with BASIC, but nearly all > important AI books start with a short Lisp intro. They say that "you d

Rpy: displaying multivariate data with pairs() and coplot()

2005-12-12 Thread malv
Did anybody manage to use pairs() or coplot() from python using the rpy module? In fact any information going a bit beyond Tim Churches' very useful examples on plot() usage in rpy would be highly welcome. Thx. malv -- http://mail.python.org/mailman/listinfo/python-list

ASD Project and python integration

2005-12-12 Thread GRios
Hey folks, some time ago i started searching the web for some tools i would like to have at my disposal. I found some high quality examples, but there was always something i disliked, for instance licensing terms. Then i started my own one. I would like to share them with the comunity. It is comp

Problem with auto-selection in wx masked control

2005-12-12 Thread jean-michel bain-cornu
Hi all, I'm trying to get the whole field selected when the caret arrives into a wx masked control. This is perfectly done with the program below. But if I comment out the line "r= dlg.ShowModal()", I get something different : the data within the field is no more correctly selected. Why ? And is

Newbie: executing a system command from my Python app

2005-12-12 Thread Dan M
I'm writing a Python replacement for a particularly ugly shell script. we are running mimedefang on our mail server, moving spam and virus messages to a quarantine directory. This little python script successfully chdir's to the quarantine directory, identifies all of the quarantine subdirectories

Re: IsString

2005-12-12 Thread Steven Bethard
Tuvas wrote: > I need a function that will tell if a given variable is a character or > a number. Is there a way to do this? Thanks! What's your use case? This need is incommon in Python... STeVe -- http://mail.python.org/mailman/listinfo/python-list

"0 in [True,False]" returns True

2005-12-12 Thread Pierre Quentel
Hi all, In some program I was testing if a variable was a boolean, with this test : if v in [True,False] My script didn't work in some cases and I eventually found that for v = 0 the test returned True So I changed my test for the obvious "if type(v) is bool", but I still find it confusing th

Re: "0 in [True,False]" returns True

2005-12-12 Thread Fredrik Lundh
Pierre Quentel wrote: > In some program I was testing if a variable was a boolean, with this > test : if v in [True,False] > > My script didn't work in some cases and I eventually found that for v = > 0 the test returned True > > So I changed my test for the obvious "if type(v) is bool", but I sti

Re: "0 in [True,False]" returns True

2005-12-12 Thread Carsten Haese
On Mon, 2005-12-12 at 16:26, Pierre Quentel wrote: > Hi all, > > In some program I was testing if a variable was a boolean, with this > test : if v in [True,False] > > My script didn't work in some cases and I eventually found that for v = > 0 the test returned True > > So I changed my test fo

Re: Python is incredible!

2005-12-12 Thread Tolga
I cannot remember where was it, but I saw a sentence in the Internet: "When programming, programmers spend more time for reading than writing". This is definitely true. We don't only read others' code but we also read our code again and again and again. Thus, a language which is easier to read can

debug 'continue' does not appear to work right

2005-12-12 Thread newsposter
When I enter 'c' at the (Pdb) prompt it just goes to the next line, and doesn't "continue" as it should. Here's the sample program: # epdb1.py -- experiment with the Python debugger, pdb import pdb a = "aaa" pdb.set_trace() b = "bbb" c = "ccc" final = a + b + c print final Here's the sample outp

I want a Python Puppy !

2005-12-12 Thread Claudio Grondi
I have just discovered the existance of Puppy Linux which is a complete operating system with a suite of GUI apps, only about 50 - 60M booting directly off the CDROM ( http://www.puppylinux.org ). This approach appears to me very Pythonic, so it were a nice thing to have a full featured Puppy

Re: debug 'continue' does not appear to work right

2005-12-12 Thread newsposter
I was running the above from the command-line, but when I run the program within IDLE, 'c', continue, works as it should. -Chris -- http://mail.python.org/mailman/listinfo/python-list

Re: Using XML w/ Python...

2005-12-12 Thread Jay
Umm, yea, u definatly hijacked my thread. If you didnt mean to then dont But anyway, i get this... >>> import amara >>>from amara import domtools >>> print domtools.py Traceback (most recent call last): File "", line 1, in ? NameError: name 'domtools' is not defined >>> suggestions? -- h

Re: Another newbie question

2005-12-12 Thread John J. Lee
Steve Holden <[EMAIL PROTECTED]> writes: [...] > The "Law" of Demeter isn't about *how* you access objects, it's about > what interfaces to objects you can "legally" manipulate without undue > instability across refactoring. In other words, it's about semantics, > not syntax. And it's led a lot

Re: Using XML w/ Python...

2005-12-12 Thread uche . ogbuji
""" But anyway, i get this... >>> import amara >>>from amara import domtools >>> print domtools.py Traceback (most recent call last): File "", line 1, in ? NameError: name 'domtools' is not defined """ Sheesh! That right after waking up. And it shows :-) Should have been "print domtools.__fi

Re: I want a Python Puppy !

2005-12-12 Thread Diez B. Roggisch
Claudio Grondi schrieb: > I have just discovered the existance of Puppy Linux which is a complete > operating system with a suite of GUI apps, only about 50 - 60M booting > directly off the CDROM ( http://www.puppylinux.org ). > > This approach appears to me very Pythonic, so it were a nice th

Re: IsString

2005-12-12 Thread Steven D'Aprano
On Mon, 12 Dec 2005 14:24:48 -0700, Steven Bethard wrote: > Tuvas wrote: >> I need a function that will tell if a given variable is a character or >> a number. Is there a way to do this? Thanks! > > What's your use case? This need is incommon in Python... No offense to the four or five helpful

Re: I want a Python Puppy !

2005-12-12 Thread Paul Boddie
Claudio Grondi wrote: > I have just discovered the existance of Puppy Linux which is a complete > operating system with a suite of GUI apps, only about 50 - 60M booting > directly off the CDROM ( http://www.puppylinux.org ). This isn't really Python-related, but I thought that Puppy Linux would

Re: Newbie: executing a system command from my Python app

2005-12-12 Thread Dan M
On Mon, 12 Dec 2005 13:25:14 -0800, Dan M wrote: > I'm writing a Python replacement for a particularly ugly shell script. we > are running mimedefang on our mail server, moving spam and virus messages > to a quarantine directory. This little python script successfully chdir's > to the quarantine d

Re: Newbie: executing a system command from my Python app

2005-12-12 Thread James Stroud
Dan M wrote: > I'm writing a Python replacement for a particularly ugly shell script. we > are running mimedefang on our mail server, moving spam and virus messages > to a quarantine directory. This little python script successfully chdir's > to the quarantine directory, identifies all of the quara

Re: Using XML w/ Python...

2005-12-12 Thread Jay
you might be on to something >>> from amara import domtools >>> print domtools.__file__ C:\Python23\lib\site-packages\amara\domtools.pyc >>> -- http://mail.python.org/mailman/listinfo/python-list

Pattern matching with string and list

2005-12-12 Thread olaufr
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I have a list, as below: sentence = "the color is $red" patterns = ["blue","red","yellow"] pos = sentenc

Executing a python script with arguments from a python script

2005-12-12 Thread olaufr
Hi, I need to call a python script, with command line arguments (it is an autonomous script with a __main__), from within another python script. Can I use exec() or execfile() for this? How to pass the arguments? Thanks, Olivier. -- http://mail.python.org/mailman/listinfo/python-list

Re: Executing a python script with arguments from a python script

2005-12-12 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hi, > > I need to call a python script, with command line arguments (it is an > autonomous script with a __main__), from within another python script. > Can I use exec() or execfile() for this? How to pass the arguments? > > Thanks, > > Olivier. > Obligatory "ugh."

Re: Pattern matching with string and list

2005-12-12 Thread Michael Spencer
[EMAIL PROTECTED] wrote: > Hi, > > I'd need to perform simple pattern matching within a string using a > list of possible patterns. For example, I want to know if the substring > starting at position n matches any of the string I have a list, as > below: > > sentence = "the color is $red" > patte

Re: Python is incredible!

2005-12-12 Thread Xavier Morel
Luis M. Gonzalez wrote: > You are not the first lisper who fell inlove with Python... > Check this out: > http://www.paulgraham.com/articles.html > Paul Graham is not in love with Python though, he's still very much in love with Lisp. He merely admits being unfaithful to Lisp from time to time (

Re: how does exception mechanism work?

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, it was written: > [EMAIL PROTECTED] writes: > >> Is this model correct or wrong? Where can I read about the mechanism >> behind exceptions? > > Usually you push exception handlers and "finally" clauses onto the > activation stack like you push return addresses for function c

Re: I want a Python Puppy !

2005-12-12 Thread Claudio Grondi
Diez B. Roggisch wrote: > Claudio Grondi schrieb: > >> I have just discovered the existance of Puppy Linux which is a >> complete operating system with a suite of GUI apps, only about 50 - >> 60M booting directly off the CDROM ( http://www.puppylinux.org ). >> >> This approach appears to me ve

Re: IsString

2005-12-12 Thread Steven Bethard
Steven D'Aprano wrote: > Judging by the tone of the original poster's question, I'd say for sure he > is an utter Python newbie, probably a newbie in programming in general, > so I bet that what (s)he really wants is something like this: > > somefunction("6") > -> It is a number. > > somefunction

Re: "0 in [True,False]" returns True

2005-12-12 Thread Steven Bethard
Pierre Quentel wrote: > In some program I was testing if a variable was a boolean, with this > test : if v in [True,False] > > My script didn't work in some cases and I eventually found that for v = > 0 the test returned True This seems like a strange test. What is this code trying to do? If

Re: Executing a python script with arguments from a python script

2005-12-12 Thread Larry Bates
You can pass arguments into a python script, see getopt module. Then to call an external script you would use subsystem module (or os.system if you are on earlier version of python). If you can, just make the other python program into a function and import it as James Stroud suggests in a separate

Re: Pattern matching with string and list

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005 [EMAIL PROTECTED] wrote: > I'd need to perform simple pattern matching within a string using a list > of possible patterns. For example, I want to know if the substring > starting at position n matches any of the string I have a list, as > below: > > sentence = "the color is

Re: Python is incredible!

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Cameron Laird wrote: > While there is indeed much to love about Lisp, please be aware > that meaningful AI work has already been done in Python Wait - meaningful AI work has been done? ;) tom -- limited to concepts that are meta, generic, abstract and philosophical -- IEE

Re: Python is incredible!

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Tolga wrote: > I am using Common Lisp for a while and nowadays I've heard so much about > Python that finally I've decided to give it a try becuase You read reddit.com, and you want to know why they switched? > Python is not very far away from Lisp family. That's an intere

Re: IsString

2005-12-12 Thread Larry Bates
Steven D'Aprano wrote: > On Mon, 12 Dec 2005 14:24:48 -0700, Steven Bethard wrote: > > >>Tuvas wrote: >> >>>I need a function that will tell if a given variable is a character or >>>a number. Is there a way to do this? Thanks! >> >>What's your use case? This need is incommon in Python... > > >

Re: I want a Python Puppy !

2005-12-12 Thread Claudio Grondi
Paul Boddie wrote: > Claudio Grondi wrote: > >>I have just discovered the existance of Puppy Linux which is a complete >>operating system with a suite of GUI apps, only about 50 - 60M booting >>directly off the CDROM ( http://www.puppylinux.org ). > > > This isn't really Python-related, but I

Re: Using XML w/ Python...

2005-12-12 Thread Jay
Suggestions maybe? -- http://mail.python.org/mailman/listinfo/python-list

Re: Developing a network protocol with Python

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Laszlo Zsolt Nagy wrote: > I think to be effective, I need to use TCP_NODELAY, and manually > buffered transfers. Why? > I would like to create a general messaging object that has methods like > > sendinteger > recvinteger > sendstring > recvstring Okay. So you're really d

Re: OO in Python? ^^

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Bengt Richter wrote: On Mon, 12 Dec 2005 01:12:26 +, Tom Anderson <[EMAIL PROTECTED]> wrote: -- ø¤º°`°º¤øø¤º°`°º¤øø¤º°`°º¤øø¤º°`°º¤ø [OT} (just taking liberties with your sig ;-) ,<@><

Syntax and speed

2005-12-12 Thread bearophileHUGS
ShedSkin (http://shed-skin.blogspot.com) has taught me something: simple syntax and high speed can often go together, in a computer language. This means two things: 1) A "fast language" can have a simple (python-like) syntax. For example a language fast as C++ can allow: d = {"hello":1} as a synt

Re: OO in Python? ^^

2005-12-12 Thread Tom Anderson
On Mon, 12 Dec 2005, Donn Cave wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Alex Martelli) wrote: > >> Tom Anderson <[EMAIL PROTECTED]> wrote: >>... >> >> >>> For example, if i wrote code like this (using python syntax): >>> >>> def f(x): >>> return 1 + x >>> >>> The com

Re: OO in Python? ^^

2005-12-12 Thread bonono
Tom Anderson wrote: > While we're on the subject of Haskell - if you think python's > syntactically significant whitespace is icky, have a look at Haskell's > 'layout' - i almost wet myself in terror when i saw that! > Though one doesn't need to use indentation and write everything using {} in Has

Re: instance + classmethod question

2005-12-12 Thread Mike Meyer
Laszlo Zsolt Nagy <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >>Laszlo Zsolt Nagy <[EMAIL PROTECTED]> writes: >>>Is it possible to tell, which instance was used to call the >>>classmethod that is currently running? >>Ok, I read through what got to my nntp server, and I'm still >>completely conf

How to Refresh the Desktop window with python script

2005-12-12 Thread muttu2244
Hi everybody I have couple of questions, 1) How can i refresh my desktop window(wallpaper), using the python script, after pasting some data on the desktop. 2) How can i run an exe file from the python 3) How can i get the information of a machine like "computer name", "mac address", "ip addres

Re: debug 'continue' does not appear to work right

2005-12-12 Thread David Wahler
[EMAIL PROTECTED] wrote: > When I enter 'c' at the (Pdb) prompt it just goes to the next line, and > doesn't "continue" as it should. [...] > > Here's the sample output: > > S:\tmp>python epdb1.py > --Return-- > > c:\python21\lib\pdb.py(895)set_trace()->None > -> Pdb().set_trace() [...] Works for

Re: Using XML w/ Python...

2005-12-12 Thread Jay
come on guys, the post isnt dead yet -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Refresh the Desktop window with python script

2005-12-12 Thread Gary Herron
[EMAIL PROTECTED] wrote: >Hi everybody > >I have couple of questions, > >1) How can i refresh my desktop window(wallpaper), using the python >script, after pasting some data on the desktop. > > The is *way* too operating system and window system dependent to answer without more knowledge. >2)

Re: "0 in [True,False]" returns True

2005-12-12 Thread David Wahler
Pierre Quentel wrote: > Hi all, > > In some program I was testing if a variable was a boolean, with this > test : if v in [True,False] > > My script didn't work in some cases and I eventually found that for v = > 0 the test returned True > > So I changed my test for the obvious "if type(v) is bool"

Re: Executing a python script with arguments from a python script

2005-12-12 Thread James Stroud
Larry Bates wrote: > You can pass arguments into a python script, see getopt module. > Then to call an external script you would use subsystem module > (or os.system if you are on earlier version of python). I think getopt is a little dated. Try optparse. To quote the python documentation, it is

PythonWin troubleshooting

2005-12-12 Thread chuck
Having problems with PythonWin on Windows XP SP1. Shortly after startup and trying to debug I see: LoadBarState failed - LoadBarState failed (with win32 exception!) Things go down hill quickly from there. From there I see stuff like: [Dbg]>>> Traceback (most recent call last): File "C:\Pytho

Re: PythonWin troubleshooting

2005-12-12 Thread chuck
Build 205 for the win32 ext. -- http://mail.python.org/mailman/listinfo/python-list

Re: "0 in [True,False]" returns True

2005-12-12 Thread bonono
Fredrik Lundh wrote: > Pierre Quentel wrote: > > > In some program I was testing if a variable was a boolean, with this > > test : if v in [True,False] > > > > My script didn't work in some cases and I eventually found that for v = > > 0 the test returned True > > > > So I changed my test for the

ActivePython and Amara

2005-12-12 Thread Jay
Ok, i had this posted on the other thread "XML w/ Python" but it kinda got off topic from the title to ill start a new thread. My question is this... the import of amara works in ActivePython... PythonWin 2.3.5 (#62, Feb 9 2005, 16:17:08) [MSC v.1200 32 bit (Intel)] on win32. Portions Copyright

Re: ActivePython and Amara

2005-12-12 Thread alex23
The thread didn't go "off topic", the "hijacker" was reporting on errors with Amara's Windows installer that COULD BE RESPONSIBLE FOR THE PROBLEMS YOU ARE EXPERIENCING. If you had ANY understanding of Python, you would have realised this. Sometimes you really need to slow down and learn something

Python Graph API

2005-12-12 Thread Nathan Gilbert
Has there been any work done lately on the Python Graph API? Thanks in advance, NG -- "The life of a repoman is always intense." -- http://mail.python.org/mailman/listinfo/python-list

Re: Using XML w/ Python...

2005-12-12 Thread uche . ogbuji
Rick, thanks. Based on your clue I checked, and it seems those Amara packages are not being built rightly. I'll look to get those packages fixed and updated tomorrow. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.nethttp://fourthought.com h

Re: ActivePython and Amara

2005-12-12 Thread Jay
Woah woah woah, calm your ass down a little. I didn't say that the "hijacker" made it go off topic. Did I? I just said that the thread was going off topic from the dam title. We weren't talking about XML no more now were we. And who the hell are you talking to thinking that I haven't researched my

Re: Using XML w/ Python...

2005-12-12 Thread Jay
ok, thx -- http://mail.python.org/mailman/listinfo/python-list

Re: how does exception mechanism work?

2005-12-12 Thread Ben Hutchings
Tom Anderson <[EMAIL PROTECTED]> wrote: > On Mon, 12 Dec 2005, it was written: > >> [EMAIL PROTECTED] writes: >> >>> Is this model correct or wrong? Where can I read about the mechanism >>> behind exceptions? >> >> Usually you push exception handlers and "finally" clauses onto the >> activation s

newbie: generate a function based on an expression

2005-12-12 Thread Jacob Rael
Hello, I would like write a function that I can pass an expression and a dictionary with values. The function would return a function that evaluates the expression on an input. For example: fun = genFun("A*x+off", {'A': 3.0, 'off': -0.5, 'Max': 2.0, 'Min': -2.0} ) >>> fun(0) -0.5 >>> fun(-10) -

Re: ActivePython and Amara

2005-12-12 Thread Jay
On that note... I would like to open up the floor again.. lol -- http://mail.python.org/mailman/listinfo/python-list

Re: OO in Python? ^^

2005-12-12 Thread Donn Cave
Quoth Tom Anderson <[EMAIL PROTECTED]>: ... | While we're on the subject of Haskell - if you think python's | syntactically significant whitespace is icky, have a look at Haskell's | 'layout' - i almost wet myself in terror when i saw that! That's funny. I don't think I ever bothered to acquain

newbie: generate a function based on an expression

2005-12-12 Thread Ezequiel, Justin
>>> def genFun(expr, locs): ... return lambda x: eval('min(Max,max(Min,%s))' % expr, locs, {'x': x}) ... >>> fun = genFun("A*x+off", {'A': 3.0, 'off': -0.5, 'Max': 2.0, 'Min': -2.0} ) >>> fun at 0x011B1470> >>> fun(0) -0.5 >>> fun(-10) -2.0 >>> fun(10) 2.0 >>> -- http://mail.python.org/mai

Re: newbie: generate a function based on an expression

2005-12-12 Thread Michael Spencer
Jacob Rael wrote: > Hello, > > I would like write a function that I can pass an expression and a > dictionary with values. The function would return a function that > evaluates the expression on an input. For example: > > fun = genFun("A*x+off", {'A': 3.0, 'off': -0.5, 'Max': 2.0, 'Min': > -2.0}

Re: newbie: generate a function based on an expression

2005-12-12 Thread Mike Meyer
"Jacob Rael" <[EMAIL PROTECTED]> writes: > Hello, > I would like write a function that I can pass an expression and a > dictionary with values. The function would return a function that > evaluates the expression on an input. For example: > > fun = genFun("A*x+off", {'A': 3.0, 'off': -0.5, 'Max': 2

Re: ActivePython and Amara

2005-12-12 Thread alex23
Jay wrote: > Woah woah woah, calm your ass down a little. > > I didn't say that the "hijacker" made it go off topic. Did I? I just > said that the thread was going off topic from the dam title. We > weren't talking about XML no more now were we. They were discussing _why_ the XML module you were t

Re: "0 in [True,False]" returns True

2005-12-12 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > > but seriously, unless you're writing an introspection tool, testing for > > bool is pretty silly. just use "if v" or "if not v", and leave the rest to > > Python. > > > The OP's code(and his work around) doesn't look like he is testing for > boolean which of course e

Re: "0 in [True,False]" returns True

2005-12-12 Thread bonono
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > > but seriously, unless you're writing an introspection tool, testing for > > > bool is pretty silly. just use "if v" or "if not v", and leave the rest > > > to > > > Python. > > > > > The OP's code(and his work around) doesn't look like he i

<    1   2