Re: recommendation for webapp testing?

2009-09-16 Thread S.Selvam
On Thu, Sep 17, 2009 at 7:51 AM, Schif Schaf wrote: > After some more searching I found Mechanize (a Python version of > Perl's WWW::Mechanize): > > http://wwwsearch.sourceforge.net/mechanize/ > > Anyone here tried it? > Yes,mechanize has all the features and very simple to use. > -- > http://m

Re: Shebang line problems and python

2009-09-16 Thread Blaine
On Sep 16, 9:25 pm, Blaine wrote: > Hello, > > Scripts that have "#!/usr/bin/python" at the top do not parse > correctly. Bash treats scripts with that shebang as if they are bash > scripts. > > E.g.: > bla...@attila ~/apps/rs-mu $ /usr/sbin/env-update > /usr/sbin/env-update: line 6: import: comma

Re: Shebang line problems and python

2009-09-16 Thread Johan Grönqvist
Blaine skrev: I'm not sure if there is a Ctrl+Z in here... but, here's the output: bla...@attila ~/tmp $ hexdump shebang-test 000 2123 752f 7273 622f 6e69 702f 7479 6f68 010 0a6e 6d69 6f70 7472 7320 7379 730a 7379 020 732e 6474 756f 2e74 7277 7469 2865 4822 030 6c65 6f6c 202c 6f7

regex search with a space as the fist character

2009-09-16 Thread Daniel Santos
Hello, >>> print re.compile('u ').search(" u box2", 1) <_sre.SRE_Match object at 0x7ff1d918> >>> print re.compile(' u ').search(" u box2", 1) None Why ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Zipped and pickle

2009-09-16 Thread Thomas Lehmann
> Briefly: > > s = cPickle.dumps(obj) > z = zipfile.Zipfile("filename.zip","w",zipfile.ZIP_DEFLATED) > z.writestr("arcname.pkl",s) Thank you very much. I have not been aware that pickle can also do the job without a file! Here's the complete scenario for writing and reading the data... APPENDIX:

Re: Shebang line problems and python

2009-09-16 Thread Blaine
On Sep 16, 10:46 pm, Steven D'Aprano wrote: > On Wed, 16 Sep 2009 21:35:21 -0700, Blaine wrote: > > bla...@attila ~/tmp $ cat ./shebang-test > > #!/usr/bin/python > > import sys > > sys.stdout.write("Hello, world.\n") > > bla...@attila ~/tmp $ ./shebang-test > > ./shebang-test: line 2: import: com

Re: Are min() and max() thread-safe?

2009-09-16 Thread Niklas Norrthon
On 17 Sep, 06:33, Steven D'Aprano wrote: > I have two threads, one running min() and the other running max() over > the same list. I'm getting some mysterious results which I'm having > trouble debugging. Are min() and max() thread-safe, or am I doing > something fundamentally silly by having them

Re: Are min() and max() thread-safe?

2009-09-16 Thread Steven D'Aprano
On Wed, 16 Sep 2009 22:08:40 -0700, Miles Kaufmann wrote: > On Sep 16, 2009, at 9:33 PM, Steven D'Aprano wrote: >> I have two threads, one running min() and the other running max() over >> the same list. I'm getting some mysterious results which I'm having >> trouble debugging. Are min() and max()

Re: weird str error

2009-09-16 Thread daved170
On Sep 15, 6:29 pm, Peter Otten <__pete...@web.de> wrote: > daved170 wrote: > > Hi everybody, > > I'm using SPE 0.8.3.c as my python editor. > > I'm using thestr() function and i got a very odd error. > > > I'm trying to do this: printstr("HI") > > When i'm writing this line in the shell it prints:

Re: (A Possible Solution) Re: preferred way to set encoding for print

2009-09-16 Thread Miles Kaufmann
On Sep 16, 2009, at 12:39 PM, ~flow wrote: so: how can i tell python, in a configuration or using a setting in sitecustomize.py, or similar, to use utf-8 as a default encoding? [snip Stdout_writer_with_ncrs solution] This should work: sys.stdout = io.TextIOWrapper(sys.stdout.buffer,

Re: Are min() and max() thread-safe?

2009-09-16 Thread Dj Gilcrease
I dont see anything wrong with it and it works for me on a sequence of 5000 -- http://mail.python.org/mailman/listinfo/python-list

Re: Are min() and max() thread-safe?

2009-09-16 Thread Miles Kaufmann
On Sep 16, 2009, at 9:33 PM, Steven D'Aprano wrote: I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which I'm having trouble debugging. Are min() and max() thread-safe, or am I doing something fundamentally silly by having

Re: Shebang line problems and python

2009-09-16 Thread km
assuming that ur on linux/unix and assuming that u have shebang line as #!/usr/bin/python in ur script set permissions like this chmod 755 myscript.py and then run the script as ./myscripy.py OR simply run the python script as "python myscript.py" at the shell prompt (note that this doesnt need she

Re: (A Possible Solution) Re: preferred way to set encoding for print

2009-09-16 Thread Mark Tolonen
"~flow" wrote in message news:643ca91c-b81c-483c-a8af-65c93b593...@r33g2000vbp.googlegroups.com... On Sep 16, 7:16 am, "Mark Tolonen" wrote: Setting PYTHONIOENCODING overrides the encoding used for stdin/stdout/stderr (See the Python help for details), but if your terminal doesn't support t

Re: Shebang line problems and python

2009-09-16 Thread Steven D'Aprano
On Wed, 16 Sep 2009 21:35:21 -0700, Blaine wrote: > bla...@attila ~/tmp $ cat ./shebang-test > #!/usr/bin/python > import sys > sys.stdout.write("Hello, world.\n") > bla...@attila ~/tmp $ ./shebang-test > ./shebang-test: line 2: import: command not found ./shebang-test: line > 3: syntax error near

Re: Are min() and max() thread-safe?

2009-09-16 Thread Steven D'Aprano
On Thu, 17 Sep 2009 04:33:05 +, Steven D'Aprano wrote: > I have two threads, one running min() and the other running max() over > the same list. I'm getting some mysterious results which I'm having > trouble debugging. Are min() and max() thread-safe, or am I doing > something fundamentally si

Re: Shebang line problems and python

2009-09-16 Thread Blaine
Chris Rebert, Rami Chowdhury: bla...@attila ~/tmp $ which python /usr/bin/python Ben Finney: bla...@attila ~/tmp $ echo $SHELL /bin/bash bla...@attila ~/tmp $ cat ./shebang-test #!/usr/bin/python import sys sys.stdout.write("Hello, world.\n") bla...@attila ~/tmp $ ./shebang-test ./shebang-test: li

Are min() and max() thread-safe?

2009-09-16 Thread Steven D'Aprano
I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which I'm having trouble debugging. Are min() and max() thread-safe, or am I doing something fundamentally silly by having them walk over the same list simultaneously? My c

Re: Shebang line problems and python

2009-09-16 Thread Ben Finney
Blaine writes: > Scripts that have "#!/usr/bin/python" at the top do not parse > correctly. Bash treats scripts with that shebang as if they are bash > scripts. When you run a file as a command, it's not Bash that decides how to run it; the kernel has the job of understanding how to run the prog

Re: Shebang line problems and python

2009-09-16 Thread Rami Chowdhury
Is it possible that python is installed not in /usr/bin but in, say, / usr/local/bin? I'd suggest you try 'which python' to find out where it is. On my OS X, for instance: $ which python /Library/Frameworks/Python.framework/Versions/Current/bin/python - Rami Chowdhury "Never as

Re: Shebang line problems and python

2009-09-16 Thread Chris Rebert
On Wed, Sep 16, 2009 at 8:25 PM, Blaine wrote: > Hello, > > Scripts that have "#!/usr/bin/python" at the top do not parse > correctly. Bash treats scripts with that shebang as if they are bash > scripts. > > E.g.: > bla...@attila ~/apps/rs-mu $ /usr/sbin/env-update > /usr/sbin/env-update: line 6:

Shebang line problems and python

2009-09-16 Thread Blaine
Hello, Scripts that have "#!/usr/bin/python" at the top do not parse correctly. Bash treats scripts with that shebang as if they are bash scripts. E.g.: bla...@attila ~/apps/rs-mu $ /usr/sbin/env-update /usr/sbin/env-update: line 6: import: command not found /usr/sbin/env-update: line 8: syntax e

Re: Noob Q: subclassing or wrapping file class

2009-09-16 Thread Steven D'Aprano
On Wed, 16 Sep 2009 23:06:18 +, kj wrote: >>Instead of: > >>x.__getattr__('name') > >>write this: > >>getattr(x, 'name') > > This did the trick. For the record, it's fairly unusual to call double-underscore special methods directly. Any time you think you need to, it's worth a rethink.

Re: subprocess + python-daemon - bug/problem?

2009-09-16 Thread Ben Finney
Ben Finney writes: > I'm not familiar enough with the nuances of the ‘subprocess’ module to > know what might be going wrong here. I'd like to know whether it might > be a problem in the ‘python-daemon’ library. My test case for this is now:: = #! /usr/bin/python import daemon import os im

Re: recommendation for webapp testing?

2009-09-16 Thread Schif Schaf
After some more searching I found Mechanize (a Python version of Perl's WWW::Mechanize): http://wwwsearch.sourceforge.net/mechanize/ Anyone here tried it? -- http://mail.python.org/mailman/listinfo/python-list

Re: recommendation for webapp testing?

2009-09-16 Thread Schif Schaf
On Sep 16, 12:19 pm, Michele Simionato wrote: > > twill is still good. Well, this http://twill.idyll.org/ seems to be the twill website, but it looks pretty out of date. I also found this http://code.google.com/p/twill/ , which is somewhat newer. No activity in the last 3 and a half months thoug

Re: overrideredirect vs. text entry etc. widget

2009-09-16 Thread kernus
I did, no luck. but I will keep trying..., :P I will let you know if some trick works. Sean DiZazzo wrote: > On Sep 15, 10:20 pm, kernus wrote: > > On Sep 15, 11:42 am, Sean DiZazzo wrote: > > > > > > > > > Whats interesting is that if you call overrideredirect from a button > > > command, it

Re: recommendation for webapp testing?

2009-09-16 Thread Schif Schaf
On Sep 16, 8:55 am, Simon Brunning wrote: > 2009/9/16 Schif Schaf : > > > > I need to do some basic website testing (log into account, add item to > > cart, fill out and submit forms, check out, etc.). What modules would > > be good to use for webapp testing like this? > >

Re: Noob Q: subclassing or wrapping file class

2009-09-16 Thread Terry Reedy
kj wrote: I'm trying to get the hang of Python's OO model, so I set up this conceptually simple problem of creating a new file-like class to read a certain type of file. The data in this type of file consists of multiline "chunks" separated by lines consisting of a single ".". My first crack a

Re: How do I begin debugging a python memory leak?

2009-09-16 Thread Andrew Svetlov
guppy-pe On Sep 16, 8:10 pm, Matthew Wilson wrote: > I have a web app based on TurboGears 1.0.  In the last few days, as > traffic and usage has picked up, I noticed that the app went from using > 4% of my total memory all the way up to 50%. > > I suspect I'm loading data from the database and som

checking cell phone minute usage?

2009-09-16 Thread Esmail
Hi, I'm wondering if anyone has written a Python program (or has ideas about how to go about it) that checks your current cell phone minute usage? For verizon I can either log on to a MyVerizon web page (I am not aware of an API for it) or I can text #min from my phone. I don't really care abou

Re: PyQt QCompleter model

2009-09-16 Thread David Boddie
On Thursday 17 September 2009 01:14, nusch wrote: > The following code: > > strings=["asdad", "baasd", "casd", "caxd"] > completer = QCompleter(strings) > model = completer.model() > print model.rowCount() > model.stringList().append("test") This may not work as you expect. Although it may actua

Re: How do I begin debugging a python memory leak?

2009-09-16 Thread Diez B. Roggisch
Matthew Wilson schrieb: I have a web app based on TurboGears 1.0. In the last few days, as traffic and usage has picked up, I noticed that the app went from using 4% of my total memory all the way up to 50%. I suspect I'm loading data from the database and somehow preventing garbage collection.

Re: How to check something is in a list with rich-comparison objects?

2009-09-16 Thread Terry Reedy
Jason wrote: I will raise this with pysvn, if I can ever find their issue reporting system. In the meantime, I suppose I can only do this by traversing the list with a loop and catching exceptions. Ugly, but seems to be the only way. On Sep 16, 2:39 am, "Gabriel Genellina" wrote: Looks like a

How do I begin debugging a python memory leak?

2009-09-16 Thread Matthew Wilson
I have a web app based on TurboGears 1.0. In the last few days, as traffic and usage has picked up, I noticed that the app went from using 4% of my total memory all the way up to 50%. I suspect I'm loading data from the database and somehow preventing garbage collection. Are there any tools that

Re: uses for setup.cfg and extracting data from it

2009-09-16 Thread Ben Finney
"P.J. Eby" writes: > http://docs.python.org/distutils/apiref.html#module-distutils.core - > specifically the run_setup() function. (It appears the docs do not > have link anchors for individual functions, alas.) http://docs.python.org/distutils/apiref.html#distutils.core.run_setup> Sphinx (th

Re: Class variable inheritance

2009-09-16 Thread Terry Reedy
Duncan Booth wrote: Lie Ryan wrote: Terry Reedy wrote: Lie Ryan wrote: Note that when the python interpreter meets this statement: class B(P): def foo(self): print('ab') X = 'f' the compiler sees a class statement -> create a new blank class -> assign P as the new class' parent No, it s

Re: Why use "locals()"

2009-09-16 Thread Terry Reedy
Sion Arrowsmith wrote: Gabriel Genellina wrote: escribi�: What I'm not clear about is under what circumstances locals() does not produce the same result as vars() . py> help(vars) Help on built-in function vars in module __builtin__: vars(...) vars([object]) -> dictionary Without a

Re: Passing Variables WITHOUT Dynamic URLs

2009-09-16 Thread Rami Chowdhury
I like to pass at least browser information from page to page to make pages display properly. What kind of web framework are you using? Most allow you to access the HTTP headers sent with a request -- in this case, what you'd be after is the 'User-Agent' header. On Wed, 16 Sep 2009 16:21:4

Passing Variables WITHOUT Dynamic URLs

2009-09-16 Thread Victor Subervi
Hi; Search engines don't like dynamic links. I like to pass at least browser information from page to page to make pages display properly. Spiders couldn't care less about asthetics, so that wouldn't matter to them. But passing something like *.com?browser=IE5 trips the spider up. Is there a way to

PyQt QCompleter model

2009-09-16 Thread nusch
The following code: strings=["asdad", "baasd", "casd", "caxd"] completer = QCompleter(strings) model = completer.model() print model.rowCount() model.stringList().append("test") print model.rowCount() prints 4 before and after appending test to stringList. What should I do to let the model know

Re: subprocess + python-daemon - bug/problem?

2009-09-16 Thread Ben Finney
Joel Martin writes: > I'm running python-2.6.2 which supposedly has the fix for #1731717. > However I still still the problem with subprocess after daemonizing. > I've narrowed it down to just the setting of the SIGCLD signal. > > You can reproduce the problem thus (in 2.4.6, 2.5.4 and 2.6.2): >

Re: Noob Q: subclassing or wrapping file class

2009-09-16 Thread kj
In Steven D'Aprano writes: >On Wed, 16 Sep 2009 21:56:09 +, kj wrote: >... >> I thought at first that I could achieve this by overriding __getattr__: >> >> def __getattr__(self, attribute): >> return self.fh.__getattr__(attribute) >> >> But to my surprise this did not work to

Re: Noob Q: subclassing or wrapping file class

2009-09-16 Thread Steven D'Aprano
On Wed, 16 Sep 2009 21:56:09 +, kj wrote: ... > I thought at first that I could achieve this by overriding __getattr__: > > def __getattr__(self, attribute): > return self.fh.__getattr__(attribute) > > But to my surprise this did not work too well. For example, if I use a > Gzip

Re: preferred way to set encoding for print

2009-09-16 Thread Terry Reedy
Mark Tolonen wrote: ('utf-8')`, but that has no effect in py3.0.1. also, i cannot set Even if not relevant to your immediate problem, if you can, upgrade to 3.1, with its many important bug fixes. -- http://mail.python.org/mailman/listinfo/python-list

Noob Q: subclassing or wrapping file class

2009-09-16 Thread kj
I'm trying to get the hang of Python's OO model, so I set up this conceptually simple problem of creating a new file-like class to read a certain type of file. The data in this type of file consists of multiline "chunks" separated by lines consisting of a single ".". My first crack at it looks

Re: subprocess + python-daemon - bug/problem?

2009-09-16 Thread Joel Martin
On Sep 8, 5:19 pm, Ben Finney wrote: > Sewar writes: > > I looked at other daemon libraries and snippets, it's clearly the bug is in > > subprocess not python-daemon. > > Then I found Python bug #1731717 which discusses it. I'm running python-2.6.2 which supposedly has the fix for #1731717. Howe

Debugging with gdb: pystack macro for gdb to show python stack trace

2009-09-16 Thread Timothy Madden
Hello I have an application with several threads that sometimes just freezes. I installed the debug symbols for python interpreter, and the gdb macros, as instructed on the wiki http://wiki.python.org/moin/DebuggingWithGdb so I can debug with gdb. gdb loads many files with python de

Re: Collection console output

2009-09-16 Thread MRAB
Esben von Buchwald wrote: Hello Are there any simple ways to collect the data, python prints to the console when running an app? I'm doing som apps for S60 mobile phones and can't see the console, when the UI is running, but i'd like to collect the output, to look for eventual exceptions et

Re: socket.MSG_WAITALL flag broken on Windows XP in Python 2.5.4?

2009-09-16 Thread Wes McKinney
On Sep 16, 3:53 pm, Irmen de Jong wrote: > Tim Roberts wrote: > > Wes McKinney wrote: > >> I noticed the flag socket.MSG_WAITALL seems to have crept its way into > >> Python 2.5 on Windows (it's in 2.5.4, but not in 2.5.1, not sure about > >> intermediate releases). I do not think Windows support

Collection console output

2009-09-16 Thread Esben von Buchwald
Hello Are there any simple ways to collect the data, python prints to the console when running an app? I'm doing som apps for S60 mobile phones and can't see the console, when the UI is running, but i'd like to collect the output, to look for eventual exceptions etc. Cant it be redirected

Re: python decimals

2009-09-16 Thread Andrew Svetlov
Decimal has good enough API and we need to follow it as lot of our code already operates with Decimal. Maybe with different Context and exception types and limited subset of operations - but switching should be not very hard. Decimal arithmetic is good for as. We need to support several types like

Re: Looking for a pure Python chart drawing module

2009-09-16 Thread Grant Edwards
On 2009-09-16, Alan G Isaac wrote: > Tkinter is part of the Python standard library: That doesn't mean you can depend on it being available. It doesn't get installed by default on some Linux distros. -- Grant Edwards grante Yow! Wait ... is this a FUN

Re: Looking for a pure Python chart drawing module

2009-09-16 Thread John Nagle
John Nagle wrote: Ethan Furman wrote: John Nagle wrote: http://home.gna.org/pychart/doc/introduction.html Tried PyChart. ... PyChart generates SVG reasonably well, and needs no external programs when generating SVG. But there's something broken related to font sizes. Larger values

Re: Zipped and pickle

2009-09-16 Thread Carl Banks
On Sep 16, 4:40 am, Thomas Lehmann wrote: > How do I implement best to use pickle that way that the file is zipped? Briefly: s = cPickle.dumps(obj) z = zipfile.Zipfile("filename.zip","w",zipfile.ZIP_DEFLATED) z.writestr("arcname.pkl",s) Carl Banks -- http://mail.python.org/mailman/listinfo/py

Re: socket.MSG_WAITALL flag broken on Windows XP in Python 2.5.4?

2009-09-16 Thread Irmen de Jong
Tim Roberts wrote: Wes McKinney wrote: I noticed the flag socket.MSG_WAITALL seems to have crept its way into Python 2.5 on Windows (it's in 2.5.4, but not in 2.5.1, not sure about intermediate releases). I do not think Windows supports it. It seems to cause some problems in some libraries (lik

Re: Python and 3d

2009-09-16 Thread mbaas
On 13 Sep., 13:29, azrael wrote: > Has anyone any exipience with python and 3d. > > I mean, is there a module to deal with popular 3d formats like 3ds, or > vrml. is it possible to import into python opengl models and then use > it in application for GUI purposes like through WX. I know that WX >

(A Possible Solution) Re: preferred way to set encoding for print

2009-09-16 Thread ~flow
On Sep 16, 7:16 am, "Mark Tolonen" wrote: > Setting PYTHONIOENCODING overrides the encoding used for stdin/stdout/stderr > (See the Python help for details), but if your terminal doesn't support the > encoding that won't help. thx for these two tips. of course, that was a bit misleading by me to

Re: Looking for a pure Python chart drawing module

2009-09-16 Thread Michel Claveau - MVP
Hi! > Tkinter is part of the Python standard library Yes. But... tkinter is a wrapper to tcl/tk, who is written in tcl. Ok, tcl is given with Python (standard library). Therefore, you sentence: 'Are you really ruling out its use for a "pure Python" solution?' Is well done... ;-) Michel Claveau

Re: can python make web applications?

2009-09-16 Thread Paul Boddie
On 16 Sep, 18:31, lkcl wrote: > > http://pyjs.org/examples/timesheet/output/TimeSheet.html I get this error dialogue message when visiting the above page: "TimeSheet undefined list assignment index out of range" Along with the following in-page error, once the data has been imported: "JavaScri

Non-deprecated equivalent of rfc822.AddressList

2009-09-16 Thread Jason Tackaberry
Hi, Since the rfc822 module was removed in Python 3, and is deprecated in 2.3, I am obviously trying to avoid using it. But I'm having a hard time finding an equivalent to rfc822.AddressList in the email module, which I want to use to parse a _list_ of addresses: >>> addrlist = 'John Do

Re: python 3.1 unicode question

2009-09-16 Thread Duncan Booth
jeffunit wrote: >>That looks like a "surrogate escape" (See PEP 383) >>http://www.python.org/dev/peps/pep-0383/. It indicates the wrong >>encoding was used to decode the filename. > > That seems likely. How do I set the encoding to something correct to > decode the filename? > > Clearly win

Re: recommendation for webapp testing?

2009-09-16 Thread corey goldberg
> I need to do some basic website testing http://seleniumhq.org/ "Selenium is a suite of tools to automate web app testing across many platforms." Have a look at Selenium. Specifically, look at Selenium RC. You can write code in Python to drive a web browser and run web tests. -Corey -- http:

Re: os.execv Overhead

2009-09-16 Thread Jim Wilson
On 09/16/2009 11:12 AM, mark.mcdow...@gmail.com wondered about: > overhead of [fork/exec]: An alternative might be os.spawn?(), etal. It might run a tiny bit faster because it combines the two operations, but I think you're pretty close to the metal. Jim -- http://mail.python.org/mailman/list

Re: can python make web applications?

2009-09-16 Thread lkcl
On Aug 23, 3:12 pm, Deep_Feelings wrote: > can python make powerfull database web applications that can replace > desktop database applications? e.g: entrprise accounting > programs,enterprise human resource management programs ...etc with pyjamas, as mark mentioned previously - but what mark pe

Re: recommendation for webapp testing?

2009-09-16 Thread Michele Simionato
On Sep 16, 7:00 am, Schif Schaf wrote: > Hi, > > I need to do some basic website testing (log into account, add item to > cart, fill out and submit forms, check out, etc.). What modules would > be good to use for webapp testing like this? > > From a bit of searching, it looks like twill was used f

Re: overrideredirect vs. text entry etc. widget

2009-09-16 Thread Sean DiZazzo
On Sep 15, 10:20 pm, kernus wrote: > On Sep 15, 11:42 am, Sean DiZazzo wrote: > > > > > Whats interesting is that if you call overrideredirect from a button > > command, it works as expected.  Well, at least the text entry field > > ^so, Sean, you know how to *click this magic but

Changing IP's and Connecting to a site

2009-09-16 Thread aditya shukla
Hello Guys' I have a script which i am using to do interaction with a website.Is there a way by which i can connect to the site through different ip's .Say use a proxy or something. Thanks Aditya -- http://mail.python.org/mailman/listinfo/python-list

os.execv Overhead

2009-09-16 Thread mark.mcdow...@gmail.com
I have a script that automates running a program X times by preparing the required files and passing the external program right variables. What I am unsure about though is the overhead of: program = "externalScript" variables = ["-i", "var1"] pid = os.fork() if no

Re: string interpolation mystery in Python 2.6

2009-09-16 Thread Scott David Daniels
Alan G Isaac wrote: George Brandl explained it to me this way: It's probably best explained with a bit of code: >>> class C(object): ... def __str__(self): return '[str]' ... def __unicode__(self): return '[unicode]' ... >>> "%s %s" % ('foo', C()

Re: Looking for a pure Python chart drawing module

2009-09-16 Thread Robin Becker
PS: For those people that sugest use Blt. I use Blt a lot in linux and win32 but it is not port (yet) to TK8.5 so, it do not works with py2.6, and is really painfull to build in win32. Beside that, in order to use Blt, you need an instance of Tk running, ergo a XWindows running, an some times it

Re: Looking for a pure Python chart drawing module

2009-09-16 Thread rober
On Sep 15, 6:28 pm, John Nagle wrote: > John Nagle wrote: > > I'mlookingfor something that can draw simple bar and pie charts > > inPython. I'm trying to find aPythonpackage, not a wrapper for > > some C library, as this has to run on both Windows and Linux > > and version clashes are a problem.

Re: Why use "locals()"

2009-09-16 Thread steve
On 09/14/2009 08:36 AM, Sean DiZazzo wrote: I have never used a call to "locals()" in my code. Can you show me a use case where it is valuable and Pythonic? You've received other answers, but just purely from the 'zen' perspective, there is a nice clean yin/yan symmetry about globals() Vs loca

Re: Looking for a pure Python chart drawing module

2009-09-16 Thread Alan G Isaac
Alan G Isaac wrote: There's John Zelle's graphics.py: http://mcsp.wartburg.edu/zelle/python/ provides basic functionality. On 9/16/2009 12:33 AM, John Nagle wrote: "The package is a wrapper around Tkinter". It runs Tkinter in a separate thread and sends commands to it. Tkinter is part of t

Re: Threading.py Class Syntax and Super

2009-09-16 Thread Carl Banks
On Sep 16, 3:23 am, Casey wrote: > I noticed that the many (if not all) classes in threading.py[1] all > inherit from object, yet non of the init methods call super(). I am > curious as to why this is the chosen implementation? If the benefit of > new-style classes is to support multiple inheritan

Re: Looking for a pure Python chart drawing module

2009-09-16 Thread Michel Claveau - MVP
Hi! Perso I use a wrapper to RMCHART. There are two versions : DLL & COM. I prefer COM. Warning : only on Windows's family. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: recommendation for webapp testing?

2009-09-16 Thread Simon Brunning
2009/9/16 Schif Schaf : > > I need to do some basic website testing (log into account, add item to > cart, fill out and submit forms, check out, etc.). What modules would > be good to use for webapp testing like this? might be worth a look. -- Cheers, Simon

Re: Why use "locals()"

2009-09-16 Thread Sion Arrowsmith
Gabriel Genellina wrote: > escribió: >> What I'm not clear about is under what circumstances locals() does >> not produce the same result as vars() . > >py> help(vars) >Help on built-in function vars in module __builtin__: > >vars(...) > vars([object]) -> dictionary > > Without arguments,

Re: pyjamas in action?

2009-09-16 Thread lkcl
On Aug 31, 8:35 pm, André wrote: > On Aug 31, 4:46 pm, kj wrote: > > > At work we want to implement a webapp using Google's GWT, and we're > > debating whether to use the standard GWT approach with Java, or to > > tryPyjamas. There's no great love here for Java, but there's the > > concern thatP

Re: Fwd: Re: How to improve this code?

2009-09-16 Thread Duncan Booth
Hendrik van Rooyen wrote: > def are_elements_present(eleLocators): > elePresent=False > if not eleLocators: > return False > > for ele in eleLocators: > if selenium.is_element_present(ele): > elePresent=True > else: > elePresent=False

Re: Class variable inheritance

2009-09-16 Thread Duncan Booth
Lie Ryan wrote: > Terry Reedy wrote: >> Lie Ryan wrote: >> >>> >>> Note that when the python interpreter meets this statement: >>> >>> class B(P): >>> def foo(self): >>> print('ab') >>> X = 'f' >>> >>> the compiler sees a class statement -> create a new blank class >>>

Re: Fwd: Re: How to improve this code?

2009-09-16 Thread Thomas Lehmann
> otherwise. Given this, I'm just trying to write a method > are_elements_present(aList) whose job is to return True if and only if > all elements in aList are present in page's HTML. So here is how > missingItems = [str(ele) for ele in eleLocators if not selenium.is_element_present(ele)] if len(m

Re: multiproccess: What is the Dameon flag?

2009-09-16 Thread MRAB
Allen Fowler wrote: What is the Daemon flag and when/why would I want to use it? From the documentation: "When a process exits, it attempts to terminate all of its daemonic child processes.". Sometimes you want the main process to wait for its worker processes to terminate before terminating

Fwd: Re: How to improve this code?

2009-09-16 Thread Hendrik van Rooyen
>From a private email, forwarded to the list: -- Forwarded Message -- Subject: Re: How to improve this code? Date: Tuesday 15 September 2009 From: Oltmans To: hend...@microcorp.co.za On Sep 15, 1:13 pm, Hendrik van Rooyen wrote: > > (i) a True if All the elements in match

Zipped and pickle

2009-09-16 Thread Thomas Lehmann
How do I implement best to use pickle that way that the file is zipped? -- http://mail.python.org/mailman/listinfo/python-list

Re: Threading.py Class Syntax and Super

2009-09-16 Thread Michele Simionato
On Sep 16, 12:23 pm, Casey wrote: > Hi, > > I noticed that the many (if not all) classes in threading.py[1] all > inherit from object, yet non of the init methods call super(). I am > curious as to why this is the chosen implementation? If the benefit of > new-style classes is to support multiple

Re: An assessment of the Unicode standard

2009-09-16 Thread MRAB
Lie Ryan wrote: r wrote: On Sep 15, 4:12 am, Hendrik van Rooyen wrote: (snip) When a language lacks a word for a concept like "window", then (I believe :-) ), it kind of puts a crimp in the style of thinking that a person will do, growing up with only that language. Are you telling us peop

Re: Class variable inheritance

2009-09-16 Thread Lie Ryan
Terry Reedy wrote: Lie Ryan wrote: Note that when the python interpreter meets this statement: class B(P): def foo(self): print('ab') X = 'f' the compiler sees a class statement -> create a new blank class -> assign P as the new class' pare

Re: An assessment of the Unicode standard

2009-09-16 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 19:04:10 r wrote: > On Sep 15, 4:12 am, Hendrik van Rooyen > wrote: > (snip) > > > When a language lacks a word for a concept like "window", then (I > > believe  :-) ), it kind of puts a crimp in the style of thinking that a > > person will do, growing up with only tha

Threading.py Class Syntax and Super

2009-09-16 Thread Casey
Hi, I noticed that the many (if not all) classes in threading.py[1] all inherit from object, yet non of the init methods call super(). I am curious as to why this is the chosen implementation? If the benefit of new-style classes is to support multiple inheritance, then isn't this "broken" if the c

Re: OT Language wars - was :An assessment of the Unicode standard

2009-09-16 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 18:22:30 Christopher Culver wrote: > Hendrik van Rooyen writes: > > 2) Is about as useful as stating that any Turing complete language and > > processor pair is capable of solving any computable problem, given enough > > time. So why are we not all programming in brain

Re: An assessment of the Unicode standard

2009-09-16 Thread Lie Ryan
r wrote: You're on a slippery slope when you claim that people deserve whatever mistreatment or misfortune comes their way through mere circumstances of birth. I suggest you step back and actually read your messages again and consider how others might interpret them. Paul: civilizations rise an

Re: An assessment of the Unicode standard

2009-09-16 Thread Lie Ryan
r wrote: Not that I agree that it would be a Utopia, whatever the language - more like a nightmare of Orwellian proportions - because the language you get taught first, moulds the way you think. And I know from personal experience that there are concepts that can be succinctly expressed in on

Re: An assessment of the Unicode standard

2009-09-16 Thread Lie Ryan
r wrote: On Sep 15, 4:12 am, Hendrik van Rooyen wrote: (snip) When a language lacks a word for a concept like "window", then (I believe :-) ), it kind of puts a crimp in the style of thinking that a person will do, growing up with only that language. Are you telling us people using a langua

Re: python decimals

2009-09-16 Thread Mark Dickinson
On Sep 16, 1:35 am, Andrew Svetlov wrote: > It only reflects the fact what comp.lang.python replicated by several > web sites. > Unfortunately looks like there are no link to library implements that : > ( A few random thoughts: If you just want fixed-precision decimal, there may be simpler solut

Re: Remove empty strings from list

2009-09-16 Thread Bruno Desthuilliers
Sion Arrowsmith a écrit : Bruno Desthuilliers wrote: mylist = line.strip().split() will already do the RightThing(tm). So will mylist = line.split() Yeps, it's at least the second time someone reminds me that the call to str.strip is just useless here... Pity my poor old neuron :( -- h

Re: str.split() with empty separator

2009-09-16 Thread Hendrik van Rooyen
On Tuesday 15 September 2009 14:50:11 Xavier Ho wrote: > On Tue, Sep 15, 2009 at 10:31 PM, Ulrich Eckhardt > > wrote: > > "'abc'.split('')" gives me a "ValueError: empty separator". > > However, "''.join(['a', 'b', 'c'])" gives me "'abc'". > > > > Why this asymmetry? I was under the impression that

Re: How to check something is in a list with rich-comparison objects?

2009-09-16 Thread Steven D'Aprano
On Wed, 16 Sep 2009 03:57:30 -0300, Gabriel Genellina wrote: > En Wed, 16 Sep 2009 03:36:32 -0300, Jason > escribió: > >> On Sep 16, 2:39 am, "Gabriel Genellina" wrote: >>> Looks like a bug in pysvn. Some class (whatever >>> pysvn.wc_notify_action.status_completed is) is not well written. When