Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Rob Williscroft
Peter Steele wrote in news:96947c45-f16b-4e97-b055-edc1241ee...@googlegroups.com 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: Sending a broadcast message using raw sockets

2013-01-22 Thread Rob Williscroft
Peter Steele wrote in news:0c2b3482-df46-4324-8bf9-2c45d3f6b...@googlegroups.com in comp.lang.python: > On Monday, January 21, 2013 1:10:06 AM UTC-8, Rob Williscroft wrote: >> Peter Steele wrote in >> >> news:f37ccb35-8439-42cd-a063-962249b44...@googlegroups.com in &g

Re: Sending a broadcast message using raw sockets

2013-01-21 Thread Rob Williscroft
Peter Steele wrote in news:f37ccb35-8439-42cd-a063-962249b44...@googlegroups.com 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: Conditional decoration

2012-06-18 Thread Rob Williscroft
Roy Smith wrote in news:jro9cj$b44$1...@panix2.panix.com 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: 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: Cannot connect to IMAP server in Python 3.2

2012-04-04 Thread Rob Williscroft
Steven D'Aprano wrote in news:4f7d2475$0$3$c3e8...@news.astraweb.com 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: 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: Returning a value from exec or a better solution

2011-08-30 Thread Rob Williscroft
Ethan Furman wrote in news:4e5d29c8.8010...@stoneleaf.us 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
Jack Trades wrote in news:CAG5udOiOAge3uHrGSDTZ412GAg+CC- 6u8igoyj0lnf3hnwu...@mail.gmail.com 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
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: 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-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: 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- feb3b56be...@g5g2000prn.googlegroups.com 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: None versus MISSING sentinel -- request for design feedback

2011-07-15 Thread Rob Williscroft
Steven D'Aprano wrote in news:4e1fd009$0$29986$c3e8da3 $54964...@news.astraweb.com 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: Addition problems

2011-04-01 Thread Rob Williscroft
vm wrote in news:in4m1u$hsc$1...@news2.carnet.hr 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: subprocess pipe question

2011-02-23 Thread Rob Williscroft
Rita wrote in news:AANLkTi=88dcpm_kqrs2g620obsnxz0majubfwpeme...@mail.gmail.com in gmane.comp.python.general: [Top post relocated] > On Tue, Feb 22, 2011 at 7:57 PM, Rob Williscroft > wrote: > >> Rita wrote in >> news:AANLkTi=w95gxosc1tkt2bntgjqys1cbmdnojhokq4

Re: subprocess pipe question

2011-02-22 Thread Rob Williscroft
Rita wrote in news:AANLkTi=w95gxosc1tkt2bntgjqys1cbmdnojhokq4...@mail.gmail.com in gmane.comp.python.general: > > When using wait() it works a bit better but not consistent > def run(cmd): > p=subprocess.Popen(cmd,stdout=subprocess.PIPE) > rc=p.wait() > print rc > return p.stdout > > W

Re: list 2 dict?

2011-01-02 Thread Rob Williscroft
Octavian Rasnita wrote in news:0db6c288b2274dbba5463e7771349...@teddy in gmane.comp.python.general: > Hi, > > If I want to create a dictionary from a list, is there a better way > than the long line below? > > l = [1, 2, 3, 4, 5, 6, 7, 'a', 8, 'b'] > > d = dict(zip([l[x] for x in range(len(l)

Re: How to test if a module exists?

2010-11-06 Thread Rob Williscroft
Jon Dufresne wrote in news:aanlktikr5euhqpupa3yrid98oas92zfhk8u9lha5y...@mail.gmail.com in gmane.comp.python.general: > try: > import extension_magic_module > except ImportError: > pass > else: > handle_extension_magic_module() > > > However, if the the extension module exists but

Re: dumping generator

2010-08-09 Thread Rob Williscroft
targetsmart wrote in news:cd83533b-f51e-4955-96c5-f8a10185bef1 @i18g2000pro.googlegroups.com in gmane.comp.python.general: > Right now if I want to dump the contents of a generator object I use , > a snip from a bigger block of code.. > > try: > while gen: print gen.next() > except StopIteratio

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Rob Williscroft
southof40 wrote in news:da3cc892-b6dd-4b37-a6e6- b606ef967...@t26g2000prt.googlegroups.com in gmane.comp.python.general: > I have list of of N Vehicle objects - the only possible vehicles are > cars, bikes, trucks. > > I want to select an object from the list with a probability of : cars > 0.7, b

Re: UnicodeDecodeError having fetch web page

2010-05-26 Thread Rob Williscroft
Kushal Kumaran wrote in news:1274889564.2339.16.ca...@nitrogen in gmane.comp.python.general: > On Tue, 2010-05-25 at 20:12 +0000, Rob Williscroft wrote: >> Barry wrote in news:83dc485a-5a20-403b-99ee-c8c627bdbab3 >> @m21g2000vbr.googlegroups.com in gmane.comp.python.gener

Re: UnicodeDecodeError having fetch web page

2010-05-25 Thread Rob Williscroft
Barry wrote in news:83dc485a-5a20-403b-99ee-c8c627bdbab3 @m21g2000vbr.googlegroups.com in gmane.comp.python.general: > Hi, > > The code below is giving me the error: > > Traceback (most recent call last): > File "C:\Users\Administratör\Desktop\test.py", line 4, in > UnicodeDecodeError: 'utf8

Re: py2exe help

2010-05-11 Thread Rob Williscroft
jim-on-linux wrote in news:mailman.74.1273614703.32709.python-l...@python.org in comp.lang.python: > python help, > > I'm open for suggestions. > > I'm using py2exe to compile a working program. > > The program runs and prints fine until I compile it with py2exe. > > After compiling the prog

Re: Sublassing tuple works, subclassing list does not

2010-03-31 Thread Rob Williscroft
Frank Millman wrote in news:mailman.1360.1270018159.23598.python- l...@python.org in comp.lang.python: > I came up with a simple solution that seems to work - > class MyTuple(tuple): > ... def __new__(cls, names, values): > ... for name, value in zip(names, values): > ... setattr

Re: affectation in if statement

2010-03-16 Thread Rob Williscroft
samb wrote in news:5c361012-1f7b-487f-915b-0f564b238be3 @e1g2000yqh.googlegroups.com in comp.lang.python: > Thanks for all those suggestions. > They are good! > > 1) Let's suppose now that instead of just affecting "thing = > m.group(1)", I need to do a piece of logic depending on which match I >

Re: Method / Functions - What are the differences?

2010-02-28 Thread Rob Williscroft
Michael Rudolf wrote in news:hmdo3m$28...@news.urz.uni-heidelberg.de in comp.lang.python: > Note that all I did was moving the list and foo into the instance. Still > no self and no cls, but also no static behaviour any more. Yes in the first case foo was an attribute of the class, and in the s

Re: python crash on windows but not on linux

2010-02-12 Thread Rob Williscroft
hjebbers wrote in news:2864756a-292b-4138-abfd- 3348b72b7...@u9g2000yqb.googlegroups.com in comp.lang.python: > the information about the error is a windows dump. This may help: # http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx SEM_FAILCRITICALERRORS = 1 SEM_NOALIGNMENTFAULTEXCEPT

Re: Problem Regarding Queue

2010-02-09 Thread Rob Williscroft
mukesh tiwari wrote in news:80fed7d5-76eb-40c8-ace1-0c35736de399 @t17g2000prg.googlegroups.com in comp.lang.python: > Could some one please tell what is wrong with this code. I am trying > to use Queue in this program but i am getting error The type you appear to be trying to use is Queue.Queue w

Re: pointless musings on performance

2009-11-24 Thread Rob Williscroft
mk wrote in news:mailman.923.1259070092.2873.python-l...@python.org in comp.lang.python: > MRAB wrote: >> In what way is it counterintuitive? In 'pythonic' the conditions are >> simpler, less work is being done, therefore it's faster. > > But the pythonic condition is more general: nonevar or ze

Re: pointless musings on performance

2009-11-24 Thread Rob Williscroft
mk wrote in news:mailman.915.1259064240.2873.python-l...@python.org in comp.lang.python: > > def pythonic(): > def unpythonic(): > Decidedly counterintuitive: are there special optimizations for "if > nonevar:" type of statements in cpython implementation? > from dis import dis dis( un

Re: Help with database planning

2009-11-14 Thread Rob Williscroft
Juliano wrote in news:0e64893a-af82-4004-bf3c-f397f2022...@g22g2000prf.googlegroups.com in comp.lang.python: [snip] > So, for ONE *concept*, we have, usually, MANY *slots*, each *slot* has > ONE *facet*, and each *facet* can have MORE THAN ONE *filler*. > Besides, some *slots* and *fillers* are

Re: creating class objects inside methods

2009-10-04 Thread Rob Williscroft
Benjamin Kaplan wrote in news:mailman.838.1254682604.2807.python- l...@python.org in comp.lang.python: >> And how do you just check a script's syntax without running it >> anyways? >> ) > > Because these aren't compile-time errors. Python has no compilation > phase- Sure it does, compilation ha

Re: socket send O(N**2) complexity

2009-09-21 Thread Rob Williscroft
wrote in news:mailman.216.1253565002.2807.python-l...@python.org in comp.lang.python: >>Niether of the CPython versions (2.5 and 3.0 (with modified code)) >>exibited any memory increase between "allocated 1 meg + " and "end" > > You bumped into a special case that CPython optimizes. s[:] is s.

Re: socket send O(N**2) complexity

2009-09-21 Thread Rob Williscroft
Zac Burns wrote in news:mailman.211.1253559803.2807.python-l...@python.org in comp.lang.python: > The mysocket.mysend method given at > http://docs.python.org/howto/sockets.html has an (unwitting?) O(N**2) > complexity for long msg due to the string slicing. > > I've been looking for a way to op

Re: what is the biggest number that i can send to Wave_write.writeframes(data)

2009-06-02 Thread Rob Williscroft
'2+ wrote in news:mailman.1017.1243932401.8015.python-l...@python.org in comp.lang.python: > would like to take advantage of the wave module > found a good example here: > http://www.python-forum.org/pythonforum/viewtopic.php?f=2&t=10644 > > hmm .. i don't get how to write a stereo .. i mean i c

Re: Questions about regex

2009-05-30 Thread Rob Williscroft
wrote in news:fe9f707f-aaf3-4ca6-859a-5b0c63904fc0 @s28g2000vbp.googlegroups.com in comp.lang.python: > text = re.sub('(\<(/?[^\>]+)\>)', "", text)#remove the HTML > Python has a /r/ (raw) string literal type for regex's: text = re.sub( r'(\<(/?[^\>]+)\>)', "", text ) In raw strings p

Re: sqlite single transaction without foreign key or triggers

2009-05-13 Thread Rob Williscroft
John Machin wrote in news:b722bd36-c8f1-4cdf-8625-2550cee21511 @i28g2000prd.googlegroups.com in comp.lang.python: > On May 13, 11:46 am, a...@pythoncraft.com (Aahz) wrote: >> In article , >> Rob Williscroft   wrote: >> >> >> >> >Aahz wrote innews:guao50

Re: sqlite single transaction without foreign key or triggers

2009-05-12 Thread Rob Williscroft
Aahz wrote in news:guao50$1j...@panix3.panix.com in comp.lang.python: > In article , > Rob Williscroft wrote: >> >>db.execute( ''' >> update "sessions" set "uid" = ? >> where "uid" = ?

Re: sqlite single transaction without foreign key or triggers

2009-05-11 Thread Rob Williscroft
gert wrote in news:d7591495-4661-4243-ad7e-f142d8244e88 @e24g2000vbe.googlegroups.com in comp.lang.python: > I am trying to do this in a single transaction, the 3 separate > statements work fine, but i am screwed if they are not executed > together. Well you're in luck, Python DBAPI 2 connections

Re: pyAA for Python2.5

2009-01-29 Thread Rob Williscroft
Kottiyath wrote in news:d86a0c1d-e158-4aa1-a47f-e2149948bdc3 @p2g2000prf.googlegroups.com in comp.lang.python: > On Jan 29, 1:51 am, Rob Williscroft wrote: >> Kottiyath wrote in news:6a594643-f6a2-4d8d-aab3-27eb16cb2fb8 >> @b38g2000prf.googlegroups.com in comp.lang.python:

Re: pyAA for Python2.5

2009-01-28 Thread Rob Williscroft
Kottiyath wrote in news:6a594643-f6a2-4d8d-aab3-27eb16cb2fb8 @b38g2000prf.googlegroups.com in comp.lang.python: > > I have mingw32-gcc in my path. If I try that too -it fails. > > C:\Documents and Settings\Guest\pyAA>python setup.py install -c > "mingw32-gcc" > invalid command name 'mingw32-gcc'

Re: Start Python at client side from web app

2009-01-22 Thread Rob Williscroft
Diez B. Roggisch wrote in news:6ts0dnfc9s0...@mid.uni-berlin.de in comp.lang.python: > Rob Williscroft schrieb: >> Diez B. Roggisch wrote in news:6tpo16fbacf...@mid.uni-berlin.de in >> comp.lang.python: >> >>>> 2) create a localhost web server, for the client

Re: Start Python at client side from web app

2009-01-22 Thread Rob Williscroft
Thomas Guettler wrote in news:6tr453fca5h...@mid.individual.net in comp.lang.python: > Diez B. Roggisch schrieb: >> >>> 2) create a localhost web server, for the client side manipulation. >>> Then have your remote webserver render a form that posts via >>> javavscript to the localhost webserver.

Re: Start Python at client side from web app

2009-01-21 Thread Rob Williscroft
Diez B. Roggisch wrote in news:6tpo16fbacf...@mid.uni-berlin.de in comp.lang.python: > >> 2) create a localhost web server, for the client side manipulation. >> Then have your remote webserver render a form that posts via >> javavscript to the localhost webserver. The localhost server would >>

Re: Start Python at client side from web app

2009-01-21 Thread Rob Williscroft
Thomas Guettler wrote in news:6toehtfbrb8...@mid.individual.net in comp.lang.python: > Sorry, I described my problem not well. Here is more information: > > The main application is the intranet web application used with IE (ms > windows client). But some action needs to be done on the client sin

Re: list subsetting

2009-01-21 Thread Rob Williscroft
culpritNr1 wrote in news:mailman.7713.1232574803.3487.python-l...@python.org in comp.lang.python: > > Hello All, > > Say I have a list like this: > > a = [0 , 1, 3.14, 20, 8, 8, 3.14] > > Is there a simple python way to count the number of 3.14's in the list > in one statement? > > In R I do

Re: Python 3: exec arg 1

2009-01-20 Thread Rob Williscroft
Alan G Isaac wrote in news:myhdl.805$aw2@nwrddc02.gnilink.net in comp.lang.python: > On 1/18/2009 9:36 AM Alan G Isaac apparently wrote: >> I do not much care about the disappearance of ``execfile``. >> I was asking, why is it a **good thing** that >> ``exec`` does not accept a TextIOWrapper?

Re: function argument dependent on another function argument?

2009-01-18 Thread Rob Williscroft
Aaron Brady wrote in news:582ef883-0176-4984-9521-6c1894636...@a26g2000prf.googlegroups.com in comp.lang.python: > On Jan 18, 10:44 am, Rob Williscroft wrote: >> Aaron Brady wrote >> innews:6a10378f-addb-4d56-bc1b-0c382b3cb...@t26g2000prh > .googlegroups.com >> in comp.

Re: Python 3: exec arg 1

2009-01-18 Thread Rob Williscroft
Steven D'Aprano wrote in news:018342f9$0$8693$c3e8...@news.astraweb.com in comp.lang.python: > I'm not sure if this is a stupid question or not, but what's a > TextIOWrapper? In the example you give: > > exec(open(fname)) > > the argument to exec -- open(fname) -- is a file object: > typ

Re: function argument dependent on another function argument?

2009-01-18 Thread Rob Williscroft
Aaron Brady wrote in news:6a10378f-addb-4d56-bc1b-0c382b3cb...@t26g2000prh.googlegroups.com in comp.lang.python: > On Jan 18, 9:36 am, Paul Rubin wrote: >> Steven D'Aprano writes: >> > def foo(self, x, y=None): >> >     if y is None: >> >         y = self.a >> >> >

Re: Mocking `from foo import *` functions

2009-01-10 Thread Rob Williscroft
wrote in news:a9ed10ff-d907-46f0-8c6a- c3d95579a...@k1g2000prb.googlegroups.com in comp.lang.python: > To answer to Rob: yeah, sure that would work, but I always thought Just to note: you're answering a question about testing, but I answered how to alter the alerter module *for* testing. given

Re: Mocking `from foo import *` functions

2009-01-09 Thread Rob Williscroft
Silfheed wrote in news:c73b304b-f601-4bb5-89c1-3ee667eeb7d9 @l37g2000vba.googlegroups.com in comp.lang.python: > So I'm in the current testing situation: > > sender.py: > - > def sendEmails(): >return "I send emails" > > alerter.py: > - > from sender import * > def Do

Re: Generator metadata/attributes

2009-01-08 Thread Rob Williscroft
wrote in news:053df793-9e8e-4855-aba1-f92482cd8922 @v31g2000vbb.googlegroups.com in comp.lang.python: > class TaggedWrapper(): > > def __init__(self, generator, logMixin, stream): > self.__generator = generator > self.__tag = '%...@%s' % (logMixin.describe(), stream) >

Re: Generator metadata/attributes

2009-01-07 Thread Rob Williscroft
wrote in news:d301c93a-8a73-4cbb-9601-fe0c18a94f97 @v5g2000prm.googlegroups.com in comp.lang.python: > I realise I could create my own wrapper that implements __next__ (I am > using Python 3 and haven't checked the exact interface required, but I > guess it's something like that), and add the inf

Re: Python 3.0 nonlocal statement

2009-01-06 Thread Rob Williscroft
Matimus wrote in news:2a3d6700-85f0-4861-84c9-9f269791f044 @f40g2000pri.googlegroups.com in comp.lang.python: > On Jan 6, 5:31 am, Casey wrote: >> In PEP 3104 the nonlocal statement was proposed and accepted for >> implementation in Python 3.0 for access to names in outer scopes.  The >> proposed

Re: About PyOpenGL

2009-01-05 Thread Rob Williscroft
trueli...@gmail.com wrote in news:f8099226-a953-4598-bfe2-61ee5772ce26 @l33g2000pri.googlegroups.com in comp.lang.python: > > Traceback (most recent call last): > File "test.py", line 36, in > main() > File "test.py", line 26, in main > glutInit(sys.argv) > File "c:\python25\lib\si

Re: Triple quoted string in exec function ?

2008-12-30 Thread Rob Williscroft
Steven D'Aprano wrote in news:016abfa1$0$6988$c3e8...@news.astraweb.com in comp.lang.python: > On Tue, 30 Dec 2008 15:35:28 -0600, Rob Williscroft wrote: > >> Stef Mientki wrote in news:mailman.6399.1230668197.3487.python- >> l...@python.org in comp.lang.python: >>

Re: Triple quoted string in exec function ?

2008-12-30 Thread Rob Williscroft
Stef Mientki wrote in news:mailman.6399.1230668197.3487.python- l...@python.org in comp.lang.python: >>> And, by the way, exec is a *statement*, not a function! >>> > exec ( Init_Code, PG.P_Globals ) > > I've really doubt that this is a statement, > unless I don't understand what a sta

Re: How can I return a non-zero status result from a python script?

2008-12-15 Thread Rob Williscroft
silverburgh.me...@gmail.com wrote in news:74b53da4-bf07-431b-898b- 49977f7a6...@r36g2000prf.googlegroups.com in comp.lang.python: > Hi > > How can I return a non-zero status result from the script? Just do a > return 1? at the end? > >>> import sys >>> help( sys.exit ) Help on built-in function

Re: 'new' module deprecation in python2.6

2008-11-29 Thread Rob Williscroft
David Pratt wrote in news:mailman.4664.1227980181.3487.python- [EMAIL PROTECTED] in comp.lang.python: > import new > > class FirstBase(object): > foo = 'bar' > biz = 'baz' > > class SecondBase(object): > bla = 'blu' > buz = 'brr' > > attr = { > 'fiz': 'An attribute', 'f

Re: asp oddness , why specify ASP twice

2008-11-26 Thread Rob Williscroft
davidj411 wrote in news:a08906ab-ba98-4ce0-a5f9-330f4b287423 @z27g2000prd.googlegroups.com in comp.lang.python: > > for some reason this code works: > * > <%@ LANGUAGE = Python%> The above is a Directive, in this case it tells ASP what language to use,

Re: Strange output from list

2008-11-11 Thread Rob Williscroft
Steve Holden wrote in news:mailman.3804.1226412496.3487.python- [EMAIL PROTECTED] in comp.lang.python: >> Shouldn't it be GROUP BY master.id? I would have thought that SQL >> would be sad about a non-aggregate (master.id) that's in the SELECT >> list but not also in the GROUP BY list. >> > Well,

Re: Exact match with regular expression

2008-11-01 Thread Rob Williscroft
Lawrence D'Oliveiro wrote in news:[EMAIL PROTECTED] in comp.lang.python: > In message <[EMAIL PROTECTED]>, Rob > Williscroft wrote: > >> Read (and bookmark) this: >> >> http://www.python.org/doc/2.5.2/lib/re-syntax.html > > Funny how you never

Re: Exact match with regular expression

2008-10-26 Thread Rob Williscroft
Mr.SpOOn wrote in news:mailman.3069.1225039892.3487.python- [EMAIL PROTECTED] in comp.lang.python: > Hi, > I'd like to use regular expressions to parse a string and accept only > valid strings. What I mean is the possibility to check if the whole > string matches the regex. > > So if I have: > >

Re: Perl/Python regular expressions vs. Boost.regex?

2008-10-23 Thread Rob Williscroft
wrote in news:[EMAIL PROTECTED] in comp.lang.python: > A colleague wrote a C++ library here at work which uses the > Boost.regex library. I quickly discovered an apparent problem with > how it searches. Unlike re.match the regex_match function in that > library effectively anchors the match at

Re: ANN: pyparsing 1.5.1 released

2008-10-19 Thread Rob Williscroft
Paul McGuire wrote in news:[EMAIL PROTECTED] in comp.lang.python: > On Oct 18, 1:05 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: >> Paul McGuire wrote: >> > I've just uploaded to SourceForge and PyPI the latest update to >> > (Python 3.0 uses syntax for catching exceptions that is >> > incompatible

Re: properties access by name

2008-10-17 Thread Rob Williscroft
=?KOI8-R?B?7cnU0Q==?= wrote in news:f1a77a69-2997-4f53-9a46- [EMAIL PROTECTED] in comp.lang.python: > > class Film(object): > def __init__(self, title): > self.__title = title > > @getproperty > def title(self): > return self.__title > @setproperty > def title

Re: Reading from stdin (in windows)

2008-10-14 Thread Rob Williscroft
[EMAIL PROTECTED] wrote in news:mailman.2448.1223974725.3487.python- [EMAIL PROTECTED] in comp.lang.python: > Hi! > > I wanna write a file processor in python (Windows XP). > I wanna use pipe, and not parameters. > > When I write this: > > ... > l = [] > while 1: > t = sys.stdin.read(1) >

Re: csv files for download

2008-10-04 Thread Rob Williscroft
Bobby Roberts wrote in news:cdc29298-d005-4804-b407-81ecaf6bb1b4@ 2g2000hsn.googlegroups.com in comp.lang.python: > I need to be able to offer a client "click to download" functionality > on their website. Generating the data to provide to them is not an > issue but I want them to be able to clic

Re: processing email with Python on Windows?

2008-10-03 Thread Rob Williscroft
Beliavsky wrote in news:d579f554-be4b-4066-acec-49a7bafb1046 @t41g2000hsc.googlegroups.com in comp.lang.python: > I work for a financial company where we run Windows XP and read email > using Microsoft Outlook 2003. I get daily files that come as email > attachments from various counterparties. I

Re: How do I set a callback in Python?

2008-09-08 Thread Rob Williscroft
catsclaw wrote in news:d797403a-e492-403f-933a-bd18ef53d5c0 @k13g2000hse.googlegroups.com in comp.lang.python: > I can't for the life of me figure out how to set a callback in > Python. I have a class, which wraps another class. The second class > needs a callback assigned. I don't want to use

Re: Profiling weirdness: Timer.timeit(), fibonacci and memoization

2008-08-03 Thread Rob Williscroft
Steven D'Aprano wrote in news:[EMAIL PROTECTED] in comp.lang.python: >> So the question is: whats going on with timeit.Timer ? > > As far as I can see, nothing. I think you have misunderstood the results > you got. No, the answer is that is it repeats a million times. It might better be calle

Re: Profiling weirdness: Timer.timeit(), fibonacci and memoization

2008-08-02 Thread Rob Williscroft
Stefaan Himpe wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Nothing weird about this ... > The difference will become larger as your input value becomes larger. > > You can easily understand why if you try to calculate fib(10) by hand, > i.e. work through the algorithm with pencil and p

Re: Iterating through 2 files simultaneously

2008-07-27 Thread Rob Williscroft
wrote in news:7ae96aff-c1a7-4763-8db7- [EMAIL PROTECTED] in comp.lang.python: > Hi folks, > > I am trying to tee off both stdout and stderr from a process run > through Popen. > As a test, I am first trying to print the output below: > > from subprocess import Popen,PIPE > ... > p1 = Popen(['cv

Re: urllib and login with passwords

2008-07-26 Thread Rob Williscroft
Jive Dadson wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hey folks! > > There are various web pages that I would like to read using urllib, but > they require login with passwords. Can anyone tell me how to find out > how to do that, both in general and specifically for YouTube.com.

Re: Questions on 64 bit versions of Python

2008-07-26 Thread Rob Williscroft
Martin v. Löwis wrote in news:[EMAIL PROTECTED] in comp.lang.python: >> I just tested, I built a default C# forms app using the "AnyCPU" >> option and it ran as a 64 bit app (no *32 in Task Manager), this is >> on XP64. >> >> I have though installed the AMD64 version of the 2.0 framework and

Re: Questions on 64 bit versions of Python

2008-07-26 Thread Rob Williscroft
Martin v. Löwis wrote in news:[EMAIL PROTECTED] in comp.lang.python: >> The end result of that is on a 32-bit machine IronPython runs in a >> 32-bit process and on a 64-bit machine it runs in a 64-bit process. > > > That's probably not exactly true (although I haven't checked). > > When you st

Re: is there a bug in urlunparse/urlunsplit

2008-05-18 Thread Rob Williscroft
Alex wrote in news:09764c57-03ce-4ccb-a26d- [EMAIL PROTECTED] in comp.lang.python: > Hi all. > > Is there a bug in the urlunparse/urlunsplit functions? > Look at this fragment (I know is quite silly): > > urlunparse(urlparse('www.example.org','http')) > ---> 'http:///www.example.org' >

Re: https and POST method

2008-04-11 Thread Rob Williscroft
Lorenzo Stella wrote in news:7956f925-1037-49ea-a360-b58d627ffb20 @z24g2000prf.googlegroups.com in comp.lang.python: > Hi all, > I'm trying to write a simple script for sending sms via vyke... I have > to make a https > connection and pass some data with the POST method, like this perl > script do

Re: encoding/decoding issue with python2.5 and pymssql

2008-03-24 Thread Rob Williscroft
Tzury Bar Yochay wrote in news:3a6c32fe-e7c1-4230-882d-efb3415196c1 @b1g2000hsg.googlegroups.com in comp.lang.python: > for example: > the value > 'EE604EE3-4AB0-4EE7-AF4D-018124393CD7' > is represent as > '\xe3N`\xee\xb0J\xe7N\xafM\x01\x81$9<\xd7' > from uuid import * u = UUID( bytes = '\xe3N`

Re: Cost of "unicode(s)" where s is Unicode

2008-01-06 Thread Rob Williscroft
John Nagle wrote in news:[EMAIL PROTECTED] in comp.lang.python: >Does > > text = unicode(text) > > make a copy of a Unicode string, or is that essentially a > free operation if the input is already Unicode? > > John Nagle > http://docs.python.org/lib/built-in-fun

Re: Who's to blame?

2008-01-03 Thread Rob Williscroft
Nicola Musatti wrote in news:92dfc2fc-0677-43c0-b34f-4f240fa40205 @e4g2000hsg.googlegroups.com in comp.lang.python: Note there is a wxpython mailinglist/newsgroup: news:gmane.comp.python.wxpython [snip] > problem lies in the fact that apparently ShowModal() does not return > when either

Re: Extracting files from an ISO image?

2008-01-02 Thread Rob Williscroft
Ant wrote in news:34a84caa-5387-40a2-a808- [EMAIL PROTECTED] in comp.lang.python: [snip] > > So I have two questions really: > > 1) Is there a module out there for extracting files from an ISO? There are command line programs that can do this: http://cdrecord.berlios.de/old/private/cdrecord

Re: mysqldb SELECT COUNT reurns 1

2007-12-27 Thread Rob Williscroft
SMALLp wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hy! I nave another problem I can't solve! > > > import MySQLdb as mysql > cursor = conn.cursor() > sql = "SELECT COUNT(*) FROM " + dataTable > res = cursor.execute(sql) I think you need to do: res = cursor.fetchone()[0] > pri

Re: Connecting to SQL database

2007-12-20 Thread Rob Williscroft
bill ramsay wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Hi > > I have successfully connected to SQL2000 and MSDEE databases in the > > Conn = Dispatch('ADODB.Connection') > Conn.ConnectionString = "Provider=SQLNCLI;Server=10.1.1.2; > Database=csrctest;Uid=bill;Pwd=bill" By

Re: I want py2exe not to create library.zip

2007-09-12 Thread Rob Williscroft
On Wed, 12 Sep 2007 22:09:30 +0200, Laszlo Nagy wrote: > Hi, > > I want py2exe not to create library.zip. My reason is that the installed > program will be a self updating program, and it must be able to download > changes (newer python source files) from the server. So the files should > not be

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: 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: 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

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: 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: 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: 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: 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: Why does not my wx.html.HtmlWindow work?

2007-04-08 Thread Rob Williscroft
[EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED] in comp.lang.python: > Below are my source code: > > import wx > import wx.html > > class MyHtmlFrame(wx.Frame): > > def __init__(self, parent, title): > wx.Frame.__init__(self, parent, -1, title, size=(600,400)) > html = wx

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: 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: 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: 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

  1   2   >