Re: streaming Popen.stdout

2006-02-23 Thread Michele Simionato
Replying to myself ... I cooked up this solution involving os.pipe and os.fork, but I am not especially happy with it; anyway, let me write it. Feedback is welcome, since this was written very quickly and I may have missed something. BTW, are there libraries out there doing something similar? ---

Fail in sending UDP packet

2006-02-23 Thread Sbaush
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?? -- Sbaush from socket import * from struct import * from string import * c

RE: event/job scheduling

2006-02-23 Thread Tim Golden
| i'd like to do the following kind of event/job scheduling: | run some task(s) (python code) everyday at (say) 8am for (say) a week. | | i need to do this for both windows xp and suse linux | machines. although i know | that i can use cron or its equivalent in windows to kick off | the python i

Re: PyUNO with different Python

2006-02-23 Thread Michele Petrazzo
Stefan Behnel wrote: > M�ta-MCI schrieb: >> The second way don't run: >> >> Traceback (most recent call last): File "C:\Program >> Files\OpenOffice.org 2.0\program\hello_world.py", line 1, in? >> import uno File "C:\Program Files\OpenOffice.org >> 2.0\program\uno.py", line 37, in ? import pyuno I

Re: using breakpoints in a normal interactive session

2006-02-23 Thread Carl Friedrich Bolz
[EMAIL PROTECTED] wrote: > Is there a way to temporarily halt execution of a script (without using > a debugger) and have it put you in an interactive session where you > have access to the locals? And possibly resume? For example: > > def a(): > > ... x = 1 > ... magic_breakpoint() >

PyAtom, a Python module for creating Atom syndication feeds

2006-02-23 Thread Steve R. Hastings
Hello. I have written a module called PyAtom. It is designed to make it really easy to create an Atom syndication feed. Atom is a format similar to RSS, but with some additional features. http://atomenabled.org/developers/syndication/ >From my Google searches, I think the name "PyAtom" is ava

Re: new wooden door step - fixing and finishing

2006-02-23 Thread EP
jkn wrote: >Hi all >I'm considering having a go at replacing the wooden door step to >our back door. The original is loose and rotting. > >I'm sure some of this will be clearer when I remove the (metal) door >frame - how is such a step fixed? Vertical frame fixings? > >Also, any suggestions fo

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

2006-02-23 Thread ���ϲ��
'rar' is not recognized as an internal or external command, operable program or batch file. 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 = "rar a -idcdp %s %s" % (target,' '.join(s

Path (graph) shower utility

2006-02-23 Thread Durumdara
Hi ! I need to create a program that read eml file headers, analyze the receive tags and create a path database. I finished with this program section. But I want to show a graphical summary about the paths. This is (what I want to show) like a graph - show ways, stations, etc, and I want to s

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

2006-02-23 Thread Lawrence Oluyede
"Steve R. Hastings" <[EMAIL PROTECTED]> writes: > I intend to donate this to the Python Software Foundation, so I have > released it under the terms of the Academic Free License 2.1. > > You can download it from here: > > http://www.blarg.net/~steveha/pyatom.tar.gz > > > The file includes a readme

Re: PyUNO with different Python

2006-02-23 Thread Michele Petrazzo
Katja Suess wrote: > Thanks. What I have in mind is to write a Python script to generate > PDFs from a set of ODTs. Pay attention that you have a OOo program running somewhere that accept the connection from your zope server (I don't think that you have a X server running on it.) > This script ha

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

2006-02-23 Thread Steve R. Hastings
> you don't follow PEP 8 guidelines Why do you say this? I don't think the code is perfectly polished and ready to be called version 1.0, but I think it follows PEP 8 more than not. > and AFAIK a module must be widespread and used by > the community before can be accepted in the Python core. I

mascyma

2006-02-23 Thread JCDenton
Hi, I found this interface http://home.arcor.de/mulk/projects/mascyma/download.xhtml.en I am actually have troubles to get it working. Some warnings and errors occur when I try to start it. If anybody will have a look on it na dget in running with python 2.4, please let me know. I think it is

make a class instance from a string ?

2006-02-23 Thread Bo Yang
Hi, I know in java , we can use class.ForName("classname") to get an instance of the class 'classname' from a string , in python , how do I do that ? Thanks in advance ! -- http://mail.python.org/mailman/listinfo/python-list

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

2006-02-23 Thread Lawrence Oluyede
"Steve R. Hastings" <[EMAIL PROTECTED]> writes: > Why do you say this? I don't think the code is perfectly polished and > ready to be called version 1.0, but I think it follows PEP 8 more than not. docstrings of method are messed up (why you begin them from the column 0?) and " Function Na

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

2006-02-23 Thread Magnus Lycka
Dennis Lee Bieber wrote: > On Wed, 22 Feb 2006 20:43:38 GMT, John Salerno > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >>Does that answer the question about active scripting language? > > > Slipping in... It sure sounds to me like they have Python as a pure > CGI

Re: bsddb3 database file, are there any unexpected file size limits occuring in practice?

2006-02-23 Thread Claudio Grondi
Klaas wrote: > Claudio Grondi wrote: > > >>Beside the intended database file >> databaseFile.bdb >>I see in same directory also the >> __db.001 >> __db.002 >> __db.003 >>files where >> __db.003 is ten times as larger as the databaseFile.bdb >>and >> __db.001 has the same size as the d

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

2006-02-23 Thread Claudio Grondi
Ê÷Éϲä»Ò wrote: > 'rar' is not recognized as an internal or external command, > operable program or batch file. > > > 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 = "rar a

Re: make a class instance from a string ?

2006-02-23 Thread bearophileHUGS
Bo Yang: > to get an instance of the class 'classname' from a > string , in python , how do I do that ? This is a possibile way: class C: pass c = locals()["C"]() print c Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

CSV module and UNICODE

2006-02-23 Thread Rudy Schockaert
I'm having problems writing unicode to a csv file.I use the following code:-import codecsimport csvcsvfile = csv.writer(codecs.open('filename.csv','w+','utf-8'))a = u'\xc9' csvfile.writerow([a,a]) -It fails with the message: UnicodeEncodeError: 'ascii

Re: CSV module and UNICODE

2006-02-23 Thread Rudy Schockaert
Forgot to mention that I work on Windows XP and Windows 2003.On 2/23/06, Rudy Schockaert <[EMAIL PROTECTED] > wrote:I'm having problems writing unicode to a csv file.I use the following code: -import codecsimport csvcsvfile = csv.writer(codecs.open('filename.csv','w+','utf-8

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

2006-02-23 Thread Dejan Rodiger
Ę÷ÉϲäťŇ said the following on 23.02.2006 10:03: > rar_cmd = r'"D:\Program Files\WinRAR\rar.exe" a -idcdp %s %s' % (target,' > '.join(source)) You can't cd to d:\Program Files\WinRAR and then call rar You have to call rar with full path. from subprocess import * retcode = call([r'"D:\Program Fi

Re: ANN: Urwid 0.9.0 - Console UI library

2006-02-23 Thread Thomas Dickey
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 "standard version" of ncurses has support

Re: Python vs. Lisp -- please explain

2006-02-23 Thread Paul Boddie
Kay Schluehr wrote: > > I would say yes, it is still "proper Python" in that each RPython > program is also a CPython program. I suppose it depends on which direction you're coming from, in that many Python programs just wouldn't be able to run in RPython. But then I can understand the convenience

Re: make a class instance from a string ?

2006-02-23 Thread Diez B. Roggisch
Bo Yang wrote: > Hi, > I know in java , we can use > > class.ForName("classname") > > > to get an instance of the class 'classname' from a > string , in python , how do I do that ? You can use getattr(module, classname)(*arguments) Diez -- http://mail.python.org/mailman/listinfo/python

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

2006-02-23 Thread Magnus Lycka
John Salerno wrote: > The python installation on our windows hosting is not configured as > mod_python. Perhaps you can switch to linux hosting instead? If they have mod_python in that environment, you can use Python Server Pages, and whatever tools you use, there is much better support for Apac

Re: cx_Oracle and UTF8

2006-02-23 Thread Diez B. Roggisch
Harald Armin Massa wrote: > Hello, > > I am looking for a method to convince cx_Oracle and oracle to encode > it's replies in UTF8. > > For the moment I have to... > > cn=cx_Oracle.connect("user","password", "database") > cs=cn.Cursor() > > cs.execute("select column1, column2, column3 from ta

Re: Python vs. Lisp -- please explain

2006-02-23 Thread Torsten Bronger
Hallöchen! "Paul Boddie" <[EMAIL PROTECTED]> writes: > Kay Schluehr wrote: > >> I would say yes, it is still "proper Python" in that each RPython >> program is also a CPython program. > > I suppose it depends on which direction you're coming from, in > that many Python programs just wouldn't be a

Re: Psychic bug

2006-02-23 Thread Raymond Hettinger
> a mutate function for a genetic algorithm which is giving me > odd results. I suspect I'm missing somthing really simple, so I'd be > grateful for any suggestions. Basically, when I comment out the line > which is commented out below, it works fine (although of course it > doesn't change the gen

Re: using breakpoints in a normal interactive session

2006-02-23 Thread R. Bernstein
In revising pydb the code and documentation for the routine originally described, I learn that the pdb equivalent (sort of) is called set_trace(). However set_trace() will terminate the program when you quit the debugger, so I've retained this routine and made a couple of corrections -- in particu

Re: except clause not catching IndexError

2006-02-23 Thread Roy Smith
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > And here I was thinking that commas make tuples, not > brackets. What is happening here? What is happening is that the syntax for forming tuples is one of Python's warts. Sometimes the comma is what makes a tuple: >>> a = 1, 2 >>> type (a) Sometim

Re: computer algebra packages

2006-02-23 Thread JCDenton
> Rahulwrote: Hi. > Well is there an open source computer algebra system written in python > or at least having a python interface? > I know of 2 efforts: pythonica and pyginac...are there any others? > > rahul There is mascyma http://home.arcor.de/mulk/projects/mascyma/download.xhtml.en that i

Re: except clause not catching IndexError

2006-02-23 Thread Sion Arrowsmith
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >You mean to say that "except X,Y:" gives different >results to "except (X,Y):"? > [ ... ] >And here I was thinking that commas make tuples, not >brackets. What is happening here? Similar kind of thing to what's happening here: >>> print "Hello,", "wo

Get Root access in Linux?

2006-02-23 Thread [EMAIL PROTECTED]
Does anyone know how to call for the root prompt before launching your app? Kinda like synaptic or the superuser file manager does? Thanks, Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: What's up with this code?

2006-02-23 Thread Gregory Petrosyan
That's it! Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: reviews of unit test frameworks

2006-02-23 Thread Kent Johnson
kanchy kang wrote: > Is there any reviews/remarks on these frameworks? > nose, OOBTest,testosterone, py.test, Sancho. http://agiletesting.blogspot.com/2005/02/articles-and-tutorials.html -- http://mail.python.org/mailman/listinfo/python-list

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

2006-02-23 Thread Kent Johnson
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. unittest.TextTestRunner() has an optional stream argument that would let you output to a file. Kent -- http://mail.p

Re: Pyserial never read

2006-02-23 Thread luca72
Hello ALSO... YOU NEVER SPECIFY A VARIABLE TO RECEIVE THE DATA -- ANYTHING YOU DO READ IS BEING DUMPED ON THE FLOOR! I see the read data with a sniffer. with the same serial caracteristic in delphi i obtain the right answer. I use serial writestr and serial readstr. If the serial package is

Re: Get Root access in Linux?

2006-02-23 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Does anyone know how to call for the root prompt before launching your > app? > Kinda like synaptic or the superuser file manager does? That is Windowmanager/Desktop dependand. For KDE, you can e.g. create links to applications that instruct the KDE to first acquire roo

Re: editor for Python on Linux

2006-02-23 Thread Grant Edwards
On 2006-02-19, Mladen Adamovic <[EMAIL PROTECTED]> wrote: > I wonder which editor or IDE you can recommend me for writing > Python programs. I tried with jEdit but it isn't perfect. jed -- Grant Edwards grante Yow! Vote for ME at

Re: What's up with this code?

2006-02-23 Thread Gregory Petrosyan
Oh, by the way, is there any documentation about time of execution of standart functions (is len(list) O(1) or O(n), etc) and is there any C version of decimal? -- http://mail.python.org/mailman/listinfo/python-list

Re: make a class instance from a string ?

2006-02-23 Thread Luke Plant
Bo Yang wrote: > I know in java , we can use > > class.ForName("classname") > > > to get an instance of the class 'classname' from a > string , in python , how do I do that ? In Python, classes are first class objects, so normally you would pass the class itself around, rather than use the names

catching traceback.print_exc()

2006-02-23 Thread Philippe Martin
Hi, Is there a way to catch traceback.print_exc() output into a string ? Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: cx_Oracle and UTF8

2006-02-23 Thread Harald Armin Massa
Dietz, thank you for your answer. > It's called NLS (national language support), >and it is like a locale-setting in python/C. I'm too lazy to google right Sad thing: I allready googled that and had to learn: you CAN definitely change some parameters, that is sort order and language for error me

Re: Python vs. Lisp -- please explain

2006-02-23 Thread Paul Boddie
Alexander Schmolck wrote: > Rocco Moretti <[EMAIL PROTECTED]> writes: > > > I think it's worth pointing out that not all dynamicism is equal, when it > > comes to difficulty in compiling to machine code. > > No kidding (do you have any idea how this thread started out?). I had to remind myself. >

Re: catching traceback.print_exc()

2006-02-23 Thread Philippe Martin
oops: """ format_exc( [limit[, file]]) This is like print_exc(limit) but returns a string instead of printing to a file. New in version 2.4. """ Philippe Martin wrote: > Hi, > > Is there a way to catch traceback.print_exc() output into a string ? > > > Philippe -- http://mail.python.org/

Re: No (and a meaningless subject here too!)

2006-02-23 Thread Gaz
Aye, but i dont need to run an FTP daemon every time i want to upload an image to Imageshack or any other website. About the topic name, yes, it's meaningless and its a shame. I fucked it up when typing the title =P -- http://mail.python.org/mailman/listinfo/python-list

regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread Franz Steinhaeusler
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.MULTILINE) 1) Windows >>> r="erewr\r\nafjdskl " >>> newtext, n = retrai

Re: Get Root access in Linux?

2006-02-23 Thread Harlin Seritt
sudo is something of a quick fix. Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

Re: mascyma

2006-02-23 Thread Harlin Seritt
You'll almost certainly need to take a look at mascyma's support facilities: support web page, forum, etc (provided they do indeed exist). Harlin Seritt -- http://mail.python.org/mailman/listinfo/python-list

pyserial

2006-02-23 Thread Mimi
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 is not the case with pyserial library. anyone can help me ? this is a part of my code: self.ser = serial.Serial() self.ser.b

Re: Which is faster? (if not b in m) or (if m.count(b) > 0)

2006-02-23 Thread Peter Hansen
Farel wrote: > Thank you, Peter! Please understand, I was attempting to get more info > on the WHY x is faster than y... from those with more experience. > Timer cannot give me that info. Thanks for clarifying. For future reference, it's traditional in English to use the word "why" in a questi

Re: Psychic bug

2006-02-23 Thread Gerard Flanagan
Jennifer Hallinan wrote: > Hi, > > I have a mutate function for a genetic algorithm which is giving me > odd results. I suspect I'm missing somthing really simple, so I'd be > grateful for any suggestions. Basically, when I comment out the line > which is commented out below, it works fine (althoug

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread Martin Franklin
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.MULTILINE) > > 1) Windows r="erewr

Re: cx_Oracle and UTF8

2006-02-23 Thread Gerhard Häring
Harald Armin Massa wrote: > Dietz, > > thank you for your answer. > >>It's called NLS (national language support), >>and it is like a locale-setting in python/C. I'm too lazy to google right > > Sad thing: I allready googled that and had to learn: you CAN definitely > change some parameters, tha

Re: How to force creation of a .pyc?

2006-02-23 Thread Peter Hansen
mrstephengross wrote: > I would like to distribute a python program, but only in .pyc form (so > that people cannot simply look at my code). Is there a way to do this? > I've read up a little on the logic by which python creates .pyc's, and > it sounds like python requires the main executed program

Re: new wooden door step - fixing and finishing

2006-02-23 Thread Peter Hansen
Carl Friedrich Bolz wrote: > I heard that wooden door steps will lead to much lower walking speeds. Don't assume: use the timeit module to find out for yourself. > Isn't a low-level door step out of stone to be prefered? What did you learn when you Googled for it? -answering-entirely-in-charac

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread gene tani
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.MULTILINE) > > 1) Windows > >>> r="erewr

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread Franz Steinhaeusler
On Thu, 23 Feb 2006 13:54:50 +, Martin Franklin <[EMAIL PROTECTED]> wrote: >> > r="erewr\r\nafjdskl " >> 'erewr\r\nafjdskl' >> >> 2) Unix > r="erewr\nafjdskl " >> 'erewr\nafjdskl' > >why not use string methods strip, rstrip and lstrip > because this removes only

Wierd Python error.

2006-02-23 Thread YourAverageJoe
To whom it may concern: I'm running Fedora Core 4 on a rather low-spec system (considered good cirkabout '99), this one program I'm trying to run is dependant on Python, so I downloaded the RPM, but when I tried installing it, the following packages were "missing:" python, python2, and /usr/bin/py

Re: catching traceback.print_exc()

2006-02-23 Thread Peter Hansen
Philippe Martin wrote: > Is there a way to catch traceback.print_exc() output into a string ? Presumably using one of the alternatives, like format_exc(). If that's not sufficient, maybe some example code to demonstrate what you really want would help. -Peter -- http://mail.python.org/mailm

Re: Get Root access in Linux?

2006-02-23 Thread [EMAIL PROTECTED]
I was thinking you can do a shell call or something and pass the info for root access. -- http://mail.python.org/mailman/listinfo/python-list

Re: make a class instance from a string ?

2006-02-23 Thread Diez B. Roggisch
Luke Plant wrote: > Bo Yang wrote: > >> I know in java , we can use >> >> class.ForName("classname") >> >> >> to get an instance of the class 'classname' from a >> string , in python , how do I do that ? > > In Python, classes are first class objects, so normally you would pass > the class itsel

Re: using breakpoints in a normal interactive session

2006-02-23 Thread dan . gass
Carl -- Perfect! That is exactly what I want. I hoped it would be that easy. Thanks for taking the time to post the solution. -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread gene tani
gene tani wrote: > Franz Steinhaeusler wrote: > > > > Who can help me (regular expression, which works for both cases). > > universal newlines: > http://www.python.org/doc/2.3.3/whatsnew/node7.html > http://mail.python.org/pipermail/python-list/2006-February/324410.html if multiple end-of line ma

Re: list assignment

2006-02-23 Thread Bernhard Herzog
Norvell Spearman <[EMAIL PROTECTED]> writes: > Lutz and Ascher have tuple and list assignment as separate entries in > their assignment statement forms table so I was expecting there to be > some difference; thanks for setting me straight. In older Python versions there was a difference between l

Re: Get Root access in Linux?

2006-02-23 Thread [EMAIL PROTECTED]
Then you have root access in that shell only, and not in the 'mother' python process. I guess Harlins suggestion is the nest: run with sudo -- http://mail.python.org/mailman/listinfo/python-list

Re: No (and a meaningless subject here too!)

2006-02-23 Thread Kent Johnson
Gaz wrote: > Aye, but i dont need to run an FTP daemon every time i want to upload > an image to Imageshack or any other website. Did you google 'python cgi file upload' yet? Several people have pointed you to an answer that doesn't use FTP. -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread Franz Steinhaeusler
On 23 Feb 2006 06:44:36 -0800, "gene tani" <[EMAIL PROTECTED]> wrote: > >gene tani wrote: >> Franz Steinhaeusler wrote: >> > >> > Who can help me (regular expression, which works for both cases). >> >> universal newlines: >> http://www.python.org/doc/2.3.3/whatsnew/node7.html >> http://mail.python

Re: Is python very slow compared to C

2006-02-23 Thread Magnus Lycka
Isaac Gouy wrote: >>I think it is wrong to call Python "very slow" just because it is slower >>than some other language or languages, for the same reason it would be >>wrong to describe the population of the UK as "very low" because 60 >>million people is a smaller number than China or India's one

Re: computer algebra packages

2006-02-23 Thread Robert Kern
JCDenton wrote: >>Rahulwrote: > > Hi. > >>Well is there an open source computer algebra system written in > > python > >>or at least having a python interface? >>I know of 2 efforts: pythonica and pyginac...are there any others? [Apologies for piggybacking.] http://sage.sourceforge.net/ --

formatted string like---> u'720 S'

2006-02-23 Thread Bell, Kevin
I'm building a dictionary from values a database and upon print the dictionary I see key value pairs like this: u'Briarcliff' : [u'2500 E'], u'Shumway' : [ u'2600 E'] do I need to slice off the "u", or anything? I know it has something to do with unicode but I don't know how to treat it. -- htt

Re: regular expresson for Unix and Dos Lineendings wanted

2006-02-23 Thread Franz Steinhaeusler
On Thu, 23 Feb 2006 15:59:54 +0100, Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: >I need it for a file, whose line endings I don't know. > >I wrote for DrPython this script: >(using styled text control and wxPython) and this works, >but I'm looking for a shorter way: ah, sorry, I try to make th

Re: Tix, spinboxes, and 1>=5

2006-02-23 Thread cjbackhouse
> The entry in the spinbox is a string. Thanks. The only question now is why oh why would anyone design something so stupid. (severely tempted to go back to a strongly typed language before even finishing one program) -- http://mail.python.org/mailman/listinfo/python-list

Re: Wierd Python error.

2006-02-23 Thread [EMAIL PROTECTED]
did you download the rpm from http://www.python.org/2.4/rpms.html? The it runs as /usr/bin/python2.4 - see Q&A section on this page -- http://mail.python.org/mailman/listinfo/python-list

Detec nonascii in a string

2006-02-23 Thread Sebastian Bassi
Hello, How do I detect non-ascii letters in a string? I want to detect the condition that a string have a letter that is not here: string.ascii_letters Best regards, SB. -- Bioinformatics news: http://www.bioinformatica.info Lriser: http://www.linspire.com/lraiser_success.php?serial=318 -- http

Using repr() with escape sequences

2006-02-23 Thread nummertolv
Hi, My application is receiving strings, representing windows paths, from an external source. When using these paths, by for instance printing them using str() (print path), the backslashes are naturally interpreted as escape characters. >>> print "d:\thedir" d: hedir The solution is to use

Unexpected timing results

2006-02-23 Thread Steven D'Aprano
I have two code snippets to time a function object being executed. I expected that they should give roughly the same result, but one is more than an order of magnitude slower than the other. Here are the snippets: def timer1(): timer = time.time func = lambda : None itr = [None] * 100

Re: formatted string like---> u'720 S'

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 08:00:16 -0700, Bell, Kevin wrote: > I'm building a dictionary from values a database and upon print the > dictionary I see key value pairs like this: > > u'Briarcliff' : [u'2500 E'], > u'Shumway' : [ u'2600 E'] > > do I need to slice off the "u", or anything? I know it has

Re: Using repr() with escape sequences

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 07:32:36 -0800, nummertolv wrote: > Hi, > > My application is receiving strings, representing windows paths, from > an external source. When using these paths, by for instance printing > them using str() (print path), the backslashes are naturally > interpreted as escape chara

Re: Detec nonascii in a string

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 12:32:35 -0300, Sebastian Bassi wrote: > Hello, > > How do I detect non-ascii letters in a string? > I want to detect the condition that a string have a letter that is not > here: string.ascii_letters for c in some_string: if c not in string.ascii_letters: raise V

Re: Detec nonascii in a string

2006-02-23 Thread Gerard Flanagan
Sebastian Bassi wrote: > Hello, > > How do I detect non-ascii letters in a string? > I want to detect the condition that a string have a letter that is not > here: string.ascii_letters > > Best regards, > SB. > > -- > Bioinformatics news: http://www.bioinformatica.info > Lriser: http://www.linspire

Re: Detec nonascii in a string

2006-02-23 Thread Diez B. Roggisch
Sebastian Bassi wrote: > Hello, > > How do I detect non-ascii letters in a string? > I want to detect the condition that a string have a letter that is not > here: string.ascii_letters "äöü".decode("ascii") should do the trick -- you get an UnicodeError when there is anything ascii can't encode

Re: Unexpected timing results

2006-02-23 Thread Larry Bates
Steven D'Aprano wrote: > I have two code snippets to time a function object being executed. I > expected that they should give roughly the same result, but one is more > than an order of magnitude slower than the other. > > Here are the snippets: > > def timer1(): > timer = time.time > fu

Re: Unexpected timing results

2006-02-23 Thread Kent Johnson
Steven D'Aprano wrote: > I have two code snippets to time a function object being executed. I > expected that they should give roughly the same result, but one is more > than an order of magnitude slower than the other. > > Here are the snippets: > > def timer1(): > timer = time.time > fu

Re: No (and a meaningless subject here too!)

2006-02-23 Thread Gaz
Yeah, i did. Thank you, im analyzing the examples found. I'll post my results :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Detec nonascii in a string

2006-02-23 Thread Tim Chase
> How do I detect non-ascii letters in a string? I want to detect the > condition that a string have a letter that is not here: > string.ascii_letters I don't know how efficient it is, but it's fairly clean: clean_string = ''.join([c for c in some_string if c in string.ascii_letters]) If you

Re: Detec nonascii in a string

2006-02-23 Thread Sebastian Bassi
On 2/23/06, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > "äöü".decode("ascii") > should do the trick -- you get an UnicodeError when there is anything ascii > can't encode. Thank you. This is good enought for me. Best regards, SB. -- Bioinformatics news: http://www.bioinformatica.info Lriser: ht

Re: Using repr() with escape sequences

2006-02-23 Thread nummertolv
I think I might have misused the terms "escape character" and/or "escape sequence" or been unclear in some other way because I seem to have confused you. In any case you don't seem to be addressing my problem. I know that the \t in the example path is interpreted as the tab character (that was par

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

2006-02-23 Thread John Salerno
Sybren Stuvel wrote: > Check out PSP. I found a PSP website that said this: - In general, PSP pages are like normal HTML files with two exceptions: 1. They always have a .PSP file extension 2. They can have JPython code embedded in them - That sounds like just what I want, exce

Re: May i customize basic operator (such as 1==3)?

2006-02-23 Thread Magnus Lycka
Casey Hawthorne wrote: > I have heard, that one should always use objects when programming and > avoid the builtin types! Who told you that? Some university teacher with no industrial experience? ;^) It's not good advice in Python programming, for two reasons. - It can influence performance signi

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

2006-02-23 Thread John Salerno
John Salerno wrote: > Sybren Stuvel wrote: > >> Check out PSP. > > I found a PSP website that said this: > > - > In general, PSP pages are like normal HTML files with two exceptions: > > 1. They always have a .PSP file extension > 2. They can have JPython code embedded in them > ---

Re: Get Root access in Linux?

2006-02-23 Thread Malte Dik
quote: > Does anyone know how to call for the root prompt before launching your > app? > Kinda like synaptic or the superuser file manager does? Do you mean something like "kdesu" for KDE? -- http://mail.python.org/mailman/listinfo/python-list

need help regarding compilation

2006-02-23 Thread fidlee
i am new to learning jython... i just tried compiling a small piece of code that is given below: def fac(x) if x<=1:return 1 return x*fac(x-1) on C:\Program Files\jython\temp>jythonc factor.py it showed the following error: processing factor Traceback (innermost last): File "C:\Program F

Hiding a column at the root of a plone site ...

2006-02-23 Thread Paul Ertz
Hello, We would like to hide the left column for the main/home page of our plone sites dynamically using a tal: expression. I figured out that I need to customize the main_template file something like this: What I haven't figured out, is how to identify that the current page is the home pa

Re: make a class instance from a string ?

2006-02-23 Thread Terry Hancock
On 23 Feb 2006 05:22:25 -0800 "Luke Plant" <[EMAIL PROTECTED]> wrote: > In Python, classes are first class objects, so normally > you would pass the class itself around, rather than use > the names of classes. Of course that might not be > practical or applicable in your situation. It is in fact,

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

2006-02-23 Thread Sybren Stuvel
John Salerno enlightened us with: > That sounds like just what I want, except do I have to write my code > in Jython? Can't I just use regular Python? I wouldn't know, never used Python ;-) Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stu

datetime iso8601 string input

2006-02-23 Thread Rubic
I was a little surprised to recently discover that datetime has no method to input a string value. PEP 321 appears does not convey much information, but a timbot post from a couple years ago clarifies things: http://tinyurl.com/epjqc > You can stop looking: datetime doesn't > support any kind o

problem with newlines in regexp substitution

2006-02-23 Thread Florian Schulze
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' '\\n' >>> re.sub('1',r'\\n',s) '\\n' >>> s.replace('1',

Re: need help regarding compilation

2006-02-23 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > i am new to learning jython... > > > i just tried compiling a small piece of code that is given below: > > def fac(x) > if x<=1:return 1 > return x*fac(x-1) This is invalid Python syntax. Have you gone through the Python tutorial yet? Doing so is probably a good

  1   2   3   >