Re: Using ElementTree to tidy up an XML string to my liking

2006-02-23 Thread Simon Dahlbacka
..I hope that you are aware that xml is *case sensitive* -- http://mail.python.org/mailman/listinfo/python-list

Re: ls files --> list packer

2006-02-23 Thread I V
kpp9c wrote: > Namely i have organized a bunch of folders that have soundfiles in them > and would like Python to slurp up all the .aif/.aiff (or .wav whatever) > files in a given set of directories. My friend hacked up this is perl: > > $files = `ls /snd/Public/*.aiff`; You could use posix.popen

Re: ls files --> list packer

2006-02-23 Thread kpp9c
and one example of a slightly fancier version would be a variation that looks recursively into subdirectories and makes separate lists for each subdirectory encountered. so if i had a directory called "~/snd/" and in "~/snd/" i had: "~/snd/one/" "~/snd/two/" "~/snd/three/" each with soundfiles

Re: 'rar' is not recognized as an internal or external command��������

2006-02-23 Thread cn.popeye
os.chdir() ? thank you! -- "Dennis Lee Bieber" <[EMAIL PROTECTED]> news:[EMAIL PROTECTED] > On Fri, 24 Feb 2006 11:36:08 +0800, "Ê÷Éϲä»Ò" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > thank everyone!!! > > > I'd had to run to work so couldn't test, b

ls files --> list packer

2006-02-23 Thread kpp9c
I would like to use the power of Python to build some list structures for me. Namely i have organized a bunch of folders that have soundfiles in them and would like Python to slurp up all the .aif/.aiff (or .wav whatever) files in a given set of directories. My friend hacked up this is perl: $fil

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Paul Rubin
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > Any chance they all tend to have slow clocks, and are getting bitten > by a semi-random NTP time update; my machine tends to run the NTP update > at 7-day intervals (including time of day), counting from the last > successful synchronization. T

Re: CSV module and UNICODE

2006-02-23 Thread Rudy Schockaert
Thanks a lot Skip. Sure that this will help. Learned two things: how to do it and to look at the docs for 2.5 also. These samples are not in the 2.4.2 reference guide. RudyOn 2/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Rudy> I'm having problems writing unicode to a csv file.Rud

Re: PyAtom, a Python module for creating Atom syndication feeds

2006-02-23 Thread Steve R. Hastings
I have edited PyAtom, and now it should be in better conformance with the PEP 8 guidelines. It is available from the same place as before: http://www.blarg.net/~steveha/pyatom.tar.gz -- Steve R. Hastings"Vita est" [EMAIL PROTECTED]http://www.blarg.net/~steveha -- http://mail.python.or

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Grant Edwards
On 2006-02-23, Paul Probert <[EMAIL PROTECTED]> wrote: >>In similar situation I would start to blame the hardware for the >>problem, so below a kind of checklist to go through: > > Thanks for the reply. I should have mentioned, this happens to just > about every machine in our collection of ab

Re: 'rar' is not recognized as an internal or external command��������

2006-02-23 Thread ���ϲ��
thank everyone!!! the code: import os import time source = [r'e:\temp\code',r'e:\temp\domains'] target_dir = r'e:\temp\bak' target = target_dir+time.strftime('%Y%m%d%H%M%S')+'.rar' rar_cmd = "D:\\Progra~1\\WinRAR\\rar.exe a -idcdp %s %s" % (target,' '.join(source)) print rar_cmd if os.system(rar_

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread John Zenger
How about r"\s+[\n\r]+|\s+$" ? Franz Steinhaeusler wrote: > Hello, I need a regularexpression, which trims trailing whitespaces. > > While with unix line endings, it works; > but not with Window (Dos) CRLF's: > > import re retrailingwhitespace = re.compile('(?<=\S)[ \t]+$', re.MULTILI

Re: Python stdout and Win 2003

2006-02-23 Thread Philippe Martin
PS: I forgot to mention that some of the "print"s are made from wxPython timer events. Philippe Philippe Martin wrote: > Hi, > > I have a program at a customer's site that seems to have random problem > which eventually come down to not being able to read/write from serial > ports. > > I trap

Re: Python vs. Lisp -- please explain

2006-02-23 Thread Peter Mayne
Torsten Bronger wrote: > Another example: is Java the bytecode, which is compiled from Java the language, interpreted or not? Even when the HotSpot JIT cuts in? >>> It is partly interpreted and partly compiled. That's why it's >>> faster than Python. >> But Python is partly interpr

Re: Pickling/unpickling Cookie.SimpleCookie fails with protocol=2

2006-02-23 Thread Paul Rubin
"Erwin S. Andreasen" <[EMAIL PROTECTED]> writes: > Pickling a Cookie.SimpleCookie (or SmartCookie) when using protocol=2 > seems to do something very strange. Protocol 0/1 work fine: Don't use SmartCookies because of the security issue. See the docs. -- http://mail.python.org/mailman/listinfo/py

Re: CSV module and UNICODE

2006-02-23 Thread skip
Rudy> I'm having problems writing unicode to a csv file. Rudy> I use the following code: ... Have you tried the example UnicodeReader and UnicodeWriter classes in the module documentation: http://www.python.org/dev/doc/devel/lib/node631.html While the csv module is 8-bit clean i

Python stdout and Win 2003

2006-02-23 Thread Philippe Martin
Hi, I have a program at a customer's site that seems to have random problem which eventually come down to not being able to read/write from serial ports. I trapped all the exceptions I could think of and all of them look like this: *** (ACCESS CONTROL)Fri, 24 Feb 2

Pickling/unpickling Cookie.SimpleCookie fails with protocol=2

2006-02-23 Thread Erwin S. Andreasen
Pickling a Cookie.SimpleCookie (or SmartCookie) when using protocol=2 seems to do something very strange. Protocol 0/1 work fine: $ python2.4 Python 2.4.2 (#2, Nov 20 2005, 17:04:48) [GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2 Type "help", "copyright", "credits" or "license" for

Re: A C-like if statement

2006-02-23 Thread Terry Hancock
On Fri, 24 Feb 2006 09:14:53 +1100 "Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > There are *reasons* why Python discourages functions with > side-effects. Side-effects make your code hard to test and > harder to debug. You of course meant "expressions with side-effects". Python is pretty good at

Re: pyserial

2006-02-23 Thread Petr Jakes
Few notes from the Python beginner :) HTH. I do not understand what do you mean by the expression: " I can read data without try and try again." Can you be more specific please. I do not understand what do you exactly mean. AFIK the pyserial is waiting while the data occur on the serial por

Re: why don't many test frameworks support file-output?

2006-02-23 Thread kanchy kang
I don't think redirecting stdout to a file is a good resolution. How to organize the output file is very important. in my imagination, there should be one directory "log", where log files are saved. and, log files should be separated according to some method(for example, one test file one log fi

Re: What's up with this code?

2006-02-23 Thread Kent Johnson
Gregory Petrosyan wrote: > Again, thanks a lot! > I'm optimising my polynomial module as hard as possible, because when > it used native floats/integers it was very fast, but in some specific > cases -- too inaccurate. So, I migrated to decimals, and module began > to be very slow. Current success

Re: A C-like if statement

2006-02-23 Thread Paul Rubin
"Bob Greschke" <[EMAIL PROTECTED]> writes: > I miss being able to do something like this in Python > > 1f (I = a.find("3")) != -1: > print "It's here: ", I > else: > print "No 3's here" > > where I gets assigned the index returned by find() AND the if statement gets > to do its job in th

Re: pyFltk-1.1

2006-02-23 Thread James Stroud
george williams wrote: > By god this sounds interesting I wish I > knew what you are talking about > George-- Original Message - > From: "andreas" <[EMAIL PROTECTED]> > Newsgroups: comp.lang.python.announce > To: <[EMAIL PROTECTED]> > Sent: Wednesday, February 22, 2006 6:14 AM > Subject: ANN:

Re: A C-like if statement

2006-02-23 Thread bonono
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 12:04:38 -0700, Bob Greschke wrote: > > >> try: > >>i = a.find("3") > >>print "It's here: ", i > >> except NotFound: > >>print "No 3's here" > > > > Nuts. I guess you're right. It wouldn't be proper. Things are added or > > proposed every

PYTHONPATH?

2006-02-23 Thread Dr. Pastor
Several Documents about Python refer to PYTHONPATH. I could not find such variable. (Python 2.4.2, IDLE 1.1.2, Windows XP) How should/could I nominate a Directory to be the local Directory? Thanks for any guidance. -- http://mail.python.org/mailman/listinfo/python-list

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Benji York
Paul Probert wrote: [snip my slightly-snotty quoting of the sleep.time docs] >Thanks, but yes, I had read that before posting. One would think, > though, that the extra 200 seconds is a bit extreme to be blamable on > system scheduling granularity. I didn't intend to invoke scheduling gran

Re: "Temporary" Variable

2006-02-23 Thread Jeffrey Schwab
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: > > My comments inserted inline. > > > >>#!/usr/bin/python >>#simple guessing game, with numbers >>import random >>spam = random.randint(1, 100) > > > It is bad programming practice to give variables uninformative

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Jeffrey Schwab
Larry Bates wrote: > IMHO leading and/or trailing spaces in filenames is asking for > incompatibilities with cross-platform file access. With what platforms specifically? > Much like > using single-quote in filenames which are perfectly legal in > DOS/Windows, but Linux doesn't like much. Uh...

Re: How would you open this file?

2006-02-23 Thread Bob
Thanks all! That helps out a lot! Python is kinda' cool... -- http://mail.python.org/mailman/listinfo/python-list

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Claudio Grondi
Paul Probert wrote: > Peter Hansen wrote: > >> Are you saying that you believe the time.sleep(1) call is actually >> blocking for 200 seconds? Or just that your loop (and we can only >> guess what it looks like) is the one taking that long? >> >> If the former, try something like putting "print

Help with questor

2006-02-23 Thread S Streat
  I am new to python and computer programming. I am trying to save the questor.py file so that it retains it's data. My problem is that I don't really understand how to do it. I have been reviewing tutorials and I have gotten this far, but the data still doesn't save. Can someone tell me what it i

Re: remote module importing (urlimport)

2006-02-23 Thread Jure Vrscaj
Sorry for the duplicate, I had some postfix issues. cheers, jure -- http://mail.python.org/mailman/listinfo/python-list

Re: Fail in sending UDP packet

2006-02-23 Thread Sbaush
No one of you has a idea??On 2/23/06, Sbaush <[EMAIL PROTECTED]> wrote: Hi all. I've attached my SendReceive class. I have e a big problem! My program create a packet, then call the send function to send this. the first time the packet is not sent, then it works perfectly!WHY??? Have you idea?? --

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Felipe Almeida Lessa
Em Qui, 2006-02-23 às 15:26 -0600, Paul Probert escreveu: >My app runs in a loop looking for changes in a database, and like a > good boy I call time.sleep(1) inside the loop. Unfortunately this > sometimes runs for 200 seconds or so, presumably while my OS is calling > Bill Gates to tell hi

Re: Concantenation and string slicing

2006-02-23 Thread Larry Bates
DannyB wrote: > I've written a program that takes a phrase and spits it back out > backwards. My problem is it throws each character on a new line. I'd > like the phrase to be on the same line. Is this possible? > > #Backward Message > > message = raw_input("Enter a message: ") > letter = len

IRC Bot trouble..

2006-02-23 Thread yawgmoth7
I'm currently writing a IRC bot for fun...here is the code that I have writen so far: import sys import socket import string import time HOST="irc.freenode.net" PORT=6667 NICK="PapaJorgio_" IDENT="Papa" REALNAME="Jorgio" CHANNEL = "#holder" buffer = "" clientsock=socket.socket() clientsock.connect

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Peter Hansen
Paul Probert wrote: > Peter Hansen wrote: >>Are you saying that you believe the time.sleep(1) call is actually >>blocking for 200 seconds? Or just that your loop (and we can only guess >>what it looks like) is the one taking that long? > > Yes, I'm doing this: >. > old

remote module importing (urlimport)

2006-02-23 Thread Jure Vrscaj
Hi, as title implies, I wrote a simple module that allows importing modules or even packages via http, conceptually similar to zipimport (of which I learned about during the process of writing urlimport, and found it very useful). The module is fresh new as it was written today, and tested onl

Re: What's up with this code?

2006-02-23 Thread Gregory Petrosyan
Again, thanks a lot! I'm optimising my polynomial module as hard as possible, because when it used native floats/integers it was very fast, but in some specific cases -- too inaccurate. So, I migrated to decimals, and module began to be very slow. Current success is nearly 4x speedup, and now it se

Re: How would you open this file?

2006-02-23 Thread Larry Bates
Bob wrote: > I want to open a file in a function and pass the file back to main so > another function can manipulate the file, something like this: > > # begin > def open_file() > filename=open(options.filename_input,'r') > return filename > > open_file() > print filename.read() > filename.cl

Re: How would you open this file?

2006-02-23 Thread Dave Hansen
On Thu, 23 Feb 2006 18:01:32 -0500 in comp.lang.python, Kent Johnson <[EMAIL PROTECTED]> wrote: [...] > >filename = open_file() > >By the way 'filename' is a pretty bad name, since it contains a file >object, not a string. Maybe call it f instead. ('file' is also a bad >name because it is the na

Re: Concantenation and string slicing

2006-02-23 Thread CatDude
On Thu, 23 Feb 2006 14:55:16 -0800, DannyB wrote: > I've written a program that takes a phrase and spits it back out > backwards. My problem is it throws each character on a new line. I'd > like the phrase to be on the same line. Is this possible? First suggestion: Put a comma at the end of th

remote module importing (urlimport)

2006-02-23 Thread Jure Vrscaj
Hi, as title implies, I wrote a simple module that allows importing modules or even packages via http, conceptually similar to zipimport (of which I learned about during the process of writing urlimport, and found it very useful). The module is fresh new as it was written today, and tested onl

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Larry Bates
Steven D'Aprano wrote: > On Thu, 23 Feb 2006 14:30:22 -0600, Larry Bates wrote: > >> How about not naming files with leading and trailing spaces on >> the Mac? Seems like a bad habit that needs breaking ;-). > > Why is it a bad habit? Because *Windows* is primitive enough that it can't > cope w

Re: a little more help with python server-side scripting

2006-02-23 Thread Paul Boddie
John Salerno wrote: > Paul Boddie wrote: > > > No, it means that you either write Python programs which produce pages > > as output, according to the CGI specification, or that you embed Python > > code inside ASP files, as described in the above document. > > > I haven't used ASP, and I've been wo

Re: Concantenation and string slicing

2006-02-23 Thread DannyB
Wow - thats simple =). Thanks a ton!! -- http://mail.python.org/mailman/listinfo/python-list

Re: a little more help with python server-side scripting

2006-02-23 Thread Gerard Flanagan
John Salerno wrote: > > Ok, seems like the verdict is that the server doesn't have mod_python > nor does it detect the .psp extension. It can, however, detect the .py > extension. But does this mean I can simply include Python code in my > HTML files, and then give my HTML files a .py extension? N

Re: Concantenation and string slicing

2006-02-23 Thread nak
add a dash like shown below >>> print newMessage, -- http://mail.python.org/mailman/listinfo/python-list

Re: What's up with this code?

2006-02-23 Thread Scott David Daniels
Gregory Petrosyan wrote: > Oh, by the way, is there any documentation about time of execution of > standard functions? Nope. The reason is (A) that's a lot of work, (B) there are too many caveats in practice to make such information useful, (C) any such spec might corner the possible implementatio

Re: How would you open this file?

2006-02-23 Thread Kent Johnson
Bob wrote: > I want to open a file in a function and pass the file back to main so > another function can manipulate the file, something like this: > > # begin > def open_file() > filename=open(options.filename_input,'r') > return filename > > open_file() > print filename.read() > filename.cl

Concantenation and string slicing

2006-02-23 Thread DannyB
I've written a program that takes a phrase and spits it back out backwards. My problem is it throws each character on a new line. I'd like the phrase to be on the same line. Is this possible? #Backward Message message = raw_input("Enter a message: ") letter = len(message) while (letter > 0):

How would you open this file?

2006-02-23 Thread Bob
I want to open a file in a function and pass the file back to main so another function can manipulate the file, something like this: # begin def open_file() filename=open(options.filename_input,'r') return filename open_file() print filename.read() filename.close() # end But this doesn't wor

Re: Using a list of RGB data for Canvas widget? [(R1, G1, B1), (R2, G2, B2) etc.]

2006-02-23 Thread Nainto
Just to clarify. I'm not asking for any code. A ink or explination of how to convert a list of this type to BitmapImage or PhotoImage data would be very helpful. -- http://mail.python.org/mailman/listinfo/python-list

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 14:30:22 -0600, Larry Bates wrote: > How about not naming files with leading and trailing spaces on > the Mac? Seems like a bad habit that needs breaking ;-). Why is it a bad habit? Because *Windows* is primitive enough that it can't cope with leading and trailing spaces? I d

Re: "Temporary" Variable

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 12:05:59 -0800, darthbob88 wrote: My comments inserted inline. > #!/usr/bin/python > #simple guessing game, with numbers > import random > spam = random.randint(1, 100) It is bad programming practice to give variables uninformative joke names. How about target instead? > p

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Paul Probert
Peter Hansen wrote: >Are you saying that you believe the time.sleep(1) call is actually >blocking for 200 seconds? Or just that your loop (and we can only guess >what it looks like) is the one taking that long? > >If the former, try something like putting "print 'before'" and "print >'after'"

Re: A C-like if statement

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 12:04:38 -0700, Bob Greschke wrote: >> try: >>i = a.find("3") >>print "It's here: ", i >> except NotFound: >>print "No 3's here" > > Nuts. I guess you're right. It wouldn't be proper. Things are added or > proposed every day for Python that I can't even pronoun

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Paul Probert
Benji York wrote: >Paul Probert wrote: > > Hi, My app runs in a loop looking for changes in a database, and like > > a good boy I call time.sleep(1) inside the loop. Unfortunately this > > sometimes runs for 200 seconds or so, presumably while my OS is > > calling Bill Gates to tell him what I've

Re: Unexpected timing results

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 10:07:14 -0600, Larry Bates wrote: >> Of course I expect timer2 should take longer to execute in total, >> because it is doing a lot more work. But it seems to me that all that >> extra work should not affect the time measured, which (I imagine) should >> be about the same as t

Re: PyDev/Eclipse Help

2006-02-23 Thread Don Taylor
Greg Lindstrom wrote: > I am running Python 2.4 on Windows XP "Professional" and Eclipse 3.1. I > would like to take a look at PyDev on Eclipse and downloaded the PyDev > (1.0.2?) via the Help->SotwareUpdates->FindAndInstall wizard. Then then > go to create a Python Project with File->New->Pro

Re: 2.4.2 + Zone Alarm

2006-02-23 Thread DaveM
On 20 Feb 2006 16:26:15 -0800, "DannyB" <[EMAIL PROTECTED]> wrote: >I believe this issue is known - I haven't found a way around it. > >ZoneAlarm seems to be stopping IDLE from running. >I get two errors: > >"Socket Error: Connection refused" >and >"IDLE's subprocess didn'tt make connection. Eit

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Paul Probert
Claudio Grondi wrote: >In similar situation I would start to blame the hardware for the >problem, so below a kind of checklist to go through: > > 1. have you changed any hardware? > 2. have you installed new drivers? > 3. have you connected via USB/Firewire/IDE or other interfaces/ports >e

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Ivan Shevanski
On 2/23/06, Claudio Grondi <[EMAIL PROTECTED]> wrote: Paul Probert wrote:> Hi,>   My app runs in a loop looking for changes in a database, and like a> good boy I call time.sleep(1) inside the loop. Unfortunately this> sometimes runs for 200 seconds or so, presumably while my OS is calling > Bill Ga

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Peter Hansen
Paul Probert wrote: >My app runs in a loop looking for changes in a database, and like a > good boy I call time.sleep(1) inside the loop. Unfortunately this > sometimes runs for 200 seconds or so, presumably while my OS is calling > Bill Gates to tell him what I've been doing. This happens u

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Claudio Grondi
Paul Probert wrote: > Hi, > My app runs in a loop looking for changes in a database, and like a > good boy I call time.sleep(1) inside the loop. Unfortunately this > sometimes runs for 200 seconds or so, presumably while my OS is calling > Bill Gates to tell him what I've been doing. This happ

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Benji York
Paul Probert wrote: > Hi, My app runs in a loop looking for changes in a database, and like > a good boy I call time.sleep(1) inside the loop. Unfortunately this > sometimes runs for 200 seconds or so, presumably while my OS is > calling Bill Gates to tell him what I've been doing. This happens

Re: a little more help with python server-side scripting

2006-02-23 Thread John Salerno
Paul Boddie wrote: > No, it means that you either write Python programs which produce pages > as output, according to the CGI specification, or that you embed Python > code inside ASP files, as described in the above document. > I haven't used ASP, and I've been working hard to remove from my mem

time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-23 Thread Paul Probert
Hi, My app runs in a loop looking for changes in a database, and like a good boy I call time.sleep(1) inside the loop. Unfortunately this sometimes runs for 200 seconds or so, presumably while my OS is calling Bill Gates to tell him what I've been doing. This happens under NT4, W2k, and XP.

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread [EMAIL PROTECTED]
rtilley wrote: > # Spaces are present before and after the XXX > filename = ' XXX ' > > new_filename = filename.strip() > > if new_filename != filename: > print filename > > Macs allow these spaces in file and folder names. Which is OK. The > problem arises when the file or folder is copied to

Re: a little more help with python server-side scripting

2006-02-23 Thread Paul Boddie
John Salerno wrote: > John Salerno wrote: > > > Unfortunately, I don't completely understand what it is I need to do > > now. Where do I put the path they mentioned? And what do they mean by my > > script path? > > Ok, seems like the verdict is that the server doesn't have mod_python > nor does it

Re: problem with newlines in regexp substitution

2006-02-23 Thread James Stroud
Florian Schulze wrote: > See the following results: > > Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > import re s = "1" re.sub('1','\\n',s) > > '\n' > '\\n' > > '\

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Larry Bates
rtilley wrote: > Larry Bates wrote: >> How about not naming files with leading and trailing spaces on >> the Mac? Seems like a bad habit that needs breaking ;-). >> >> -Larry Bates > > Users will be users! Tell that to the guys and gals on Macs who like to > make a folder sort based on the number

Re: ANN: Urwid 0.9.0 - Console UI library

2006-02-23 Thread Ian Ward
Thomas Dickey wrote: > Ian Ward <[EMAIL PROTECTED]> wrote: > >> - New raw_display module that handles console display without relying >>on external libraries. This module was written as a work around >>for the lack of UTF-8 support in the standard version of ncurses. > > > The "standar

Re: "Temporary" Variable

2006-02-23 Thread Rick Zantow
[EMAIL PROTECTED] wrote in news:1140725159.143882.202630 @j33g2000cwa.googlegroups.com: > > Steven D'Aprano wrote: >> You could try this: >> >> while 1: >> var = raw_input("Give me some data! ") >> if var == "some data": >> print "Success!" >> break >> else: >>

Re: MySQLdb slow on MySQL 5

2006-02-23 Thread [EMAIL PROTECTED]
Gerhard Häring wrote: > > Maybe you're running in autocommit mode. I. e. an implicit COMMIT is > done for each insert. This slows any database down. > > Or are you calling commit() yourself too often? > > -- Gerhard I'm not calling COMMIT at all. I'm using MyISAM tables. I'll check on autocommit.

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread rtilley
Larry Bates wrote: > How about not naming files with leading and trailing spaces on > the Mac? Seems like a bad habit that needs breaking ;-). > > -Larry Bates Users will be users! Tell that to the guys and gals on Macs who like to make a folder sort based on the number of spaces they've placed

Re: How to move optparse from main to function?

2006-02-23 Thread Bob
Yes the documentation is helpful, but I wouldn't have been able to do what you did in your code by just looking at section 6.21.2.9. I thought I could put "parser = parserSetup()" and "(options, args) = parser.parse_args()" in the function. Thanks for helping out with that! -- http://mail.python.

Re: spaces at ends of filenames or directory names on Win32

2006-02-23 Thread Larry Bates
rtilley wrote: > # Spaces are present before and after the XXX > filename = ' XXX ' > > new_filename = filename.strip() > > if new_filename != filename: > print filename > > Macs allow these spaces in file and folder names. Which is OK. The > problem arises when the file or folder is copied

Re: How to move optparse from main to function?

2006-02-23 Thread Bob
The module documentation helped me construct the meat of my code bu it didn't lend a hand on how to build the real meal deal the way Jason's explanation did. -- http://mail.python.org/mailman/listinfo/python-list

Re: a little more help with python server-side scripting

2006-02-23 Thread John Salerno
John Salerno wrote: > Unfortunately, I don't completely understand what it is I need to do > now. Where do I put the path they mentioned? And what do they mean by my > script path? Ok, seems like the verdict is that the server doesn't have mod_python nor does it detect the .psp extension. It c

Re: "Temporary" Variable

2006-02-23 Thread darthbob88
Steven D'Aprano wrote: > [EMAIL PROTECTED] wrote: > > > Problem: I wish to run an infinite loop and initialize a variable on > > each iteration. Sort of like, "Enter Data", test it, "No good!", "Next > > Try?", test it, etc. What I've tried is simply while 1: var1 = > > raw_input, test var1, then

Re: How to move optparse from main to function?

2006-02-23 Thread Jason Drew
As pointed out, the module documentation is helpful. For your 'test' option, I don't think 'action="count"' is the best action. 'Test' is basically an on/off option, so why count it? I would use: parser.add_option("-t", "--test", action="store_true", dest="optparse_test", default=False, help="tes

Re: why don't many test frameworks support file-output?

2006-02-23 Thread Benji York
kanchy kang wrote: > i browsed the following frameworks briefly: nose, OOBTest, > testosterone, py.test, Sancho ... and found out they do support > imediate screen-output only. You can redirect stdout to a file. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list

Re: A C-like if statement

2006-02-23 Thread Dave Hansen
On Thu, 23 Feb 2006 12:04:38 -0700 in comp.lang.python, "Bob Greschke" <[EMAIL PROTECTED]> wrote: > >"Roy Smith" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] [...] >> try: >>i = a.find("3") >>print "It's here: ", i >> except NotFound: >>print "No 3's here" > >Nuts. I

Re: editor for Python on Linux

2006-02-23 Thread Philippe Martin
Mladen Adamovic wrote: > Hi! > > I wonder which editor or IDE you can recommend me for writing Python > programs. I tried with jEdit but it isn't perfect. Eclipse + pydev -- http://mail.python.org/mailman/listinfo/python-list

Re: pyserial

2006-02-23 Thread Philippe Martin
Hi, I never found the need to flush anything and I always use inWaiting prior to reader. A+ Philippe Mimi wrote: > Hi, > I use the pyserial to read data from a serial port. > My code is in window Xp and python 2.4. when I use Hyperteminal I can > read data without try and try again that it i

Re: Python vs. Lisp -- please explain

2006-02-23 Thread dlp
> Paul Rubin wrote: > I think both of you are missing the point of the question, which is > that Lisp is dynamically typed exactly the way Python is and maps to > Python almost directly; yet good Lisp implementations are much faster > than CPython. But Lisp isn't dynamically typed "exactly the way

Re: How to move optparse from main to function?

2006-02-23 Thread Giles Brown
Doesn't the module documentation ... http://docs.python.org/lib/optparse-putting-it-all-together.html ... tell you what you need? Giles -- http://mail.python.org/mailman/listinfo/python-list

execfile time out?

2006-02-23 Thread Brian Blais
Hello, I'd like to do something like: try: execfile_timeout("somefile.py",5) # time out after 5 seconds except TimeOutError: print "this timed out!" is there something that would do this? I'd like to call "somefile.py", but if it has an infinite loop, I don't want to freez

Re: A C-like if statement

2006-02-23 Thread Giles Brown
But maybe we're talking about string methods so to get an exception we'd want to use "index" instead of "find". Giles -- http://mail.python.org/mailman/listinfo/python-list

execfile error exception line number?

2006-02-23 Thread Brian Blais
Hello, I'd like to do the following: import sys try: execfile("somefile.py") except: s=sys.exc_info() print "Error '%s' happened on line %d" % (s[1],s[2].tb_lineno) (I'm going to replace the print later with a gui dialog) how can I get the line number in "somefile.py" w

Re: A C-like if statement

2006-02-23 Thread Bob Greschke
"Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Bob Greschke <[EMAIL PROTECTED]> wrote: >>I miss being able to do something like this in Python >> >>1f (I = a.find("3")) != -1: >>print "It's here: ", I >>else: >>print "No 3's here" >> >>where I gets assigned the

Re: MySQLdb slow on MySQL 5

2006-02-23 Thread Gerhard Häring
[EMAIL PROTECTED] wrote: > Hi. > > I have a Python program that parses a file and inserts records into a > database with MySQLdb. I recently upgraded to MySQL 5.0.8, and now my > parser runs *really* slow. Writing out to CSV files is fine, but when I > try to insert the same records in a MySQL5 da

Re: need help regarding compilation

2006-02-23 Thread fidlee
Kent Johnson wrote: > fidlee wrote: > >>Try this: > >> > >>def fac(x): > >> if x<=1:return 1 > >> return x*fac(x-1) > > > > > > I am still getting an error in compilation. Would be really thankful if > > someone could tell me as to what is going wrong. > > Try running the compiler under Java 1.4,

frozen codecs

2006-02-23 Thread Robin Becker
I'm having a problem with freeze vs Python-2.4. I need to get various codecs into the freeze, but suspect I need to explicitly import them. Must I just import codecs or all the ones I'm likely to use? -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list

How to move optparse from main to function?

2006-02-23 Thread Bob
I'm playing around with optparse and created the code below. How do I move that to a function and what variable do I pass? >From the documentation it seems like "options.optparse_test" would have the value zero if its option, either "-t" or "--test", is not detected at the command line. When I iss

Re: Pyserial never read

2006-02-23 Thread Peter Hansen
Dennis Lee Bieber wrote: dt = "D036EC" print repr("".join([chr(int(dt[2*x:2*x+2],16)) for x in range(len(dt)//2)])) > > '\xd06\x00\x00\xec' By the way, for future reference, this way beats the above hands down: >>> import binascii >>> binascii.unhexlify("D036EC") '\xd06\x00\x00

Re: A C-like if statement

2006-02-23 Thread Roy Smith
Bob Greschke <[EMAIL PROTECTED]> wrote: >I miss being able to do something like this in Python > >1f (I = a.find("3")) != -1: >print "It's here: ", I >else: >print "No 3's here" > >where I gets assigned the index returned by find() AND the if statement gets >to do its job in the same line.

A C-like if statement

2006-02-23 Thread Bob Greschke
I miss being able to do something like this in Python 1f (I = a.find("3")) != -1: print "It's here: ", I else: print "No 3's here" where I gets assigned the index returned by find() AND the if statement gets to do its job in the same line. Then you don't have to have another like that

Re: need help regarding compilation

2006-02-23 Thread Kent Johnson
fidlee wrote: >>Try this: >> >>def fac(x): >> if x<=1:return 1 >> return x*fac(x-1) > > > I am still getting an error in compilation. Would be really thankful if > someone could tell me as to what is going wrong. Try running the compiler under Java 1.4, or just run the class in the jython inter

  1   2   3   >