Elisa Media Center 0.5.27 Release

2009-02-10 Thread Guillaume Emont
Dear Python hackers and lovers, The Elisa team is happy to announce the release of Elisa Media Center 0.5.27, code-named Peruvian Skies. Elisa is an open source cross-platform media center connecting the Internet to an all-in-one media player. It is written in python using twisted, gstreamer and

Re: Variable + String Format

2009-02-10 Thread Steven D'Aprano
On Wed, 11 Feb 2009 18:52:40 +1100, Joel Ross wrote: Thanks for the quick response guys. Help me out a alot. I'm a newbie to python and your replies help me understand a bit more about python!! Joel, unless you have Guido's time machine and are actually posting from the future, the clock, or

Re: Super() confusion

2009-02-10 Thread Gabriel Genellina
En Tue, 10 Feb 2009 03:26:20 -0200, Michele Simionato michele.simion...@gmail.com escribió: On Feb 10, 4:29 am, Gabriel Genellina Honestly, I don't understand how this thing got so much out of control. If anyone starts an intelligent question or remark about super, this essay is thrown in

Re: can multi-core improve single funciton?

2009-02-10 Thread Gerhard Weis
Once I have seen Haskell code, that ran fibonacci on a 4 core system. The algorithm itself basically used an extra granularity paramet until which new threads will be sparked. e.g. fib(40, 36) means, calculate fib(40) and spark threads until n=36. 1. divide: fib(n-1), fib(n-2) 2. divide:

Re: Python 3D CAD -- need collaborators, or just brave souls :)

2009-02-10 Thread Hendrik van Rooyen
rantingrick ra.@gmail.com wrote 8 - dreams, goals and tentative spec - Have you looked at Pycad ? - it started off with a similar rush some time ago. Maybe there is something there that you can use and/or salvage. - Hendrik --

Re: Simple question - stock market simulation

2009-02-10 Thread Hendrik van Rooyen
cptn.spoon cpt..n@gmail.com wrote: On Feb 9, 6:48 pm, Hendrik van Rooyen m...@microcorp.co.za wrote: No. At this level, just use a list of instances of your Stock class. - Hendrik How do I get a list of instances of a particular class? Is there a way to do this dynamically? Yes there

Re: Scanning a file character by character

2009-02-10 Thread Hendrik van Rooyen
Spacebar265 spa...@gmail.com wrote: Thanks. How would I do separate lines into words without scanning one character at a time? Type the following at the interactive prompt and see what happens: s = This is a string composed of a few words and a newline\n help(s.split) help(s.rstrip)

import wx works interactive but not from script

2009-02-10 Thread jefm
when I call import wx from the interactive console, it works (i.e. it doesn't complain). But when I call the same from a script, it complains that it can not find the wx module. works for interactive Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC

Re: can multi-core improve single funciton?

2009-02-10 Thread Steven D'Aprano
On Tue, 10 Feb 2009 18:18:23 +1000, Gerhard Weis wrote: Once I have seen Haskell code, that ran fibonacci on a 4 core system. The algorithm itself basically used an extra granularity paramet until which new threads will be sparked. e.g. fib(40, 36) means, calculate fib(40) and spark threads

Re: Problem with Tkinter's scale function.

2009-02-10 Thread Hendrik van Rooyen
Nicholas Feinberg wrote: Code that caused the problem (unlikely to be helpful, but no reason not to include it): self.canvas.scale(self.body,self.radius/(self.radius-.5),self.radius/(self.radi us-.05),0,0)#radius is greater than .5 scale's arguments are:

Re: import wx works interactive but not from script

2009-02-10 Thread Tim Golden
jefm wrote: when I call import wx from the interactive console, it works (i.e. it doesn't complain). But when I call the same from a script, it complains that it can not find the wx module. works for interactive Python 2.6.1 (r261:67517, Dec 4 2008,

Convert date/time to unix timestamp?

2009-02-10 Thread Phillip B Oldham
Is there a simple way to set a date/time and convert it to a unix timestamp? After some googling I found the following: t = datetime.time(7,0,0) starttime = time.mktime(t.timetuple())+1e-6*t.microsecond That seems like very long-winded. Is there an easier way? I've read the docs on the datetime

Re: can multi-core improve single funciton?

2009-02-10 Thread Gabriel Genellina
En Tue, 10 Feb 2009 06:45:37 -0200, Steven D'Aprano ste...@remove.this.cybersource.com.au escribió: On Tue, 10 Feb 2009 18:18:23 +1000, Gerhard Weis wrote: We tried this code on a 4 core machine using only 1 core and all 4 cores. 1 core wallclock: ~10s 4 core wallclock: ~3s Three seconds to

Re: can multi-core improve single funciton?

2009-02-10 Thread Chris Rebert
On Tue, Feb 10, 2009 at 12:45 AM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 10 Feb 2009 18:18:23 +1000, Gerhard Weis wrote: Once I have seen Haskell code, that ran fibonacci on a 4 core system. The algorithm itself basically used an extra granularity paramet until

Re: Super() confusion

2009-02-10 Thread Marc 'BlackJack' Rintsch
On Tue, 10 Feb 2009 02:02:43 +, Benjamin Peterson wrote: Jean-Paul Calderone exarkun at divmod.com writes: Consider whether you really need to use super(). http://fuhm.net/super-harmful/ This article chiefly deals with super()'s harm in multiple inteheritance situations. For the

Re: Which core am I running on?

2009-02-10 Thread Gerhard Häring
psaff...@googlemail.com wrote: On 9 Feb, 12:24, Gerhard Häring g...@ghaering.de wrote: http://objectmix.com/python/631346-parallel-python.html Hmm. In fact, this doesn't seem to work for pp. When I run the code below, it says everything is running on the one core. import pp import

Setting DNS using win32com

2009-02-10 Thread Nacho
I am trying to make a small python application to change DNS servers in a small LAN. I am trying this code but I don't manage it to work, I only get the values removed. My code is this: import win32com.client objWMIService = win32com.client.GetObject(winmgmts:

Re: can multi-core improve single funciton?

2009-02-10 Thread Niklas Norrthon
On 10 Feb, 09:45, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 10 Feb 2009 18:18:23 +1000, Gerhard Weis wrote: Once I have seen Haskell code, that ran fibonacci on a 4 core system. The algorithm itself basically used an extra granularity paramet until which new

Re: Super() confusion

2009-02-10 Thread Michele Simionato
On Feb 10, 10:42 am, Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: On Tue, 10 Feb 2009 02:02:43 +, Benjamin Peterson wrote: Jean-Paul Calderone exarkun at divmod.com writes: Consider whether you really need to use super(). http://fuhm.net/super-harmful/ This article chiefly deals

Re: Python binaries with VC++ 8.0?

2009-02-10 Thread greg
Mark Hammond wrote: What problems specifically? The only practical problems you should see will arise if you try and pass a FILE *, or allocate memory you then ask python to free (or vice-versa) - both should be avoidable though... It concerns a Ruby plugin for Sketchup that embeds a Python

Converting timestamps across timezones

2009-02-10 Thread Christopher Culver
A script that I'm writing pulls the system time off of an iPod connected to the computer. The iPod's time is represented as a Unix timestamp (seconds since the epoch), but this timestamp does not represent UTC time, but rather the local timezone of the owner. I need to convert this local time

Re: Scanning a file character by character

2009-02-10 Thread Duncan Booth
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 09 Feb 2009 19:10:28 -0800, Spacebar265 wrote: How would I do separate lines into words without scanning one character at a time? Scan a line at a time, then split each line into words. for line in

Re: AJAX Post requests

2009-02-10 Thread Paul
On Feb 10, 7:37 am, Tim Roberts t...@probo.com wrote: PJ pauljeffer...@gmail.com wrote: I have a simple web server using  BaseHTTPServer, and the def do_POST (self) function works fine for regular forms that are submitted to it, but when I send anAJAXPOST to it it does nothing (I've tried to

Re: Python binaries with VC++ 8.0?

2009-02-10 Thread bearophileHUGS
Paul Rubin: Gideon Smeding of the University of Utrecht has written a masters' thesis titled An executable operational semantics for Python. A significant part of Computer Science is a waste of time and money. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: generator object or 'send' method?

2009-02-10 Thread andrew cooke
steven probably knows this, but to flag the issue for people who are looking at generators/coroutines for the first time: there's a little gotcha about exactly how the two sides of the conversation are synchronized. in simple terms: send also receives. unfortunately the example steven gave

Re: Variable + String Format

2009-02-10 Thread Joel Ross
Steven D'Aprano wrote: On Wed, 11 Feb 2009 18:52:40 +1100, Joel Ross wrote: Thanks for the quick response guys. Help me out a alot. I'm a newbie to python and your replies help me understand a bit more about python!! Joel, unless you have Guido's time machine and are actually posting from

Re: Variable + String Format

2009-02-10 Thread Joel Ross
Joel Ross wrote: Hi all, I have this piece of code: # wordList = /tmp/Wordlist file = open(wordList, 'r+b') def readLines(): for line in file.read(): if not line: break print line + '.com

Re: can multi-core improve single funciton?

2009-02-10 Thread Lie Ryan
On Tue, 10 Feb 2009 14:28:15 +0800, oyster wrote: I mean this [code] def fib(n): if n=1: return 1 return fib(n-1)+fib(n-2) useCore(1) timeit(fib(500)) #this show 20 seconds useCore(2) timeit(fib(500)) #this show 10 seconds [/code] Is it possible? and more, can

Re: can multi-core improve single funciton?

2009-02-10 Thread Gerhard Weis
def fib(n, a=1, b=1): if n==0: return a elif n==1: return b return fib(n-1, b, a+b) And for the record: fib(500) 225591516161936330872512695036072072046011324913758190588638866418474627738686883405015987052796968498626L timeit.Timer('fib(500)', 'from __main__

Re: Convert date/time to unix timestamp?

2009-02-10 Thread Thomas Kraus
Phillip B Oldham schrieb: Is there a simple way to set a date/time and convert it to a unix timestamp? After some googling I found the following: t = datetime.time(7,0,0) starttime = time.mktime(t.timetuple())+1e-6*t.microsecond That seems like very long-winded. Is there an easier way? I've

Re: Convert date/time to unix timestamp?

2009-02-10 Thread andrew cooke
the python routines are a bit basic - you really have to think quite hard about what you are doing to get the right answer. in your case, you need to be clear what the timezone is for the datetime you are using. timezone info is optional (see the datetime documentation, where it talks about

Re: Import without executing module

2009-02-10 Thread Lie Ryan
On Tue, 03 Feb 2009 20:08:34 -0800, Stephen Hansen wrote: There is no need to try to make sure something is executed/compiled only once in Python like you may want to do in C. Every module is only ever compiled once: if you import it ten times in ten different places only the first will

python ssh and Tetia SSH server

2009-02-10 Thread loial
Anyone out there any experience of using python ssh modules to connect to the Tetia SSH server from SSH (ssh.com)? -- http://mail.python.org/mailman/listinfo/python-list

COM and threading, CoInitialize?

2009-02-10 Thread Ferdinand Sousa
Greetings to list members, I am trying to use an Acrobat COM object in a class that is subclassed from threading.Thread. Since threading.Thread is subclassed, the __init__ method of the inheriting class must explicitly call the threading.Thread.__init__ method of the parent. I guess I'm missing

Re: Convert date/time to unix timestamp?

2009-02-10 Thread M.-A. Lemburg
On 2009-02-10 10:26, Phillip B Oldham wrote: Is there a simple way to set a date/time and convert it to a unix timestamp? After some googling I found the following: t = datetime.time(7,0,0) starttime = time.mktime(t.timetuple())+1e-6*t.microsecond That seems like very long-winded. Is

Re: python ssh and Tetia SSH server

2009-02-10 Thread Tino Wildenhain
loial wrote: Anyone out there any experience of using python ssh modules to connect to the Tetia SSH server from SSH (ssh.com)? Did you call their support? Personally I see no reason why paramiko http://www.lag.net/paramiko/ should not work, given that openssh ssh client also worked in the

poplib

2009-02-10 Thread Gabriel Rossetti
Hello, I am using poplib and I noticed that calls to top() don't return the msg info (2nd index in the returned list, e.g. email.top(1,0)[1]) in the same order, by that I mean the date could be email.top(1,0)[1][2] or email.top(1,0)[1][5], etc. Is there a reason for that other than that may

Python at the SoCal Linux Expo

2009-02-10 Thread joe
Hey guys, The Southern California Linux Expo, a community run conference taking place in Los Angeles on February 20th to 22nd, is offering a 50% discount to the Python community. When you go to register[1], just enter the promo code: PYTHN. If you have any questions, please let me know. Thanks!

STMP, mail, sender-from, to-bcc-addr

2009-02-10 Thread durumdara
Hi! I wanna ask that have anyone some experience with email.msg and smtplib? The email message and smtp.send already have sender/from and recip/addr to. Possible the smtp components does not uses the email tags if I not define them only in the message? Can I do same thing as in GMAIL that

Re: Local python web server problem

2009-02-10 Thread Farsheed Ashouri
Thanks guys, Really appreciate your help. I am trying to solve the problem and will keep you posted when I found a solution. Farsheed Ashouri, Tehran, Iran -- http://mail.python.org/mailman/listinfo/python-list

codecs.open and buffering modes...

2009-02-10 Thread Sam
codecs.open defaults to line buffering. But open defaults to using the system buffer size. Why the discrepancy? Is it different for a reason? How do these choices affect performance? (Particularly under Linux). Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3.0 has more duplication in source code than Python2.5

2009-02-10 Thread Дамјан Георгиевски
I have made the same analysis to some commercial source code, the dup60 rate is quite often significantly larger than 15%. commercial code sucks often .. that's why they hide it :) -- дамјан ( http://softver.org.mk/damjan/ ) Scarlett Johansson: You always see the glass half-empty. Woody

Re: Cheetah and hungarian charset...

2009-02-10 Thread durumdara
Hi! Ok, I forget to set encodings. from Cheetah.Template import Template d = {'a' : 'almás'} tp = Template(# encoding: iso-8859-2\nhello world éááá ${d['a']}!, searchList = {'d': d}) print tp sys.exit() This code is working for me in Windows. dd 2009.02.05. 16:21 keltezéssel, durumdara

Re: COM and threading, CoInitialize?

2009-02-10 Thread Tim Golden
Ferdinand Sousa wrote: Greetings to list members, I am trying to use an Acrobat COM object in a class that is subclassed from threading.Thread. Since threading.Thread is subclassed, the __init__ method of the inheriting class must explicitly call the threading.Thread.__init__ method of the

Using paramiko rsa key

2009-02-10 Thread loial
I want to connect via ssh from a python script on windows to an AIX server running openSSH using rsa keys rather than a password. Can anyone provide me with /point me at a simple tutuorial on the steps I need to go though in terms of geneerating the key, installing on the server and connecting

OpenERP 5.0 - Fully developed with Python

2009-02-10 Thread Stephane Wirtel
OpenERP 5.0 is out ! Why do I talk about OpenERP on this mailing list ? Because OpenERP is fully developed with Python That major enhancement of Open ERP can now answer to all the needs of a business. Open ERP V5 not only provides management functions, but also all

Re: Python Launcher.app on OS X

2009-02-10 Thread Philip Semanchuk
On Feb 9, 2009, at 10:26 PM, kpp9c wrote: okay... for the life of me i do not see any Python Launcher.app and i just installed OS X 10.5 (running 10.5.6 on intel) and i also installed the dev kit. Where the heck is this application? Hi kp, I don't seem to have any such beast on my

Re: Using paramiko rsa key

2009-02-10 Thread Tino Wildenhain
loial wrote: I want to connect via ssh from a python script on windows to an AIX server running openSSH using rsa keys rather than a password. Can anyone provide me with /point me at a simple tutuorial on the steps I need to go though in terms of geneerating the key, installing on the server

Re: STMP, mail, sender-from, to-bcc-addr

2009-02-10 Thread Philip Semanchuk
On Feb 10, 2009, at 7:29 AM, durumdara wrote: Hi! I wanna ask that have anyone some experience with email.msg and smtplib? The email message and smtp.send already have sender/from and recip/addr to. Possible the smtp components does not uses the email tags if I not define them only in

Re: Calling into Python from a C thread

2009-02-10 Thread Philip Semanchuk
On Feb 9, 2009, at 3:59 PM, Christian Heimes wrote: Philip Semanchuk wrote: Yes, that's accurate except for the word forgot. To forget something one must first know it. =) I found the threading API documentation difficult to follow, but I suppose that what I'm doing is a little unusual so

Uploading big files wit cherrypy

2009-02-10 Thread Farsheed Ashouri
I use this code to upload using cherrypy: #Code Start== class NoteServer(object): _cp_config = { 'tools.sessions.on': True } def index(self): return htmlbody form action=upload method=post enctype=multipart/ form-data filename:

Re: STMP, mail, sender-from, to-bcc-addr

2009-02-10 Thread Roel Schroeven
durumdara schreef: Hi! I wanna ask that have anyone some experience with email.msg and smtplib? The email message and smtp.send already have sender/from and recip/addr to. Possible the smtp components does not uses the email tags if I not define them only in the message?

Re: Super() confusion

2009-02-10 Thread Marc 'BlackJack' Rintsch
On Tue, 10 Feb 2009 02:11:10 -0800, Michele Simionato wrote: Unfortunately there is no good solution. If you have a single inheritance hierarchy and you do not use super, you make it impossible for users of your hierarchy to subclass it by using multiple inheritance in a cooperative way (this

Re: Using paramiko rsa key

2009-02-10 Thread loial
Can anyone be a little more helpful than Tino? I have generated the key file as follows on windows and ftp'd the id_rsa.pub file to the .ssh directory on the server and renamed to authorized_keys import paramiko key = paramiko.RSAKey.generate(2048) key.write_private_key_file('Z:/id_rsa')

Re: how to find out vesion of a python module

2009-02-10 Thread Martin
Hi, 2009/2/10 Atishay contactatis...@gmail.com: Now the point is, how do I avoid setting LD_LIBRARY_PATH everytime for python? I know I can write a bash script, but I am sure python would have some feature that I can tweak to make it work. On debian you can modify * /etc/ld.so.conf and/or

Change in cgi handling of POST requests

2009-02-10 Thread Mac
We just upgraded Python to 2.6 on some of our servers and a number of our CGI scripts broke because the cgi module has changed the way it handles POST requests. When the 'action' attribute was not present in the form element on an HTML page the module behaved as if the value of the attribute was

Re: Import without executing module

2009-02-10 Thread rdmurray
Lie Ryan lie.1...@gmail.com wrote: On Tue, 03 Feb 2009 20:08:34 -0800, Stephen Hansen wrote: There is no need to try to make sure something is executed/compiled only once in Python like you may want to do in C. Every module is only ever compiled once: if you import it ten times in ten

Re: version in setup.cfg

2009-02-10 Thread Jasiu
I don't think so. But there are several other options: I was afraid of that. Thanks anyway! Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: import wx works interactive but not from script

2009-02-10 Thread jefm
I ran the script from a command line, so it is not a file association thing. I do have multiple versions of Python installed on that machine. I will uninstall them all and install a single version from clean. Thanks for the suggestion -- http://mail.python.org/mailman/listinfo/python-list

Re: import wx works interactive but not from script

2009-02-10 Thread Tim Golden
jefm wrote: I ran the script from a command line, so it is not a file association thing. Ummm... if you ran it by just typing the script name -- c:\test\whatever.py rather than c:\pythonxx\python c:\test\whatever.py -- then it certainly could be a file association issue. I do have multiple

Tricky question about native extension packaging

2009-02-10 Thread olivierbourdon38
let's assume I (almost) have and extension available as a C file and the setup.py and I want to generate from this single c file 2 .so files using cc -DOPTION1 x.c to produce x_1.so cc -DOPTION2 x.c to produce x_2.so and at runtime depending of my OS version either load x_1 or x_2 any (easy)

Re: Python Launcher.app on OS X

2009-02-10 Thread Benjamin Kaplan
On Tue, Feb 10, 2009 at 10:06 AM, Philip Semanchuk phi...@semanchuk.comwrote: On Feb 9, 2009, at 10:26 PM, kpp9c wrote: okay... for the life of me i do not see any Python Launcher.app and i just installed OS X 10.5 (running 10.5.6 on intel) and i also installed the dev kit. Where

UnitTest break on failure

2009-02-10 Thread Qian Xu
Hi All, i am writing unit tests and have got a problem: I want to test some code sequence like: self.assertEquals(testMethod1(), expected_value1); self.assertEquals(testMethod2(), expected_value2); However, if the first test item is failed, no more tests will be executed. Can I tell Python,

Re: Python Launcher.app on OS X

2009-02-10 Thread Philip Semanchuk
On Feb 10, 2009, at 11:49 AM, Benjamin Kaplan wrote: On Tue, Feb 10, 2009 at 10:06 AM, Philip Semanchuk phi...@semanchuk.com wrote: On Feb 9, 2009, at 10:26 PM, kpp9c wrote: okay... for the life of me i do not see any Python Launcher.app and i just installed OS X 10.5 (running 10.5.6 on

Re: Using paramiko rsa key

2009-02-10 Thread Martin P. Hellwig
loial wrote: Can anyone be a little more helpful than Tino? cut I'll do some freebie hints :-) What I would do is try first whether key authentication works at all, for example following a tutorial like http://the.earth.li/~sgtatham/putty/0.53b/htmldoc/Chapter8.html And if that works

Re: what IDE is the best to write python?

2009-02-10 Thread Aahz
In article mailman.8714.1233686338.3487.python-l...@python.org, rdmur...@bitdance.com wrote: Quoth a...@pythoncraft.com (Aahz): In article mpg.23f220f22aa48ce9989...@news.individual.de, Thorsten Kampe thors...@thorstenkampe.de wrote: * Aahz (2 Feb 2009 09:29:43 -0800) Polarized sunglasses

Logging in Python

2009-02-10 Thread aha
Hello All, I have an application where logging may need to be configured in multiple places. I've used the Python Logging Framework for sometime, but I'm still not sure how to test if logging has configured. For example, I have modules A, B, and C. Below is some pseudo code... moduleA class

Can urllib check path exists on server?

2009-02-10 Thread Muddy Coder
Hi Folks, urllib bridges up a client to a server, it works fine. I wonder: is there a method that can check the existence of a file in the server side? We can check such an existence on local filesystem by using os.path.exists(), can I do such a check on server? For example,

Re: Python 3D CAD -- need collaborators, or just brave souls :)

2009-02-10 Thread Mike C. Fletcher
rantingrick wrote: ... It has long been my dream to create an open source 3D CAD program and i am starting to crawl my way into the first steps. I now believe i am ready to start this endeavor and i am currently looking for fellow Python programmers (no matter what skill level) to get started

Can urllib check path exists on server?

2009-02-10 Thread rdmurray
Muddy Coder cosmo_gene...@yahoo.com wrote: urllib bridges up a client to a server, it works fine. I wonder: is there a method that can check the existence of a file in the server side? We can check such an existence on local filesystem by using os.path.exists(), can I do such a check on

Re: what IDE is the best to write python?

2009-02-10 Thread rdmurray
a...@pythoncraft.com (Aahz) wrote: In article mailman.8714.1233686338.3487.python-l...@python.org, rdmur...@bitdance.com wrote: Quoth a...@pythoncraft.com (Aahz): Then I have the problem of copying around the syntax highlighting configuration to every computer I use. Well, _that's_ easy

python3 tutorial for newbie

2009-02-10 Thread Gary Wood
Can someone recommend a good tutorial for Python 3, ideally that has tasks or assignments at the end of each chapter. Please, -- http://mail.python.org/mailman/listinfo/python-list

Re: generator object or 'send' method?

2009-02-10 Thread Aaron Brady
On Feb 10, 6:30 am, andrew cooke and...@acooke.org wrote: steven probably knows this, but to flag the issue for people who are looking at generators/coroutines for the first time: there's a little gotcha about exactly how the two sides of the conversation are synchronized.  in simple terms:

Re: Using paramiko rsa key

2009-02-10 Thread loial
On 10 Feb, 17:08, Martin P. Hellwig martin.hell...@dcuktec.org wrote: loial wrote: Can anyone be a little more helpful than Tino? cut I'll do some freebie hints :-) What I would do is try first whether key authentication works at all, for example following a tutorial

Re: UnitTest break on failure

2009-02-10 Thread Joe Riopel
On Tue, Feb 10, 2009 at 11:48 AM, Qian Xu quian...@stud.tu-ilmenau.de wrote: self.assertEquals(testMethod1(), expected_value1); self.assertEquals(testMethod2(), expected_value2); However, if the first test item is failed, no more tests will be executed. Can I tell Python, 1. go ahead, if a

getopt index out of range

2009-02-10 Thread Matthew Sacks
Hi List, I am getting an index out of range error when trying to parse with getopt. Probably something simple. Any suggestions are appreciated optlist, args = getopt.getopt(sys.argv[1:], 'h', ['connectPassword=', 'adminServerURL=', 'action=', 'targets=', 'appDir=']) #Assign Opts connectPassword

Re: subprocess.Popen - file like object from stdout=PIPE

2009-02-10 Thread Aahz
In article 49899185$0$2861$ba620...@news.skynet.be, Helmut Jarausch jarau...@skynet.be wrote: These pipes are exposed as file-like objects which can be accessed via the stdin, stdout or stderr (resp.) attributes of an object of class subprocess.Popen . Please file a doc request at

bool evaluations of generators vs lists

2009-02-10 Thread Josh Dukes
quite simply...what??? In [108]: bool([ x for x in range(10) if False ]) Out[108]: False In [109]: bool( x for x in range(10) if False ) Out[109]: True Why do these two evaluate differently? I was expecting that they would evaluate the same but the generator would return true *as soon as the

Python DLL's for C++?

2009-02-10 Thread Geert Vancompernolle
Hi, Is it possible to write DLL's in Python for applications that only provide C++ interfaces? Example: NotePad++ is extendible by writing C++ DLL's which can call the NotePad++ interfaces. I wonder if those DLL's also can be written in Python, which in the end calls the C++ interfaces of

Re: UnitTest break on failure

2009-02-10 Thread Scott David Daniels
Qian Xu wrote: i am writing unit tests and have got a problem: I want to test some code sequence like: self.assertEquals(testMethod1(), expected_value1); self.assertEquals(testMethod2(), expected_value2); However, if the first test item is failed, no more tests will be executed. Can I tell

Using TK and the canvas.

2009-02-10 Thread Kalibr
Hi all. I'm experimenting with making a UI for a little (well, not quite) script that basically draws up a tech tree to some skills from my favorite game. What I'm aiming for looks a little like this site here:(apologies if I'm not supposed to direct link)

Introduction to Python, Washington DC, March 3-5

2009-02-10 Thread Steve Holden
Holden Web is pleased to announce its next public introductory Python class in the Washington, DC area on March 3-5. To enroll, or to learn more about the class please visit: http://holdenweb.com/py/training/ If you have multiple students requiring training you may be interested to know that

Re: bool evaluations of generators vs lists

2009-02-10 Thread Chris Rebert
On Tue, Feb 10, 2009 at 11:15 AM, Josh Dukes josh.du...@microvu.com wrote: quite simply...what??? In [108]: bool([ x for x in range(10) if False ]) Out[108]: False This evaluates the list comprehension and creates an empty list, which is considered boolean False by Python. In [109]: bool( x

Re: bool evaluations of generators vs lists

2009-02-10 Thread Albert Hopkins
On Tue, 2009-02-10 at 11:15 -0800, Josh Dukes wrote: quite simply...what??? In [108]: bool([ x for x in range(10) if False ]) Out[108]: False In [109]: bool( x for x in range(10) if False ) Out[109]: True Why do these two evaluate differently? I was expecting that they would evaluate

ANN: Python 2.6 Quick Reference available

2009-02-10 Thread Richard Gruet
The Python 2.6 Quick Reference is available in HTML and PDF formats at http://rgruet.free.fr/#QuickRef. This time I was helped by Josh Stone for the update. As usual, your feedback is welcome (pqr at rgruet.net). Cheers, Richard Gruet -- http://mail.python.org/mailman/listinfo/python-list

Re: Super() confusion

2009-02-10 Thread Benjamin Peterson
Marc 'BlackJack' Rintsch bj_666 at gmx.net writes: On Tue, 10 Feb 2009 02:02:43 +, Benjamin Peterson wrote: Jean-Paul Calderone exarkun at divmod.com writes: Consider whether you really need to use super(). http://fuhm.net/super-harmful/ This article chiefly deals with

Re: Super() confusion

2009-02-10 Thread Jean-Paul Calderone
On Tue, 10 Feb 2009 19:40:56 + (UTC), Benjamin Peterson benja...@python.org wrote: Marc 'BlackJack' Rintsch bj_666 at gmx.net writes: On Tue, 10 Feb 2009 02:02:43 +, Benjamin Peterson wrote: Jean-Paul Calderone exarkun at divmod.com writes: Consider whether you really need to use

Re: Tricky question about native extension packaging

2009-02-10 Thread Chris Rebert
On Tue, Feb 10, 2009 at 8:42 AM, olivierbourdo...@gmail.com wrote: let's assume I (almost) have and extension available as a C file and the setup.py and I want to generate from this single c file 2 .so files using cc -DOPTION1 x.c to produce x_1.so cc -DOPTION2 x.c to produce x_2.so and

Working with propositional formulae in Python

2009-02-10 Thread nnp
Hey, I'm currently working with propositional boolean formulae of the type 'A (b - c)' (for example). I was wondering if anybody knows of a Python library to create parse trees and convert such formulae to conjunctive, disjunctive and Tseitin normal forms? Cheers, nnp --

Re: Using TK and the canvas.

2009-02-10 Thread r
On Feb 10, 1:27 pm, Kalibr space.captain.f...@gmail.com wrote: [snip] Now I know all I have to do is set the SkillInfos parent to a canvas, but how would I arrange and draw the lines? Thanks all :) You should really check out wxPython, there is support for just this type of thing. of course you

Re: Super() confusion

2009-02-10 Thread Daniel Fetchinson
On 2/9/09, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Mon, 09 Feb 2009 23:34:05 -0200, Daniel Fetchinson fetchin...@googlemail.com escribió: Hello. I've been scouring the web looking for something to clear up a little confusion about the use of super() but haven't found anything

Re: Super() confusion

2009-02-10 Thread Daniel Fetchinson
Consider whether you really need to use super(). http://fuhm.net/super-harmful/ Did you actually read that article, understood it, went through the tons of responses from python-dev team members, including Guido Tons of responses? This was mentioned already, but just to repeat: one good

Re: Logging in Python

2009-02-10 Thread Robert Kern
On 2009-02-10 11:50, aha wrote: Hello All, I have an application where logging may need to be configured in multiple places. I've used the Python Logging Framework for sometime, but I'm still not sure how to test if logging has configured. For example, I have modules A, B, and C. Below is

Re: Python DLL's for C++?

2009-02-10 Thread Martin v. Löwis
Is it possible to write DLL's in Python for applications that only provide C++ interfaces? Example: NotePad++ is extendible by writing C++ DLL's which can call the NotePad++ interfaces. Not directly, no. You have to write a C++ DLL which then can delegate all calls to it to some Python

How to get a return from Button?

2009-02-10 Thread Muddy Coder
Hi Folks, I want to use a Button to trigger askopenfilename() dialog, then I can select a file. My short code is below: def select_file(): filenam = askopenfilename(title='Get the file:') return filenam root = Tk() Button(root, text='Select a file', command=select_file).pack()

Re: Logging in Python

2009-02-10 Thread Vinay Sajip
On Feb 10, 5:50 pm, aha aquil.abdul...@gmail.com wrote: Hello All, I have an application whereloggingmay need to be configured in multiple places. I've used the PythonLoggingFramework for sometime, but I'm still not sure how to test iflogginghas configured. For example, I have modules A,

Functional schmunctional...

2009-02-10 Thread r0g
I remember being forced to do a bit of functional programming in ML back at Uni in the mid 90, the lecturers were all in a froth about it and I must admit the code was elegant to look at. The problem was the dog slow performance for anything half practical, especially with recursion being the

Re: How to get a return from Button?

2009-02-10 Thread Chris Rebert
On Tue, Feb 10, 2009 at 12:21 PM, Muddy Coder cosmo_gene...@yahoo.com wrote: Hi Folks, I want to use a Button to trigger askopenfilename() dialog, then I can select a file. My short code is below: def select_file(): filenam = askopenfilename(title='Get the file:') return

Change in cgi module's handling of POST requests

2009-02-10 Thread Bob Kline
[Didn't realize the mirror didn't work both ways] We just upgraded Python to 2.6 on some of our servers and a number of our CGI scripts broke because the cgi module has changed the way it handles POST requests. When the 'action' attribute was not present in the form element on an HTML page

Re: bool evaluations of generators vs lists

2009-02-10 Thread Josh Dukes
The first example is a list. A list of length 0 evaluates to False. The second example returns a generator object. A generator object apparently evaluates to true. Your example is not iterating of their values of the generator, but evaluating bool(generator_object) itself. My feeling is

  1   2   3   4   >