Re: Conditional decoration

2012-06-18 Thread Rob Williscroft
Roy Smith wrote in news:[email protected] in gmane.comp.python.general: > Is there any way to conditionally apply a decorator to a function? > For example, in django, I want to be able to control, via a run-time > config flag, if a view gets decorated with @login_required(). > > @

Re: Sending a broadcast message using raw sockets

2013-01-21 Thread Rob Williscroft
Peter Steele wrote in news:[email protected] in comp.lang.python: > I want to write a program in Python that sends a broadcast message > using raw sockets. The system where this program will run has no IP or > default route defined, hence the reason I need to u

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Rob Williscroft
Peter Steele wrote in news:[email protected] in comp.lang.python: > On Monday, January 21, 2013 1:10:06 AM UTC-8, Rob Williscroft wrote: >> Peter Steele wrote in >> >> news:[email protected] in &g

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Rob Williscroft
Peter Steele wrote in news:[email protected] in comp.lang.python: > I just tried running you code, and the "sendto" call fails with > "Network is unreachable". That's what I expected, based on other tests > I've done. That's why I was asking about how to do raw

Re: Cannot connect to IMAP server in Python 3.2

2012-04-04 Thread Rob Williscroft
Steven D'Aprano wrote in news:[email protected] in gmane.comp.python.general: > I can connect to an IMAP server using Python 2.6: > > steve@runes:~$ python2.6 > Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) server = imaplib.IMAP4_SSL('x') > But when I tr

Re: ordering with duck typing in 3.1

2012-04-07 Thread Rob Williscroft
andrew cooke wrote in news:33019705.1873.1333801405463.JavaMail.geo-discussion-forums@ynmm9 in gmane.comp.python.general: > > hi, > > please, what am i doing wrong here? the docs say > http://docs.python.org/release/3.1.3/library/stdtypes.html#comparisons > "in general, __lt__() and __eq__() a

Re: None versus MISSING sentinel -- request for design feedback

2011-07-15 Thread Rob Williscroft
Steven D'Aprano wrote in news:4e1fd009$0$29986$c3e8da3 [email protected] in gmane.comp.python.general: > I'm designing an API for some lightweight calculator-like statistics > functions, such as mean, standard deviation, etc., and I want to support > missing values. Missing values should

Re: os.path.isdir do not work for Foder named '2011-07-03'

2011-07-18 Thread Rob Williscroft
Nulpum wrote in news:0bf400a3-735c-487a-8d74- [email protected] in gmane.comp.python.general: > I want to make sure that folder exists. > '2011-07-03' is really exists. but 'os.path.isdir' say false > Does anyone know why? > os.path.isdir("C:\Users\Á¶Ã¢ÁØ\Desktop\logs"

Re: Returning a value from exec or a better solution

2011-08-29 Thread Rob Williscroft
Jack Trades wrote in news:CAG5udOg=GtFGPmTB=1ojnvnrpdyucxdokn1wjqmomv9gx0+...@mail.gmail.com in gmane.comp.python.general: > ... I wanted to allow the user to manually return the > function from the string, like this: > > a = exec(""" > def double(x): > return x * 2 > double > """) > > Howeve

Re: Button Label change on EVT_BUTTON in wxpython!!!

2011-08-29 Thread Rob Williscroft
Ven wrote in news:aa1212bb-35e5-4bf9-b8ad-7a3c083749c2 @x2g2000yql.googlegroups.com in gmane.comp.python.general: > So, here is what I did/want: > > self.run_button=wx.Button(self.panel,ID_RUN_BUTTON,label='Install') > self.Bind(wx.EVT_BUTTON, self.OnRun,id=ID_RUN_BUTTON) > > def OnRun(self,evt)

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Jack Trades wrote in news:CAG5udOh1+oE4g9Frjp3pucbHUtWcN34KK35a-Xs2YqkZH9X5=w...@mail.gmail.com in gmane.comp.python.general: >> def test(): >> src = ( >> "def double(x):" >> " return x * 2" >> ) >> globals = {} >> exec( src, globals ) >> return globals[ "double" ] >> >> prin

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Jack Trades wrote in news:CAG5udOiOAge3uHrGSDTZ412GAg+CC- [email protected] in gmane.comp.python.general: >> >>> class CapturingDict(dict): >> ... def __setitem__(self, key, val): >> ... self.key, self.val = key, val >> ... dict.__setitem__(self, key, val) >>

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Ethan Furman wrote in news:[email protected] in gmane.comp.python.general: > Jack Trades wrote: >> On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: >>> If an impementation (as you say up thread) can populate globals >>> or locals with whatever they

Re: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Arnaud Delobelle wrote in news:CAJ6cK1YVi3NQgdZOUdhAESf133pUkdazM1PkSP=p6xfayvo...@mail.gmail.com in gmane.comp.python.general: > On 30 August 2011 13:31, Jack Trades wrote: >> >> >> On Tue, Aug 30, 2011 at 2:37 AM, Rob Williscroft wrote: >> >>> >>

Re: Addition problems

2011-04-01 Thread Rob Williscroft
vm wrote in news:[email protected] in gmane.comp.python.general: > def fun1(params_used_below_except_lk_and_lk2): > lk = 0.0 > lk2 = 0.0 > for raw_data, hist, freq in raw_data_hist_list: > lk2 = lk2 + fun2(some_constants_and_params_from_this_scope) > q =

Re: Problem with sha.new

2005-07-09 Thread Rob Williscroft
Florian Lindner wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hello, > I try to compute SHA hashes for different files: > > > for root, dirs, files in os.walk(sys.argv[1]): > for file in files: > path = os.path.join(root, file) > print path > f = open(path)

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Rob Williscroft
Ralf W. Grosse-Kunstleve wrote in news:[EMAIL PROTECTED] in comp.lang.python: > --- Robert Williscroft <[EMAIL PROTECTED]> wrote: > >> My apologies for having to resort to email but for some reason I >> can't post this message to comp.lang.python. I've tried about 4 times >> including starting a

Re: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code

2005-07-11 Thread Rob Williscroft
Ralf W. Grosse-Kunstleve wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Does anyone know if there is a way to hide the _ or self_ from the > user of the class, i.e. given: > > class foo(object): > @attribute_decorator > def __init__(self, x, _y, z): > pass > > c

Re: What does "::" mean?

2005-07-20 Thread Rob Williscroft
Robert Kern wrote in news:mailman.1954.1121875043.10512.python- [EMAIL PROTECTED] in comp.lang.python: > [EMAIL PROTECTED] wrote: >> Hi Robert, >> I didn't succeed in reversing a string with the "full form" you >> proposed: >> live[len(live)-1:-1:-1] # where live="live" >> The result is an emp

Re: namespaces

2005-07-31 Thread Rob Williscroft
deelan wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Paolino wrote: > (...) >> What I'm needing as a global (in globals() or at the module level or >> in the module namespace) is 'translate'.The rest of bindings >> (all,badcars and table) is something which is 'polluting' the module >> n

Re: namespaces

2005-07-31 Thread Rob Williscroft
Paolino wrote in news:mailman.2453.1122812091.10512.python- [EMAIL PROTECTED] in comp.lang.python: > Rob Williscroft wrote: > > > After 3 or 4 iterations I refactored you code to this: > > > > def translate( text ) > > import string > > all=str

Re: namespaces

2005-07-31 Thread Rob Williscroft
Steven D'Aprano wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Quoting Rob Williscroft: > >> > def translate( text ) >> > import string all=string.maketrans('','') >> > badcars=all.translate(all,string.letters+

Re: Managing events

2005-09-03 Thread Rob Williscroft
cantabile wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi, > > I have a class (a gui) with buttons and other controls. A button, for > example, has a callback method, so that writing > > b = Button(label, OnClick) > > will call the global OnClick method. > > Now, if I want the

Re: comment out more than 1 line at once?

2004-11-30 Thread Rob Williscroft
Riko Wichmann wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Dear all, > > is there a way in Python to comment out blocks of code without putting a > # in front of each line? Somethings like C's > > /* > block of code here is commented out > */ > if False: (indented) block of

Re: comment out more than 1 line at once?

2004-11-30 Thread Rob Williscroft
Gustavo Córdova Avila wrote in news:mailman.6944.1101838678.5135.python- [EMAIL PROTECTED] in comp.lang.python: > Actually, it's infinitly [sp?] more defficient > (contrary of efficient?) than triple-quoted strings > or line-by-line comments, because those two never > make it to execution stage, b

Re: installing wxPython on Linux and Windows

2004-12-03 Thread Rob Williscroft
Daniel Bickett wrote in news:mailman.7076.1102081193.5135.python- [EMAIL PROTECTED] in comp.lang.python: >> I have no way to build it on Windows though, as I don't have Visual C++ >> 7.1, for that we must wait for Robin Dunn. > > Would it be too difficult of a task to try getting the build workin

Re: Twisted Non-Admin Installation

2004-12-26 Thread Rob Williscroft
Kartic wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hello, > > I downloaded the Win32 installer for Twisted 1.3.0, Python 2.3. > > The installer, when executed under my login, fails as it requires > administrator rights to install (why they have it as a requirement, I > don't understa

Re: Simple thread-safe counter?

2005-04-02 Thread Rob Williscroft
Tim Peters wrote in news:mailman.1223.1112417955.1799.python- [EMAIL PROTECTED] in comp.lang.python: > [Paul Rubin] >> I'd like to have a function (or other callable object) that returns >> 0, 1, 2, etc. on repeated calls. That is: >> >>print f() # prints 0 >>print f() # prints 1 >>

Re: trouble using \ to escape %

2005-04-15 Thread Rob Williscroft
Lucas Machado wrote in news:1113606334.524947.54630 @l41g2000cwc.googlegroups.com in comp.lang.python: > str1 = "[%s%s]\n\tpath = /mnt/samba/%s%s/\%U" % (list[0], list[1], > list[0], list[1]) > In a format string use '%%' for a single % char': str1 = "[%s%s]\n\tpath = /mnt/samba/%s%s/%%U" % (li

Re: Tix Tree open/close issue

2006-07-13 Thread Rob Williscroft
Sorin Schwimmer wrote in news:mailman.8142.1152816058.27775.python- [EMAIL PROTECTED] in comp.lang.python: > The following code: > > from Tix import * > > r=Tk() > > tr=Tree(r) > tr.subwidget('hlist').add('br1',text='branch 1') > tr.subwidget('hlist').add('br1.b1',text='branch 1-1') > tr.subwid

Re: using names before they're defined

2006-07-19 Thread Rob Williscroft
Iain King wrote in news:1153323649.171612.74510 @s13g2000cwa.googlegroups.com in comp.lang.python: > > [EMAIL PROTECTED] wrote: >> [...] I need to reference (link) each object to the objects >> upstream and downstream of it, i.e. >> >> supply = supply() >> compressor = compressor(downs

Re: Partial classes

2006-07-19 Thread Rob Williscroft
Bruno Desthuilliers wrote in news:[EMAIL PROTECTED] in comp.lang.python: > John Salerno wrote: >> Marc 'BlackJack' Rintsch wrote: >> >>> Can you flesh out your use case a little bit and tell why you can't >>> solve the problem with inheritance or a meta class? >> >> >> From my experience with

Re: building lists of dictionaries

2006-07-23 Thread Rob Williscroft
Jean_Francois Moulin wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi all, > > I tried this piece of code (FWIW, it was taken as is from a help > section of mpfit, a mathematical routine for least square fitting): > > parinfo = [{'value':0., 'fixed':0, 'limited':[0,0], > 'limits':[0.,

Re: How do you implement this Python idiom in C++

2006-07-27 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > #include > using namespace std; > > // A base class that provides counting > template class Counted { > static int count; > }; > > template int Counted::count = 0; > > // Curious class definitions > class CountedClass : public Counted

Re: import question on wx ?

2006-07-27 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > > I think what you say makes perfect sense > > I am using 2.4.2 python (I typed pthon -V on console to get) > > How can I find what my SPE editor is using ? > Wherever you can run python you can find the version by running the following

Re: Python open a named pipe == hanging?

2006-08-03 Thread Rob Williscroft
Rochester wrote in news:[EMAIL PROTECTED] in comp.lang.python: > I just found out that the general open file mechanism doesn't work > for named pipes (fifo). Say I wrote something like this and it > simply hangs python: > > #!/usr/bin/python > > import os > > os.mkfifo('my_fifo

Re: Trouble displaying image with tkinter

2006-08-06 Thread Rob Williscroft
sj wrote in news:[EMAIL PROTECTED] in comp.lang.python: > I am just learning to use Tkinter and am having problems displaying > image files. I am able to display an image using tutorials (such as > http://www.daniweb.com/code/snippet296.html) But when I try my own > code all I get is an empty wid

RE: file system iteration

2006-10-09 Thread Rob Williscroft
Tim Golden wrote in news:mailman.119.1160403292.11739.python- [EMAIL PROTECTED] in comp.lang.python: > [Rick] >| Searching for a file by name. Scanning for viruses. > Etc. >| There are lots >| of legitimate reason to walk all paths from a centra > l >| starting point, no??? > > Well, to get y

Re: Using Gnutar to remove a list of files

2006-10-10 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi folks, I've got a question for yas. I'm trying to write code that > will open up a gzipped tar file using gnutar, and copy the list of > files(including their directories) to a list variable in python. From > there, I want to go through

Re: Convert StringIO to string

2006-10-16 Thread Rob Williscroft
Jonathan Bowlas wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi listers, > > I've written this little script to generate some html but I cannot get > it to convert to a string so I can perform a replace() on the >, > < characters that get returned. > > from StringIO import StringIO >

Re: Strange Behavior

2006-10-16 Thread Rob Williscroft
abcd wrote in news:[EMAIL PROTECTED] in comp.lang.python: > class Foo: > def __init__(self, name, data=[]): http://docs.python.org/ref/function.html#l2h-619 Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: forcing a definition to be called on attribute change

2006-10-24 Thread Rob Williscroft
Bruno Desthuilliers wrote in news:[EMAIL PROTECTED] in comp.lang.python: >> class cSphere() : > > OT : prefixing classes names with 'c' is totally unpythonic. My understanding of "pythonic" is that its about how you use the language not what style you code in. Here's a variation of the usual

Re: Where do nested functions live?

2006-10-30 Thread Rob Williscroft
Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.python- [EMAIL PROTECTED] in comp.lang.python: >def increment_time (interval_ms): > outer weeks, days, hours, minutes, seconds, mseconds # 'outer' > akin to 'global' > (...) > mseconds = new_ms - s * 1000

Re: How can I import a script with an arbitrary name ?

2006-10-30 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi all, > > I have a script responsible for loading and executing scripts on a > daily basis. Something like this: > > import time > t = time.gmtime() > filename = t[0] + '-' + t[1] + '-' + t[2] + '.py' > import filename > > So, I have a

Re: Calling GNU/make from a Python Script

2006-10-30 Thread Rob Williscroft
Efrat Regev wrote in news:[EMAIL PROTECTED] in comp.lang.python: >Hello, > >I need to call GNU/make from within a Python script. This raised some > problems: > 1. The script is not in the directory of the makefile, and changing the > locations of either is not an option. Consequently, t

Re: Where do nested functions live?

2006-10-31 Thread Rob Williscroft
Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- [EMAIL PROTECTED] in comp.lang.python: > Rob Williscroft wrote: >> Frederic Rentsch wrote in news:mailman.1428.1162113628.11739.python- >> [EMAIL PROTECTED] in comp.lang.python: >> >> >> d

Re: Where do nested functions live?

2006-11-01 Thread Rob Williscroft
Frederic Rentsch wrote in news:mailman.1556.1162316571.11739.python- [EMAIL PROTECTED] in comp.lang.python: > Rob Williscroft wrote: >> Frederic Rentsch wrote in news:mailman.1536.1162292996.11739.python- >>> Rob Williscroft wrote: >>>> Frederic Rentsch wrote in news

Re: Style for modules with lots of constants

2006-11-01 Thread Rob Williscroft
Paul McGuire wrote in news:[EMAIL PROTECTED] in comp.lang.python: > > class Constants(object) > pass > > (I guess value immutability could probably be implemented using clever > implementations of __setattr__ and such, but is it really worth the > bother?). > > Then I defined the context

Re: Style for modules with lots of constants

2006-11-01 Thread Rob Williscroft
Paul McGuire wrote in news:[EMAIL PROTECTED] in comp.lang.python: >>> opAssoc = Constants(object) >>> opAssoc.RIGHT = 0 >>> opAssoc.LEFT = 1 >> This is nice, but you can cut down on some of the cruft: >> Constants.LEFT = 1 > One man's cruft is another man's clarity. :-) > The reason I used

Re: Where do nested functions live?

2006-11-01 Thread Rob Williscroft
Frederic Rentsch wrote in news:mailman.1613.1162403556.11739.python- [EMAIL PROTECTED] in comp.lang.python: > Since we have a class that goes out of scope > when the function returns, and we don't need more than one instance, why > bother to make an instance? Why not use the class object itself?

Re: Style for modules with lots of constants

2006-11-01 Thread Rob Williscroft
Tim Chase wrote in news:mailman.1617.1162412498.11739.python- [EMAIL PROTECTED] in comp.lang.python: >>> The reason I used instances instead of just the Constants >>> class was so that I could define a little more descriptive >>> context for the constants, >> >> Sorry I don't know what you mean h

Re: Where do nested functions live?

2006-11-01 Thread Rob Williscroft
Steve Holden wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Since we have a class that goes out of scope >> when the function returns, and we don't need more than one instance, >> why bother to make an instance? Why not use the class object itself? >> >> def whatever( new_ms ): >> >>

Re: Tools for Java/Python scripting

2006-11-03 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > > steve> http://wiki.python.org/moin/Java_Scripting > > Renamed to "JavaScripting". > > Skip So nobody around here has heared of that other language called JavaScript then ? Perhaps "Scripting_Java" might be better. Pythoning-ly y

Re: How to get/read Hard disk label / drive label

2006-11-05 Thread Rob Williscroft
Praveen wrote in news:1162752076.121514.313750 @h48g2000cwc.googlegroups.com in comp.lang.python: > I want to read individual disk label > > for Hard disk (C: drive, D: drive disk label) > and > CD-ROM disk label > > Please provide some pointer to the code or document. > You could use: http:/

Re: UnboundLocalError

2006-11-09 Thread Rob Williscroft
Terry Reedy wrote in news:[EMAIL PROTECTED] in comp.lang.python: >> def main(): >>number = number() > > Within a function, a given name can be either global or local, but not > both. > Here you are expecting the compiler to interpret the first occurance > of 'number' as local and the second

Re: odd problem with watsup and VB6 application with modal dialog

2006-11-11 Thread Rob Williscroft
Grumman wrote in news:[EMAIL PROTECTED] in comp.lang.python: [snip] > Roughly, I have a script that fills in a field, sets a combobox, then > clicks a button via clickButton. At this point, the python interpreter > hangs. The only thing I've been able to identify as different about > this form i

Re: Tkinter: select multiple entries in Listbox widget?

2006-06-01 Thread Rob Williscroft
Bernard Lebel wrote in news:mailman.6413.1149178158.27775.python- [EMAIL PROTECTED] in comp.lang.python: > Hello, > > Is there an option or a way to allow the selection of multiple entries > in the Listbox widget? I could not find any, and would like to allow > the end user to select multiple ent

Re: how to define a static field of a given class

2006-06-02 Thread Rob Williscroft
feel_energetic wrote in news:1149239221.045268.6170 @g10g2000cwb.googlegroups.com in comp.lang.python: > Hi, > > I already knew how to define a static method of a class( using > staticmethod() ),but I find there isn't a built-in func to build a > static field ( something like staticfield() )

Re: Making a second window with Tkinter

2006-06-03 Thread Rob Williscroft
greenflame wrote in news:1149305472.893535.67770 @h76g2000cwa.googlegroups.com in comp.lang.python: > Ok so I played with your script. Here is a script that more closely > mimics what I would like to do except that the way I make the variable > deckstr will be different. The only thing I am confus

Re: Which compiler will Python 2.5 / Windows (Intel) be built with?

2006-06-15 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: >> As nikie pointed out, you can buy a 1-year MSDN Pro Subscription that >> includes the VS2003 system. All that stopped is the free toolkit. > > The MSDN Pro Subscription is not really an option because we have no > use for the 2005 compile

Re: wxpython: how does EVT_IDLE work?

2006-07-10 Thread Rob Williscroft
John Salerno wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Quick question about the code below: I understand why the progress bar > fills up at a steady pace when the mouse is idle over the frame; but > why, when you move the mouse, does the progress bar speed up? Shouldn't > it stop

Re: time.clock() going backwards??

2006-08-28 Thread Rob Williscroft
Claudio Grondi wrote in news:[EMAIL PROTECTED] in gmane.comp.python.general: > Tim Roberts wrote: >> "Tim Peters" <[EMAIL PROTECTED]> wrote: >> >> It is much simpler than that. With a multiprocessor HAL, including >> on a dual-core or hyperthreaded system, QueryPerformanceCounter >> returns th

Re: threading support in python

2006-09-04 Thread Rob Williscroft
Daniel Dittmar wrote in news:[EMAIL PROTECTED] in comp.lang.python: > - removing reference counting and relying on garbage collection alone > will break many Python applications (because they rely on files being > closed at end of scope etc.) > They are already broken on at least 2 python imp

Re: convert loop to list comprehension

2006-09-08 Thread Rob Williscroft
[EMAIL PROTECTED] wrote in news:1157758817.446690.105620 @i42g2000cwa.googlegroups.com in comp.lang.python: > Please help my poor brain :) Every time I try to do a list > comprehension I find I just don't comprehend ... > > Anyway, I have the following bit of code: > > seq = [2, 3, 1, 9] > tmp =

Re: PIL cannot open TIFF image in Windows

2006-09-09 Thread Rob Williscroft
Andres Corrada-Emmanuel wrote in news:[EMAIL PROTECTED] in comp.lang.python: > I have installed PIL 1.1.5 on Windows with Python 2.4. I'm unable to > open .tiff images that I can open and view using Windows Explorer. In > other words, this simple test fails: > > import Image > im = Image.open('s

Re: xinclude and pathnames

2006-09-14 Thread Rob Williscroft
Tim Arnold wrote in news:[EMAIL PROTECTED] in comp.lang.python: > "Tim Arnold" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> I'm using ElementTree to access some xml configuration files, and >> using the module's xinclude capability. I've got lines like this in >> the parent x

Re: Working with email and mailbox module

2006-09-21 Thread Rob Williscroft
Nirnimesh wrote in news:1158840271.942540.85640 @d34g2000cwd.googlegroups.com in comp.lang.python: > I want to extract emails from an mbox-type file which contains a number > of individual emails. > > I tried the python mailbox and email modules individually, but I'm > unable to combine them to g

Re: distutils on Windows with VC++ 8

2006-09-22 Thread Rob Williscroft
Martin v. Löwis wrote in news:[EMAIL PROTECTED] in comp.lang.python: > [EMAIL PROTECTED] schrieb: >> I'm trying to install two different packages which wrap C or C++ code >> and which make use of distutils.build_ext, which barfs because my only >> compiler is too new. Trying this both on Python

Re: distutils on Windows with VC++ 8

2006-09-22 Thread Rob Williscroft
=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?= wrote in news:4514479B.5070808 @v.loewis.de in comp.lang.python: > Rob Williscroft schrieb: >> Download the 1.1 SDK: >> >> http://www.microsoft.com/downloads/details.aspx?familyid=9B3A2CA6- >> 3647-4070-9F41-A333C6B9181D&am

Re: distutils on Windows with VC++ 8

2006-09-23 Thread Rob Williscroft
Rob Williscroft wrote in news:Xns9846DDC7A18E0rtwfreenetREMOVEcouk@ 216.196.109.145 in comp.lang.python: >> That's yet another option. Somebody reported that the compiler in the >> .NET SDK won't support generating optimized code, though. That's a >> problem fo

[email protected]

2006-09-24 Thread Rob Williscroft
Nigel wrote in news:[EMAIL PROTECTED] in comp.lang.python: > from Tkinter import * > import pyTTS > Hi i am trying to get a button so that when i click on it i hear a > voice say "Hi Molly" this is my code so far.Can any one shed any light > on this for please. > Thanks Nige. Your problem appear

Re: Printing a percent sign

2006-09-25 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi all. How do I escape the "%" sign in a print statement so that it > prints? Thanks. > print "%%" Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing a percent sign

2006-09-25 Thread Rob Williscroft
Rob Williscroft wrote in news:Xns9849DC7DB4102rtwfreenetREMOVEcouk@ 216.196.109.145 in comp.lang.python: > wrote in news:[EMAIL PROTECTED] in > comp.lang.python: > >> Hi all. How do I escape the "%" sign in a print statement so that it >> prints? Thanks. >>

Re: iterator question

2006-09-26 Thread Rob Williscroft
Neal Becker wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Any suggestions for transforming the sequence: > > [1, 2, 3, 4...] > Where 1,2,3.. are it the ith item in an arbitrary sequence > > into a succession of tuples: > > [(1, 2), (3, 4)...] > > In other words, given a seq and an in

Re: iterator question

2006-09-26 Thread Rob Williscroft
Rob Williscroft wrote in news:Xns984ACDA635C9rtwfreenetREMOVEcouk@ 216.196.109.145 in comp.lang.python: >>>> seq = range(11) >>>> zip(seq[::2], seq[1::2] + [None]) > [(0, 1), (2, 3), (4, 5), (6, 7), (8, 9), (10, None)] > >>>> seq = range(10) >>&g

Re: generator with subfunction calling yield

2006-09-27 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Any insight? >From the docs: The yield statement is only used when defining a generator function, and is only used in the body of the generator function. Using a yield statement in a function definition is sufficient to cause that defin

Re: Difference between two dates in seconds

2006-09-27 Thread Rob Williscroft
Steven D'Aprano wrote in news:[EMAIL PROTECTED] in comp.lang.python: > On Wed, 27 Sep 2006 20:16:52 +0200, Fredrik Lundh wrote: > >> Claes at work wrote: >> >>> Please tell me there is a simpler way than subtracting two datetimes >>> to get a timedelta and then compute >>> >>> days * number of

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-09-29 Thread Rob Williscroft
Larry Hastings wrote in news:1159495643.213830.289620 @m7g2000cwm.googlegroups.com in comp.lang.python: > _ > THE PATCH > > The core concept: adding two strings together no longer returns a pure > "string" object. Instead, it returns a "string concatenation" object > which holds referenc

Re: Raw strings and escaping

2006-10-03 Thread Rob Williscroft
Matthew Warren wrote in news:mailman.1152.1159872720.10491.python- [EMAIL PROTECTED] in comp.lang.python: > I would expect this to work, > > rawstring=r'some things\new things\some other things\' It in the docs: http://docs.python.org/ref/strings.html#l2h-14> ... Specifically, a raw string ca

Re: Instantiating an object when the type is only known at runtime

2006-10-03 Thread Rob Williscroft
Samuel wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi, > > I am trying to replace the eval() in the following code: > > def myfunc(type, table): > module = __import__(type) > type = 'module' + '.' + type > obj = eval(type) > return obj(row[table.c.name], ro

Re: How to Restart a thread

2006-11-25 Thread Rob Williscroft
many_years_after wrote in news:1164467660.760671.145440 @j44g2000cwa.googlegroups.com in comp.lang.python: > class mythread(threading.Thread): > def __init__(self, threadname): > threading.Thread.__init__(self, name = threadname) > > def run(self): > print 'i am running' >

Re: case insensitive dictionary

2006-11-25 Thread Rob Williscroft
John Henry wrote in news:1164494606.514366.124810 @l39g2000cwd.googlegroups.com in comp.lang.python: > I believe the standard dictionary should be amened to allow the use of > case insensitive keys - as an option. class idict( dict ): class __istr( str ): def __eq__( self, other ):

Re: super() and type()

2006-11-27 Thread Rob Williscroft
Chris Mellon wrote in news:[EMAIL PROTECTED] in comp.lang.python: > I see super documented, and in use, as below (from the Python > documentation) > > class C(B): > def meth(self, arg): > super(C, self).meth(arg) > > I'd like to not write C all the time, so is there any problem wit

Re: Accessing file metadata on windows XP

2006-11-28 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > When rightclicking a, for example, pdf file on windows, one normally > gets a screen with three or four tags. Clicking on one of the summary > tag one can get some info like "title", "Author", "category", "keyword" > etc.. > > My question

Re: Problem understanding how closures work

2006-12-12 Thread Rob Williscroft
Tom Plunket wrote in news:[EMAIL PROTECTED] in comp.lang.python: > ...at least, I think that I'm having a problem understanding the way > closures work. > > I'm trying to define a function for an object which will take certain > objects from the parent scope at the time that function is defined.

Re: Windows SetLocalTime

2006-12-13 Thread Rob Williscroft
Podi wrote in news:[EMAIL PROTECTED] in comp.lang.python: > I am trying to set the system time on my Windows computer, but avoid > using the DOS command (date, time). > > Does anyone know what parameter to pass to function SetLocalTime? http://msdn.microsoft.com/library/default.asp?url=/library

Re: Windows SetLocalTime

2006-12-13 Thread Rob Williscroft
Podi wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Rob Williscroft wrote: >> >> Google will usually find the documentation of anything in the >> Windows API however sometimes it also helps to add "msdn" to >> your search as in: > Yes, thank you

Re: Property error

2006-12-15 Thread Rob Williscroft
king kikapu wrote in news:1166181267.949316.197360@ 16g2000cwy.googlegroups.com in comp.lang.python: > I am sure it is something very obvious Yes, property is *NOT* a decorator, it can only be used as a decorator in the one case that is mentioned in the docs: http://docs.python.org/lib/built-in

Re: first and last index as in matlab

2006-12-17 Thread Rob Williscroft
Evan wrote in news:[EMAIL PROTECTED] in comp.lang.python: > In matlab I can do the following: > >>> ind = [3,5,7,2,4,7,8,24] > ind = 3 5 7 2 4 7 824 >>> ind(1) ans = 3 >>> ind(end) ans =24 >>> ind([1 end]) ans = 324 > > but I can't get

Re: method names in __slots__ ??

2006-12-25 Thread Rob Williscroft
John Machin wrote in news:1167008799.074885.250770@ 73g2000cwn.googlegroups.com in comp.lang.python: > Given a = Adder(), > a.tally = 0 > gets AttributeError: 'Adder' object attribute 'tally' is read-only > a.notinslots = 1 > gets AttributeError: 'Adder' object attribute 'notinslots' is re

Re: method names in __slots__ ??

2006-12-25 Thread Rob Williscroft
John Machin wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Rob Williscroft wrote: >> John Machin wrote in news:1167008799.074885.250770@ >> 73g2000cwn.googlegroups.com in comp.lang.python: >> >> > Given a = Adder(), >> > a.tally = 0 >> &g

Re: where to find wx package

2007-01-05 Thread Rob Williscroft
siggi wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi all, > > a newbie question: > > I have a program gui03A.py using wxPython, importing it such: > "from wxPython.wx import *" > > The program works, but I get the warning message: > > "gui03A.py:4: DeprecationWarning: The wxPython

Re: Get the current date, python 2.2

2007-06-15 Thread Rob Williscroft
On Fri, 15 Jun 2007 14:30:36 -0700, nano wrote: > Using python 2.2 what is the simplest way to get the current date value? > I have looked in so many places. The question is often asked and the > usual response indicates how to get the current date and time like > > now = time.localtime() > > I

Re: Get the current date, python 2.2

2007-06-15 Thread Rob Williscroft
On Fri, 15 Jun 2007 14:46:20 -0700, nano wrote: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > says... >> On Fri, 15 Jun 2007 14:30:36 -0700, nano wrote: >> >> > Using python 2.2 what is the simplest way to get the current date >> > value? I have looked in so many places. The question is o

Re: How do I use the config parser?

2007-05-05 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi, > I need a specific example. I have seen the docs, but I don't all the > stuffs there. > > from ConfigParser import ConfigParser > Now I want to know how to read a section, a section attribute's value, > and to write thoses back aft

Re: Error when using Custom Exception defined in a different python module.

2007-05-06 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi, > > I am hitting this error consistently and don't know why it's > happening. I would like to define all exceptions for my project in one > file and use them across the project. Here's a sample - > > exceptions.py - > from exception

Re: tkinter get widget option value

2007-05-08 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > If I have a button widget > > w = Button(root, text = "Button", state = 'disabled') > > How can I get the value of option 'state' from the widget 'w'. > I want something like -- > > print w.state >> to print out >> 'disabled' > print w

Re: Interesting list Validity (True/False)

2007-05-11 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > >>> [] == [] > True > >>> ['-o'] == [] > False > >>> ['-o'] == False > False > >>> To test wether something is true use if. To test wether something is false use if not. The python values "True" and "False" are

Re: Is wsgi ready for prime time?

2007-05-17 Thread Rob Williscroft
Ron Garret wrote in news:rNOSPAMon-B77D6B.12263417052007 @news.gha.chartermi.net in comp.lang.python: >> PACKAGE CONTENTS >> handlers >> headers >> simple_server >> util >> validate >> >> Reading the documentation can be useful sometimes. Recommending >> http://docs.pyth

Re: Connection acception with confirmation

2007-05-29 Thread Rob Williscroft
no`name` wrote in news:[EMAIL PROTECTED] in comp.lang.python: > maybe someone have some ideas how to block first stdin in main > function and get stdin from the thread when here is a new connection? > No, but you could instead use a Queue: http://docs.python.org/lib/module-Queue.html

  1   2   >