Re: Python Source Code Beautifier

2007-02-28 Thread Franz Steinhaeusler
Hello, thanks. pythontidy (with maybe some patches could be useful) not directly related but: pyflakes looks quite interesting too. and I try out (again) pylint and pychecker or a combination of these could bring good results, I assume. ;) -- http://mail.python.org/mailman/listinfo/python-list

How to update DNS record

2007-02-28 Thread Andi Clemens
Hi, I want to update our DNS servers periodically with some IP addresses. But I don't know how to do this. I searched the Internet quite a while but I haven't found a good example how to do this. I want to change the A-Record for some IPs, this shouldn't be too hard. I looked at dnspython and twis

Re: Reading csv files using SQL

2007-02-28 Thread Paul McGuire
On Mar 1, 12:30 am, Pablo was Paolo <[EMAIL PROTECTED]> wrote: > Hi, > > Dennis Lee Bieber ha scritto: > > >You could maybe use SQLite to load the CSV file and process in an > > actual DBMS... > > Ok, this is the solution I'm using actually (with PostGres). > My hope is to find a way to do the

Re: How to Read Bytes from a file

2007-02-28 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > It seems like this would be easy but I'm drawing a blank. > > What I want to do is be able to open any file in binary mode, and read > in one byte (8 bits) at a time and then count the number of 1 bits in > that byte. > > I got as far as this but it

How to Read Bytes from a file

2007-02-28 Thread [EMAIL PROTECTED]
It seems like this would be easy but I'm drawing a blank. What I want to do is be able to open any file in binary mode, and read in one byte (8 bits) at a time and then count the number of 1 bits in that byte. I got as far as this but it is giving me strings and I'm not sure how to accurately get

Re: Writing an interpreter for language similar to python!!

2007-02-28 Thread Hendrik van Rooyen
"luvsat" <[EMAIL PROTECTED]> wrote: > Hello all, > > I am new to python and working on a project that involves designing a > new language. The grammar of the language is very much inspired from > python as in is supports nearly all the statements and expressions > that are supported by python. 8

Re: Dialog with a process via subprocess.Popen blocks forever

2007-02-28 Thread Hendrik van Rooyen
<[EMAIL PROTECTED]> wrote: > Is it possible to read to and write to the std streams of a > subprocess? What am I doing wrong? I think this problem lies deeper - there has been a lot of complaints about blocking and data getting stuck in pipes and sockets... I have noticed that the Python file o

Re: Reading csv files using SQL

2007-02-28 Thread Pablo was Paolo
Hi, Dennis Lee Bieber ha scritto: > You could maybe use SQLite to load the CSV file and process in an > actual DBMS... Ok, this is the solution I'm using actually (with PostGres). My hope is to find a way to do the same thing without using a DBMS but working directly with the files. Thank

Re: pyHook or SetWindowsHookEx

2007-02-28 Thread craig wickesser
well the problem I have only occurs when my python app. is running as a Windows Service. if I run the python app. as a process (i.e. from the command line) it works as epxected via Remote Desktop. still not sure what's going on. On 2/28/07, Sick Monkey <[EMAIL PROTECTED]> wrote: I have just

Re: Tuples vs Lists: Semantic difference (was: Extract String From Enclosing Tuple)

2007-02-28 Thread George Sakkis
On Feb 28, 10:45 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Bjoern Schliessmann <[EMAIL PROTECTED]> writes: > > I know tuples as immutable lists ... > > That's a common misconception. And this catch phrase, "that's a common misconception", is a common aping of the BDFL's take on this. As severa

Python installation problem (sorry if this is a dup)

2007-02-28 Thread Ray Buck
I've been trying to install Mailman, which requires a newer version of the Python language compiler (p-code generator?) than the one I currently have on my linux webserver/gateway box. It's running a ClarkConnect 2.01 package based on Red Hat 7.2 linux. I downloaded the zipped tarball (Python-2

Weekly Python Patch/Bug Summary

2007-02-28 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 416 open ( +8) / 3593 closed ( +8) / 4009 total (+16) Bugs: 974 open ( +6) / 6520 closed (+15) / 7494 total (+21) RFE : 268 open ( +1) / 251 closed ( +0) / 519 total ( +1) New / Reopened Patches __ Allow spe

Re: Question about raise and exceptions.

2007-02-28 Thread Daniel Klein
On Wed, 28 Feb 2007 22:03:13 +0100, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Daniel Klein a écrit : >> The arguments for TransitionError must be a tuple, > >Err... > >> eg: >> >> msg = "Going to error state %d from state %d" % (self.curr_state, >> newstate) >> raise TransitionError(self,

Tuples vs Lists: Semantic difference (was: Extract String From Enclosing Tuple)

2007-02-28 Thread Ben Finney
Bjoern Schliessmann <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > > A tuple implies a meaning associated with each position in the > > sequence (like a record with a positional meaning for each field), > > a list implies the opposite (a sequence with order but not meaning > > associated with

Subprocess timeout

2007-02-28 Thread George Sakkis
I'm trying to use a threaded timeout decorator (http:// aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483752) to spawn a subprocess with a timeout. On a linux box runnning python 2.5 I get "OSError: [Errno 10] No child processes" on wait(); running the same program on a different box (again linu

Re: pyscripter

2007-02-28 Thread Gabriel Genellina
En Wed, 28 Feb 2007 11:28:49 -0300, Gigs_ <[EMAIL PROTECTED]> escribió: > im using pyscripter ide > > it is all alright till the next def > > class Checkbar(Frame): > def __init__(self, parent=None, picks=[], side=LEFT, anchor=W): > Frame.__init__(self, parent) > self.vars =

Re: convert many excel files to pdf in batch

2007-02-28 Thread Joshua J. Kugler
Wensui Liu wrote: > Adam, > If you could come up with a way without using Adobe writer, it should > also work for me. > thanks. > > On 28 Feb 2007 12:53:52 -0800, Adam <[EMAIL PROTECTED]> wrote: >> 1. Get PDFCreator >> 2. Install >> 3. Set as default printer >> 4. Have all excel files in same fol

Re: design question: no new attributes

2007-02-28 Thread Gabriel Genellina
En Wed, 28 Feb 2007 09:41:47 -0300, Alan Isaac <[EMAIL PROTECTED]> escribió: > However I will observe that > - entire languages are structured on the premise that dynamic > attribute creation can be hazardous That's why we have so many languages to choose from. What is highly important for so

Re: class declaration shortcut

2007-02-28 Thread Bjoern Schliessmann
Bruno Desthuilliers wrote: > class Toto(object): > pass > > print Toto.__name__ Okay, I revoke my statement and assert the opposite. But what's it (__name__) good for? Regards, Björn -- BOFH excuse #179: multicasts on broken packets -- http://mail.python.org/mailman/listinfo/python

questions on dynamically binding the Python interpreter

2007-02-28 Thread has
Hi all, need a little bit of advice on dynamically binding an embedded Python interpreter. First, the code for anyone that wants a look: http://trac.macosforge.org/projects/appscript/browser/py-osacomponent/trunk/PyOSA It's a Python OSA component for OS X. The idea is that you wrap up a scriptin

Re: Extract String From Enclosing Tuple

2007-02-28 Thread Bjoern Schliessmann
Ben Finney wrote: > A tuple implies a meaning associated with each position in the > sequence (like a record with a positional meaning for each field), > a list implies the opposite (a sequence with order but not meaning > associated with each position). Explain. I know tuples as immutable lists

Re: text wrapping help

2007-02-28 Thread Bjoern Schliessmann
Ryan K wrote: > It doesn't even run but when I go through it interactively it > seems okay. Once again, any help is appreciated. I haven't tested yet, but why don't you make a list of words of the text (with split), and then accumulate words in a list until the next word would make the line too l

Re: gmpy moving to code.google.com

2007-02-28 Thread Daniel Nogradi
> Could you please tell me, on that 64-bit build, what happens with: > > >>> import gmpy, sys, operator > >>> sys.maxint > ??? > >>> gmpy.mpz(sys.maxint) > ??? > >>> operator.index(gmpy.mpz(sys.maxint)) > ??? > >>> sys.maxint+1 > ??? > >>> gmpy.mpz(sys.maxint+1) > ??? > >>> operator.index(gmpy.mpz(

Re: Installing java2python (Newbie)

2007-02-28 Thread Gabriel Genellina
En Wed, 28 Feb 2007 19:54:26 -0300, MRAB <[EMAIL PROTECTED]> escribió: > On Feb 28, 5:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: >> you want to run the windows command prompt, which is called "cmd.exe" >> in windows xp. press the "start menu", then select "run", then type >> "cmd.e

Make Tkinter canvas respond to MouseWheel event

2007-02-28 Thread WaterWalk
Hello. When I tried to make Tkinter canvas widget respond to MouseWheel event on Windows XP, I failed. The canvas just doesn't receive MouseWheel event. I used bind_all to find out which widget receives this event and the result showed that only the top Tk widget gets it. This is really annoying.

Re: pyHook or SetWindowsHookEx

2007-02-28 Thread Sick Monkey
I have just gotten into pyHook, so I could be incredibly wrong, but I have researched a lot into your problem. (cuz I have the same question) I think the python program has to be on the remote machine becuase from my understanding pyHook just reads in the windows' keyboard driver. And when you

Re: text wrapping help

2007-02-28 Thread attn . steven . kuo
On Feb 28, 5:50 pm, "Ryan K" <[EMAIL PROTECTED]> wrote: > On Feb 28, 8:27 pm, [EMAIL PROTECTED] wrote: > > > Try: > > > import re > > sample_text = """Personal firewall software may warn about the > > connection IDLE makes to its subprocess using this computer's internal > > loopback interface. T

Re: Changing directories in oswalk [was Re: Walk thru each subdirectory from a top directory]

2007-02-28 Thread Steven D'Aprano
On Wed, 28 Feb 2007 08:38:41 +0100, Peter Otten wrote: > Does the problem occur if you pass an absolute path to > os.walk()/os.path.walk()? Well, arguably the problem is that macunpack insists on writing to the current working directory. Or the problem is that os.walk sets the working directory

Re: newbie question(file-delete trailing comma)

2007-02-28 Thread Gabriel Genellina
En Wed, 28 Feb 2007 08:34:29 -0300, kavitha thankaian <[EMAIL PROTECTED]> escribió: > thanks,, > now i have one more problem,,, > the strings should be seperated in an order,,, > some={1:'a', 2:7, 3:'c', 4:'d'} > i need the output to be a,c,d,7 > before my code was: > field_or

Re: text wrapping help

2007-02-28 Thread Ryan K
That works great but I need to replace the newlines with 24-(the index of the \n) spaces. On Feb 28, 8:27 pm, [EMAIL PROTECTED] wrote: > On Feb 28, 4:06 pm, "Ryan K" <[EMAIL PROTECTED]> wrote: > > > I'm trying to text wrap a string but not using the textwrap module. I > > have 24x9 "matrix" and

Re: urlDecode()

2007-02-28 Thread gert
import re def htc(m): return chr(int(m.group(1),16)) def urldecode(url): rex=re.compile('%([0-9a-hA-H][0-9a-hA-H])',re.M) return rex.sub(htc,url) if __name__ == '__main__': print urldecode('adasasdasd%20asdasdasdas') Ok thats it enough googeling around i make one my self :) --

Re: text wrapping help

2007-02-28 Thread attn . steven . kuo
On Feb 28, 4:06 pm, "Ryan K" <[EMAIL PROTECTED]> wrote: > I'm trying to text wrap a string but not using the textwrap module. I > have 24x9 "matrix" and the string needs to be text wrapped according > to those dimensions. Is there a known algorithm for this? Maybe some > kind of regular expression

Re: text wrapping help

2007-02-28 Thread Sick Monkey
I am not certain if I understand your problem, but I think you are just trying to read in a string and create a visable matrix. If that is true, then may some of the code below will work. This is in no way elegant. ++ count = 1 width = 2

[humor] Black Box of Or

2007-02-28 Thread Aahz
http://worsethanfailure.com/Comments/The_Black_Box_of_Or.aspx -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "I disrespectfully agree." --SJM -- http://mail.python.org/mailman/listinfo/python-list

Image not displaying in Text widget

2007-02-28 Thread Sudipta Chatterjee
Hi all, I am facing a strange problem when I try to embed images in a text widget. After reading the file via PhotoImage() and then using text.image_create(INSERT, image=img), I get a blank place instead of the image. The size of the blank area under highlighting via the mouse select comes to exa

Re: Special Characters

2007-02-28 Thread Gabriel Genellina
En Tue, 27 Feb 2007 22:56:15 -0300, Sick Monkey <[EMAIL PROTECTED]> escribió: > I found out that when I was reading the file, there > were additional blank spaces being appended to the value. > > To correct the issue, I just had to dp > varName = msInfo[0].strip() > finName = varName.str

Re: text wrapping help

2007-02-28 Thread Ryan K
Okay, I was a little vague in my last post...the matrix is like a Wheel of Fortune board and it knows nothing about newlines. After 24 characters it spills over onto the next line. Here is what I came up with: ## Wrap Text def wrap_text(in_str, chars_line): """ wrap text """ spaces = 0

Re: How do I Color a QTableView row in PyQt4

2007-02-28 Thread David Boddie
[Following up my own post.] On Thursday 01 March 2007 01:08, David Boddie wrote: > It's interesting to see that you subclassed QSqlQueryModel instead of > using a custom delegate to display the data. It's usually recommended > that you subclass QItemDelegate if you want to customize the way items

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread kevinliu23
H, right now...I'm doing multiplication on the index values returned by GetDiskFreeSpace. According to the documentation... tuple[0]: sectors per cluster tuple[1]: number of bytes per sector tuple[2]: total number of free clusters tuple[3]: total number of clusters on the disk So I'm multiply

Audio -- Looking for Help with Using Snack on Windows

2007-02-28 Thread v.davis2
Hi all, I am looking for some non-trivial examples of use of the Snack toolbox [on Windows]. The documentation seems a bit lacking. One typical example is how to use the FFT method or the Configure method or the mixer or . I have searched and examined many examples, but so far they just seem

A Windows Printing Problem -- Tk Canvas Under Python

2007-02-28 Thread v.davis2
Hi all, I have searched a bit for this -- both in the newsgroup and Google -- No luck. How do I print a Tk Canvas object under Windows? No, I do NOT want to generate the Postscript and do it that way (unless I have to). The same question applies to other aspects of the GUI. I just have to believ

Re: Rational numbers

2007-02-28 Thread Fernando Perez
[EMAIL PROTECTED] wrote: > On Feb 25, 3:09 pm, Fernando Perez <[EMAIL PROTECTED]> wrote: >> Alex, have you had a look at SAGE? >> >> http://modular.math.washington.edu/sage/ >> >> it uses GMP extensively, so they've had to patch it to work around these >> issues. You can look at the SAGE release

Re: difference between string and list

2007-02-28 Thread Gabriel Genellina
En Tue, 27 Feb 2007 18:00:25 -0300, lincoln rutledge <[EMAIL PROTECTED]> escribió: > Okay, I actually have those pages up in my browser. I found the string > methods: > http://docs.python.org/lib/string-methods.html > > But I am having trouble finding the same information for lists... On that

Re: How do I Color a QTableView row in PyQt4

2007-02-28 Thread David Boddie
On Wednesday 28 February 2007 18:55, Mel wrote: > I am currently porting an SQL centered Visual Basic application to run > on Linux, Python, and Qt4. Currently I am stumped on changing row > colors in the QTableView widget. My test code is based on code from > the PyQt4 examples and looks like

text wrapping help

2007-02-28 Thread Ryan K
I'm trying to text wrap a string but not using the textwrap module. I have 24x9 "matrix" and the string needs to be text wrapped according to those dimensions. Is there a known algorithm for this? Maybe some kind of regular expression? I'm having difficulty programming the algorithm. Thanks, Ryan

urlDecode()

2007-02-28 Thread gert
Anybody can tell me what i need to import to make urlDecode() work in python2.5 please. import urllib urllib.urlDecode(post) #doesn't exist urllib.urldecode(post) #doesn't exist urldecode(post)#doesn't exist urlDecode(post) #doesn't exist -- http://mail.python.org/mailm

Re: *** CANADIAN ANTI-TERROR LAW HAS BEEN STRUCK DOWN BY ITS HONORABLE SUPREME COURT UNANIMOUSLY *** (REPOST)

2007-02-28 Thread Aviroce
On Feb 24, 11:22 am, [EMAIL PROTECTED] wrote: > Canada anti-terror law is struck down>From the Associated Press > > February 24, 2007 > > OTTAWA - Canada's Supreme Court on Friday unanimously declared it > unconstitutional to detain foreign terrorism suspects indefinitely > while the courts review

Re: Extract String From Enclosing Tuple

2007-02-28 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> writes: > orders = ( > [...] > ) > > order_items = ( > [...] > ) For clarity, these sequences of records should be lists (with each item being a tuple containing the record fields), not tuples. A tuple implies a meaning associated with each position in the sequence

Re: class declaration shortcut

2007-02-28 Thread Bruno Desthuilliers
Bjoern Schliessmann a écrit : (snip) > In Python, classes have no name. class Toto(object): pass print Toto.__name__ -- http://mail.python.org/mailman/listinfo/python-list

Re: design question: no new attributes

2007-02-28 Thread Bruno Desthuilliers
Alan Isaac a écrit : > Ben Finney writes: > >>Really, though, adding attributes to an instance is a normal thing to >>do in Python, and you've not yet shown why you want that normal >>functionality to be special-cased here. > > > > I accept your earlier point that if an interface changes > one

Re: class declaration shortcut

2007-02-28 Thread Bjoern Schliessmann
Luis M. González wrote: > I've come across a code snippet in www.rubyclr.com where they show > how easy it is to declare a class compared to equivalent code in > c#. I wonder if there is any way to emulate this in Python. > > The code is as follows: > > Person = struct.new( :name, :birthday, :ch

Re: using telnetlib

2007-02-28 Thread Bjoern Schliessmann
Phoe6 wrote: > That did help and solved my problem. ":" after \n was just a typo. Thanks for feedback :) I've had a similar problem once, too. Regards, Björn -- BOFH excuse #166: /pub/lunch -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing java2python (Newbie)

2007-02-28 Thread MRAB
On Feb 28, 5:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Hi Jeremy, that's the problem I'm having. Where should I type that " > > python setup.py install" ? Once again I'm using Windows system and not > > Unix. Should I move the file to a specific folder under Python 2.5 and > > then

Re: New to Tkinter GUI building

2007-02-28 Thread Adam
On Feb 28, 9:13 pm, Adonis Vargas <[EMAIL PROTECTED]> wrote: > Adam wrote: > > > > > I think my main questions are: > > 1. How can I get the Window to be sized the way I want it? > > 2. How can I get the Scrollbars to fill the side of the text box > > instead of being small? (like .pack(fill= tk.Y

Re: Question about raise and exceptions.

2007-02-28 Thread Bruno Desthuilliers
Ben Finney a écrit : (snip) > The syntax of the 'raise' statement requires one, two, or three > arguments, all of which instruct 'raise' what to do, and none of which > refer to arguments given to the exception instance. Not quite. If the first argument is a class and the second argument is not a

Re: Question about raise and exceptions.

2007-02-28 Thread Bruno Desthuilliers
Steven W. Orr a écrit : > On Wednesday, Feb 28th 2007 at 22:03 +0100, quoth Bruno Desthuilliers: > > =>Daniel Klein a ?crit : > =>> On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" > =>> <[EMAIL PROTECTED]> wrote: > =>> > =>> > =>>>When I run it I get this: > =>>> > =>>>884 > ./t_fsm.py

Re: Extract String From Enclosing Tuple

2007-02-28 Thread Ben Finney
[EMAIL PROTECTED] writes: > Data are assembled for writing to a database table. A > representative tuple looks like this: > > ('eco', "(u'Roads',)", 0.073969887301348305) You refer to the second item as "a tuple" later, but it's not; it's now just a string (not even a unicode string). Whatever

Re: Python Source Code Beautifier

2007-02-28 Thread [EMAIL PROTECTED]
On Feb 28, 11:24 am, Alan Franzoni <[EMAIL PROTECTED]> wrote: > Il 27 Feb 2007 16:14:20 -0800, [EMAIL PROTECTED] ha scritto: > > > > > Those mean different things: > > a=[1] > b=a > a += [2] > a > > [1, 2] > b > > [1, 2] > a=[1] > b=a > a = a + [2] > a >

Re: class declaration shortcut

2007-02-28 Thread Steven Bethard
Luis M. González wrote: > On Feb 28, 6:21 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: >> How about something like:: >> >> class Person(Record): >> __slots__ = 'name', 'birthday', 'children' >> >> You can then use the class like:: >> >> person = Person('Steve', 'April 25', []) >

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Jerry Hill
On 2/28/07, Tim Golden <[EMAIL PROTECTED]> wrote: > Well it's not often someone beats me to a WMI > solution :) Just to be different, you can also > look at the GetDiskFreeSpace function in the > win32api module of the pywin32 extensions. The MSDN page for that function warns: "The GetDiskFreeSpac

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Tim Golden
kevinliu23 wrote: > Thanks so much for the help guys. I got the code Sick Monkey provided > to work on my computer. Now I"m more confused than ever though. :) I > thought the only standard modules provided by Python are listed here: > > http://docs.python.org/modindex.html > > But it appears that

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread kevinliu23
Just tried your solution Tim, worked like a charm. :) It's great because I don't even have to worry about the computer name. A question regarding the rootPath parameter...how would I be passing it? Would I be passing it as... tuple = win32api.GetDiskFreeSpace(r'C:') or just leave it blank and

Re: class declaration shortcut

2007-02-28 Thread Luis M. González
On Feb 28, 6:21 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > Luis M. González wrote: > > I've come across a code snippet inwww.rubyclr.comwhere they show how > > easy it is to declare a class compared to equivalent code in c#. > > I wonder if there is any way to emulate this in Python. > > > The

Re: Yet another unique() function...

2007-02-28 Thread Paul Rubin
"MonkeeSage" <[EMAIL PROTECTED]> writes: > In your case optimized version, in the second try clause using > itertools, it should be like this, shouldn't it? > > return t(g.next()[1] for k,g in groupby(s, lambda (i,v): v)) I didn't think so but I can't conveniently test it for now. Maybe tonight.

Re: Question about raise and exceptions.

2007-02-28 Thread Steven W. Orr
On Wednesday, Feb 28th 2007 at 22:03 +0100, quoth Bruno Desthuilliers: =>Daniel Klein a ?crit : =>> On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" =>> <[EMAIL PROTECTED]> wrote: =>> =>> =>>>When I run it I get this: =>>> =>>>884 > ./t_fsm.py =>>>Traceback (most recent call last): =>>>

Re: Question about raise and exceptions.

2007-02-28 Thread Ben Finney
"Steven W. Orr" <[EMAIL PROTECTED]> writes: > In my class I have I assume you mean "in my module", since you're showing us several classes. > class TransitionError(Error): > [...] > def __init__(self, previous, next, message): Here you define the arguments that must be passed when

Re: Yet another unique() function...

2007-02-28 Thread MonkeeSage
Paul, In your case optimized version, in the second try clause using itertools, it should be like this, shouldn't it? return t(g.next()[1] for k,g in groupby(s, lambda (i,v): v)) ^^^ Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list

RE: Python Source Code Beautifier

2007-02-28 Thread Delaney, Timothy (Tim)
Alan Franzoni wrote: > Yeah, that's right, it could have semantic differences, but that > shouldn't be the case anyway. I mean, if I don't define an __iadd__ > method, writing > > a += n > > or > > a = a + n > > is just the same, right? > > So, if I bother to define an __iadd__ method, I sho

Re: Extract String From Enclosing Tuple

2007-02-28 Thread attn . steven . kuo
On Feb 28, 12:40 pm, [EMAIL PROTECTED] wrote: > I'm a bit embarrassed to have to ask for help on this, but I'm not finding > the solution in the docs I have here. > > Data are assembled for writing to a database table. A representative tuple > looks like this: > > ('eco', "(u'Roads',)", 0.07396

Re: finding out the precision of floats

2007-02-28 Thread John Machin
On Mar 1, 4:19 am, "Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Feb 28, 3:53 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > > > On Feb 28, 10:38 pm, "BartOgryczak" <[EMAIL PROTECTED]> wrote: > > > > [1] eg. consider calculating interests rate, which often is defined as > > > math.pow(anualRate,d

Dialog with a process via subprocess.Popen blocks forever

2007-02-28 Thread bayer . justin
Hi, I am trying to communicate with a subprocess via the subprocess module. Consider the following example: >>> from subprocess import Popen, PIPE >>> Popen("""python -c 'input("hey")'""", shell=True) >>> hey Here hey is immediately print to stdout of my interpreter, I did not type in the "hey"

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread kevinliu23
Thanks so much for the help guys. I got the code Sick Monkey provided to work on my computer. Now I"m more confused than ever though. :) I thought the only standard modules provided by Python are listed here: http://docs.python.org/modindex.html But it appears that there are other modules availab

Re: class declaration shortcut

2007-02-28 Thread Steven Bethard
Luis M. González wrote: > I've come across a code snippet in www.rubyclr.com where they show how > easy it is to declare a class compared to equivalent code in c#. > I wonder if there is any way to emulate this in Python. > > The code is as follows: > > Person = struct.new( :name, :birthday, :chi

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Tim Golden
[... re getting free disk space ...] Sick Monkey wrote: > Here you are: > > >>> from win32com.client import GetObject wmiObj = GetObject("winmgmts:MGW01641\\root\\cimv2") diskinfo = wmiObj.ExecQuery("Select * from Win32_LogicalDisk") for disk in diskinfo: > ...print disk.N

Re: New to Tkinter GUI building

2007-02-28 Thread Adonis Vargas
Adam wrote: > I think my main questions are: > 1. How can I get the Window to be sized the way I want it? > 2. How can I get the Scrollbars to fill the side of the text box > instead of being small? (like .pack(fill= tk.Y) > > > I have only posted the code relevant to the GUI. > > TIA > Adam >

Re: Yet another unique() function...

2007-02-28 Thread MonkeeSage
On Feb 28, 2:18 pm, Paul Rubin wrote: > Unicode fix (untested): > > def unique(seq, keepstr=True): > t = type(seq) > if t in (unicode, str): > t = (list, t('').join)[bool(keepstr)] > seen = [] > return t(c for c in seq if not (c in seen or seen.app

Re: convert many excel files to pdf in batch

2007-02-28 Thread Wensui Liu
Adam, If you could come up with a way without using Adobe writer, it should also work for me. thanks. On 28 Feb 2007 12:53:52 -0800, Adam <[EMAIL PROTECTED]> wrote: > 1. Get PDFCreator > 2. Install > 3. Set as default printer > 4. Have all excel files in same folder > 5. Select all excel files > 6

Re: Curses and resizing windows

2007-02-28 Thread Thomas Dickey
Nick ! <[EMAIL PROTECTED]> wrote: > http://web.cs.mun.ca/~rod/ncurses/ncurses.html#xterm says "The ncurses > library does not catch [the SIGWINCH aka resizing] signal, because it > cannot in general know how you want the screen re-painted". First, is > this really true? When I make my xterms small

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Sick Monkey
Sorry, I forgot to make a change. You will need to change "COMPUTER_NAME" ~~~ >>> from win32com.client import GetObject wmiObj = GetObject("winmgmts:COMPUTER_NAME\\root\\cimv2") diskinfo = wmiObj.ExecQuery("Select * from Win32_LogicalDisk") for disk in dis

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Sick Monkey
Here you are: >>> from win32com.client import GetObject wmiObj = GetObject("winmgmts:MGW01641\\root\\cimv2") diskinfo = wmiObj.ExecQuery("Select * from Win32_LogicalDisk") for disk in diskinfo: ...print disk.Name, disk.FreeSpace ... A: None C: 16978259968 D: None On 28 Feb 2007 12:2

Re: convert many excel files to pdf in batch

2007-02-28 Thread Adam
1. Get PDFCreator 2. Install 3. Set as default printer 4. Have all excel files in same folder 5. Select all excel files 6. Right click 7. Select Print 8. Save Each PDF to a location 9. ??? 10. Profit Never done it with Adobe Writer. I'm a cheapskate. Regards, Adam -- http://mail.python.org/

New to Tkinter GUI building

2007-02-28 Thread Adam
Hey, I'm pretty new to programming. Been trying to learn using Python. The code I'm struggling with is for my GUI. I'm am having trouble getting this to display the way I want with the grid manager. Can anybody tell me what I am doing wrong? I hope you can tell what look I'm trying to achieve fro

Re: Extract String From Enclosing Tuple

2007-02-28 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I'm a bit embarrassed to have to ask for help on this, but I'm not finding > the solution in the docs I have here. > > Data are assembled for writing to a database table. A representative tuple > looks like this: > > ('eco', "(u'Roads',)", 0.073969887301348305)

Extract String From Enclosing Tuple

2007-02-28 Thread rshepard
I'm a bit embarrassed to have to ask for help on this, but I'm not finding the solution in the docs I have here. Data are assembled for writing to a database table. A representative tuple looks like this: ('eco', "(u'Roads',)", 0.073969887301348305) Pysqlite doesn't like the format of the mi

Re: Question about raise and exceptions.

2007-02-28 Thread Bruno Desthuilliers
Daniel Klein a écrit : > On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" > <[EMAIL PROTECTED]> wrote: > > >>When I run it I get this: >> >>884 > ./t_fsm.py >>Traceback (most recent call last): >> File "./t_fsm.py", line 3, in ? >>from fsm import * >> File "/home/boston/VIASAT/sorr

How to check for remaining hard drive space in Windows?

2007-02-28 Thread kevinliu23
HI, I am new to Python and wanted to know how to check for the remaining disk space on my Windows machine using Python? I was thinking of using the command line "dir" and trying to extract the output from there. But I'm not sure how to extract command line strings using Python either. Anyway help

Re: class declaration shortcut

2007-02-28 Thread Bruno Desthuilliers
Luis M. González a écrit : > I've come across a code snippet in www.rubyclr.com where they show how > easy it is to declare a class compared to equivalent code in c#. > I wonder if there is any way to emulate this in Python. > > The code is as follows: > > Person = struct.new( :name, :birthday, :

Re: finding out the precision of floats

2007-02-28 Thread Arnaud Delobelle
On Feb 28, 7:28 pm, Marcin Ciura <[EMAIL PROTECTED]> wrote: > I guess that speed is not at premium in your application, > so you might try my continued fractions module, > advertised here a few weeks > ago:http://www-zo.iinf.polsl.gliwice.pl/~mciura/software/cf.py Thanks for the link, I've had a

Re: Yet another unique() function...

2007-02-28 Thread Paul Rubin
[EMAIL PROTECTED] writes: > It's more terse, but my version is built to be faster in the more > common cases of all hashable or/and all sortable items (while working > in other cases too). > Try your unique on an unicode string, that's probably a bug (keepstr > is being ignored). > Version by Paul

Re: f2py and Fortran90 gfortran_filename error

2007-02-28 Thread Robert Kern
Robert Kern wrote: > Beliavsky wrote: >> I wish the Google Groups interface to the list >> http://groups.google.com/group/Numpy-discussion >> worked. When I use it to post my messages bounce, but messages from >> the list do show up on Google Groups. The "bounces" say >> >> "This mailing list is

Re: Importing WMI in a child Thread throws an error

2007-02-28 Thread Tim Golden
[EMAIL PROTECTED] wrote: > On Feb 27, 3:32 pm, Tim Golden <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> The problem I have is that since I import WMI, it takes a long time >>> and we have users complaining about it. So I stuck the import >>> statement into a separate thread and set it

Re: Importing WMI in a child Thread throws an error

2007-02-28 Thread kyosohma
On Feb 27, 3:32 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > The problem I have is that since I import WMI, it takes a long time > > and we have users complaining about it. So I stuck the import > > statement into a separate thread and set it to a daemon so it could do >

convert many excel files to pdf in batch

2007-02-28 Thread Wensui Liu
Dear all, right now, I have 20 something excel reports that need to be converted to pdf and I have pdf write installed on my PC. Is there a way that I can do so in python? -- http://mail.python.org/mailman/listinfo/python-list

Re: gmpy moving to code.google.com

2007-02-28 Thread aleaxit
On Feb 27, 1:38 pm, "Ziga Seilnacht" <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > On Feb 27, 2007, at 2:59 AM, Daniel Nogradi wrote: > > > > Hi Alex, > > > > I did another test, this time with python 2.4 on suse and things are > > > worse than in the previous case (which was python 2.5 on

Re: *** CANADIAN ANTI-TERROR LAW HAS BEEN STRUCK DOWN BY ITS HONORABLE SUPREME COURT UNANIMOUSLY ***

2007-02-28 Thread Aviroce
On Feb 24, 11:22 am, [EMAIL PROTECTED] wrote: > Canada anti-terror law is struck down>From the Associated Press > > February 24, 2007 > > OTTAWA - Canada's Supreme Court on Friday unanimously declared it > unconstitutional to detain foreign terrorism suspects indefinitely > while the courts review

Re: gmpy moving to code.google.com

2007-02-28 Thread aleaxit
On Feb 27, 9:10 am, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > > > Hi Alex, > > > > I did another test, this time with python 2.4 on suse and things are > > > worse than in the previous case (which was python 2.5 on fedora 3), > > > ouput of 'python gmp_test.py' follows: > > > Interesting! gmpy

Re: *** CANADIAN ANTI-TERROR LAW HAS BEEN STRUCK DOWN BY ITS HONORABLE SUPREME COURT UNANIMOUSLY ***

2007-02-28 Thread stj911
Top Ten Reasons Why Activists Shouldn't Be "Too Radical" 1. We must be careful not to offend the Average American (AvAm) 2. Self-righteousness is such a turn-off 3. We can't give ammunition to the right wing 4. The AvAm is doing the best he/she can and we shouldn't expect more 5. We can't blame th

Re: finding out the precision of floats

2007-02-28 Thread Marcin Ciura
Arnaud Delobelle wrote: > I'm not doing 'real world' calcultations, I'm making an app to help > teach children maths. I need numerical values that behave well as > decimals. I also need them to have an arbitrary number of significant > figures. Floats are great but they won't help me with either.

class declaration shortcut

2007-02-28 Thread Luis M. González
I've come across a code snippet in www.rubyclr.com where they show how easy it is to declare a class compared to equivalent code in c#. I wonder if there is any way to emulate this in Python. The code is as follows: Person = struct.new( :name, :birthday, :children) I tried something like this, b

Re: Question about raise and exceptions.

2007-02-28 Thread Daniel Klein
On Wed, 28 Feb 2007 13:48:54 -0500 (EST), "Steven W. Orr" <[EMAIL PROTECTED]> wrote: >When I run it I get this: > >884 > ./t_fsm.py >Traceback (most recent call last): > File "./t_fsm.py", line 3, in ? > from fsm import * > File "/home/boston/VIASAT/sorr/py/fsm/fsm.py", line 76 > raise

  1   2   >