Re: Programming exercises/challenges

2008-12-08 Thread Edwin
On Nov 22, 2:15 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > I'm only a very occasional user of vi, so I don't really know how vim > integrates with MacOS X but have you tried aquamacs > (http://aquamacs.org/)? > > -- > Arnaud I've tried it but I ended up using original (I'm sure there's a be

Re: Programming exercises/challenges

2008-11-21 Thread Edwin
On Nov 20, 10:32 pm, [EMAIL PROTECTED] wrote: >     >> I am constantly amazed at work that people open a separate emacs for >     >> each file they want to edit.  Most of them seem not to even know that >     >> find-file exists. > >     Edwin> Come on mate...

Re: Programming exercises/challenges

2008-11-20 Thread Edwin
On Nov 20, 6:28 am, [EMAIL PROTECTED] wrote: >     >> a diary manager compatible with my Emacs diary file (sometimes I >     >> don't want to open Emacs for a quick note) > >     Arnaud> You mean that you sometimes don't have emacs open? > > I am constantly amazed at work that people open a separat

Re: Programming exercises/challenges

2008-11-20 Thread Edwin
On Nov 20, 12:39 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Edwin <[EMAIL PROTECTED]> writes: > > [...] > > > a diary manager compatible with my Emacs diary file (sometimes I don't > > want to open Emacs for a quick note) > > Yo

Re: Programming exercises/challenges

2008-11-19 Thread Edwin
On Nov 18, 6:39 pm, [EMAIL PROTECTED] wrote: > Hi guys, > > I'm learning Python by teaching myself, and after going through several > tutorials I feel like I've learned the basics. Since I'm not taking a > class or anything, I've been doing challenges/programs to reinforce the > material and improv

Re: Snippets management

2008-11-11 Thread Edwin
On Nov 10, 3:14 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > expora wrote: > > On Nov 6, 12:38 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > > >> Edwin wrote: > > >>> Hi there, > > >>> I've been looking for a snippet manager an

Re: Snippets management

2008-11-07 Thread Edwin
On Nov 7, 5:38 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > I've to extract the right libs from the larger program, > as I'm in an import crisis right now, > it may take a couple of days. > If it's not here by the end of next week, > mail be directly, because I forget a lot :-) > > cheers, > Stef

Re: Snippets management

2008-11-07 Thread Edwin
On Nov 7, 6:36 pm, Ricardo Aráoz <[EMAIL PROTECTED]> wrote: > > Since you are in Linux you should definitely check "Basket". Go to it's > website and you'll be hooked, just what you need. Actually I use Mac OS and Free BSD but I'll check it out mate. Thanks for the tip!! -- http://mail.python.org/

Re: Snippets management

2008-11-06 Thread Edwin B.
Robert Lehmann <[EMAIL PROTECTED]> writes: > I don't think there is a one-size-fits-all solution. I definetly agree. > Setting up a 'snippets' repository sounds good if you just want to be > able to look back at what you've done and/or have a place to stash away > quick tests. I have set up a

Re: Snippets management

2008-11-06 Thread Edwin
Robert Lehmann <[EMAIL PROTECTED]> writes: > On Wed, 05 Nov 2008 19:55:51 -0600, Edwin wrote: > >> Hi there, >> >> I've been looking for a snippet manager and found PySnippet but it >> requires PyGTK. Do you know any other option that doesn't n

Re: Snippets management

2008-11-05 Thread Edwin B.
r <[EMAIL PROTECTED]> writes: > On Nov 5, 7:55 pm, [EMAIL PROTECTED] (Edwin) wrote: >> Hi there, >> >> I've been looking for a snippet manager and found PySnippet but it >> requires PyGTK. Do you know any other option that doesn't need much? >>

Snippets management

2008-11-05 Thread Edwin
Hi there, I've been looking for a snippet manager and found PySnippet but it requires PyGTK. Do you know any other option that doesn't need much? I'm sort of new to python and user interfaces seem a bit far for me right now, that's why I thought having to install PyGTK was unnecessary. Would yo

Re: cx_oracle and commands

2008-09-05 Thread Edwin . Madari
>sts = pipe.close() >IOError: [Errno 10] No child processes > > > >Basically, once I have made a connection to Oracle I can no >longer use getstatusoutput(). This is a real problem as >I need to get a list of things to work on from Oracle then >spawn commands to

Re: urllib fails to connect

2008-08-20 Thread Edwin . Madari
7;+httpproxy}) opener=urllib2.build_opener(proxy, urllib2.HTTPHandler) urllib2.install_opener(opener) req = urllib2.Request(url, form, headers) fd = urllib2.urlopen(req) print fd.code, fd.info(), fd.read() regards Edwin The information contained in this message and any attachment may be proprietary,

Re: who to call a list of method inside the class itself

2008-08-19 Thread Edwin . Madari
gt; > def applyAll(self): > > for method_name in self.getAllMethod(): > > method = gettattr(self,method_name) > > method() #execute method now > > why? ensure instance's method invocation with all state information to that point

Re: who to call a list of method inside the class itself

2008-08-19 Thread Edwin . Madari
for method_name in self.getAllMethod(): method = gettattr(self,method_name) method() #execute method now regards. Edwin The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject

Re: Newbie problem inserting into MySQL

2008-08-18 Thread Edwin . Madari
> -Original Message- > From: Madari, Edwin > Sent: Monday, August 18, 2008 3:03 PM > To: 'len'; python-list@python.org > Subject: Re: Newbie problem inserting into MySQL > > > -Original Message- > > From: > [EM

Re: Newbie problem inserting into MySQL

2008-08-18 Thread Edwin . Madari
l write" > print datetime.datetime.now().time() > os._exit() > > print "insert into mysql completed" > > i get the following error on insert; > raise errorclass, errorvalue > TypeError: not all arguments conver

Re: How to delete a line with re?

2008-08-18 Thread Edwin . Madari
running this snippet, is blanking out ^abdc$.. what is the issue ? abcd efg hijk lmn $ efg hijk lmn regards Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peng Yu Sent: Sunday, August 17, 2008 11:47 PM To: python-list@python.org Subject: How to

Re: Vmware api

2008-08-18 Thread Edwin . Madari
do the ESX server provide any api's or an interactive session may ? thx. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Wertman Sent: Sunday, August 17, 2008 2:43 PM To: python-list@python.org Subject: Re: Vmware api I would al

Re: Python does not get environment variable when using cron.

2008-08-18 Thread Edwin . Madari
source in or execute .profile (or .bash_profile which ever is applicable to you) as a first thing in the cron to get environment variables. hope that helps. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Wertman Sent: Sunday, August 17, 2008

any success in compiling mod_python3.3 on cygwin for apache2.2

2008-08-16 Thread Edwin . Madari
has any one out there succeeded in compiling/installing mod_python for apache2 and python 2.5. I am using python 2.5 on cygwin. thanks in advance Edwin The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work

RE: updating dictionaries from/to dictionaries

2008-08-14 Thread Edwin . Madari
by the way, iterating over bar will throw KeyError if that key does not exist in foo. to see that in action, simply set another key in bar after copy.deepcopy stmt in this example.. bar['xtra'] = 0 and re-run fun learning with python... Edwin -Original Message- From: Mad

RE: updating dictionaries from/to dictionaries

2008-08-14 Thread Edwin . Madari
o[key] += bar[key] except: print 'bar', sys.exc_info()[:2] foo (, TypeError("unsupported operand type(s) for +=: 'NoneType' and 'NoneType'",)) bar (, TypeError("unsupported operand type(s) for +=: 'NoneType' and &#

RE: SOAPpy and ArrayOfString

2008-08-14 Thread Edwin . Madari
ckwsdl(file) Even though a method may be asking for an array, server may be accepting only up to a certain number of elements in the array. And check the data type for elements in the array. of course I had to tweak a couple of SOAPpy mod

RE: urldecode function?

2008-08-14 Thread Edwin . Madari
prints out following and preserves the order of inputs for those keys given more than once as with 'start' key {'start': ['1827', '1234'], 'anotherCat': ['me=ow~'], 'by': ['down'], 'Cat': ['

RE: threading

2008-08-14 Thread Edwin . Madari
is fine and go back to napping. if something is fishy - go catch it. hope that helps. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rhamphoryncus Sent: Thursday, August 14, 2008 2:52 PM To: python-list@python.org Subject: Re: threading On Aug

RE: Fixed-length text file to database script

2008-08-14 Thread Edwin . Madari
prints out: ('1234567890123456', '7890', '12345678', '90123456', '78901234') hope it helps. thanks Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Wertman Sent: Thursday, August 14, 2008 1:59 PM To: python-lis

RE: a question about mysqldb

2008-08-14 Thread Edwin . Madari
l, (1,)) # sql is now 'select tID, tNote from tmp where tID=:1' # note the comma in argument tuple to execute (1,) thanks Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Wertman Sent: Thursday, August 14, 2008 2:13 PM To: python-li

RE: a question about mysqldb

2008-08-14 Thread Edwin . Madari
replace the name of table before calling *.execute. s.dbptr.execute(str % (e[0])) good luck. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Evan Sent: Thursday, August 14, 2008 11:27 AM To: python-list@python.org Subject: a question about mysqldb

RE: Fixed-length text file to database script

2008-08-14 Thread Edwin . Madari
, passwd='shmoe', db='tst') cursor = con.cursor() sql = 'select * from YOUR_TABLE' cursor.execute(sql) results = cursor.fetch() con.close() = hope that helps. good luck Edwin -Original Message- From: [EMAIL PROT

RE: Formatting input text file

2008-08-14 Thread Edwin . Madari
ta.append(row) for i in data: print ' '.join(i) ===== good luck. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, August 14, 2008 7:07 AM To: python-list@python.org Subject: F

RE: Random Problems

2008-08-13 Thread Edwin . Madari
use songs.extend( asongs ) #append is for single item - where ever it might be. >>> l1 = range(5) >>> l2 = range(5,10) >>> l1 [0, 1, 2, 3, 4] >>> l2 [5, 6, 7, 8, 9] >>> l1.extend(l2) >>> l1 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>&

Re: Checking a file's time stamp.

2008-08-12 Thread Edwin . Madari
os.paht.gmtime(path) returns the last modification of path. check out http://docs.python.org/lib/module-os.path.html regards Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of William Purcell Sent: Tuesday, August 12, 2008 1:47 PM To: Python List Subject

Re: for x,y in word1, word2 ?

2008-08-11 Thread Edwin . Madari
sounds like *soundex* is what you are looking for. google soundex regards Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc 'BlackJack' Rintsch Sent: Monday, August 11, 2008 3:09 AM To: python-list@python.org Subject: Re: for x,

Re: SSH utility

2008-08-11 Thread Edwin . Madari
7;\$ ']) 2 >>> c.before, c.after ('ls\r\x.txt xx.txt xy.txt [EMAIL PROTECTED]:~\r\n', '$ ') >>> c.sendline('exit') 5 >>> c.expect([pexpect.TIMEOUT, pexpect.EOF, '\$ ']) 1 >>> c.before, c.after ('exit\r\nexit\r\

RE: regular expression extracting groups

2008-08-10 Thread Edwin . Madari
t;>> for k, v in data.items(): .. print 'key=%s val=%s' % (k, v) .. .. key=foo val=['bar'] key=option val=['value', '7'] key=another val=['42'] with another dictionary of keys to be processed with a function to process values fo

RE: How to round a floating point to nearest 10?

2008-08-09 Thread Edwin . Madari
Round a number to a given precision in decimal digits (default 0 digits). This always returns a floating point number. Precision may be negative. good luck.. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Machin Sent: Saturday,

RE: "shelve" save object

2008-08-09 Thread Edwin . Madari
e and retrieval from many os-es good luck. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of hypermonkey2 Sent: Saturday, August 09, 2008 3:33 PM To: python-list@python.org Subject: "shelve" save object Hi there! I am using the "

RE: Extract string from log file

2008-08-09 Thread Edwin . Madari
tec Corporation)+69;}fw{Norton 360 (Symantec Corporation)+5;}v{Microsoft Windows XP+insecure;Microsoft Windows XP Professional+f;26027;26447;26003;22452;} r=0.9496 good luck Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Saturd

RE: sending to an xterm

2008-08-08 Thread Edwin . Madari
the action that matched 3. if prompt matched, the 'before' has the results 4. even the command 'ls' with '\r\n' will be in the results. actual session------ [EMAIL PROTECTED]:/c/Edwin/Projects/expect $ python Python 2.5.1 (r251:54863, May

RE: very newbie question

2008-08-07 Thread Edwin . Madari
delete the extra 'tries += 1' after else: print "Higher..." tries += 1 #delete this while at it, and add this line as the first line in function ask_number() global the_number, tries good luck. Edwin -Original Message- From: [EMAI

RE: Testing for the first few letters of a string

2008-08-07 Thread Edwin . Madari
use re module import re template = '^My name is alex' astring = 'My name is alex, and I like pie' if re.match(template, astring): print 'Found it' else: print '%s does not begin with %s' % (astring, template) good luck. Edwin -Original Mess

RE: A question about string and float number

2008-08-06 Thread Edwin . Madari
#this is a better way of testing a string for float def isFloat(s): try: s = float(s) except: return False return True -Original Message- From: Madari, Edwin Sent: Wednesday, August 06, 2008 10:22 PM To: 'Wei Guo'; python-list@python.org Subj

RE: A question about string and float number

2008-08-06 Thread Edwin . Madari
type(s) == type(float()) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Wei Guo Sent: Wednesday, August 06, 2008 9:23 PM To: python-list@python.org Subject: A question about string and float number Hi all, I am new of python. Could anyone help me a quest

Re: Using an DTD not specified in XML file for validation

2008-08-06 Thread Edwin . Madari
can you edit the xml and add the dtd/scheama ? .Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ben Finney Sent: Wednesday, August 06, 2008 7:07 PM To: python-list@python.org Subject: Re: Using an DTD not specified in XML file for validation

python equivalent for this perl soap client

2008-08-06 Thread Edwin . Madari
t there succeeded in making a soap request through firewall using wsdl something like below from SOAPpy import WSDL server = WSDL.Proxy('./local_file_copy_of_wsdl.wsdl') res = server.soapMethod("method", "args", "as", "required") tried every

SOAPpy how to

2008-08-06 Thread Edwin . Madari
with socket.gaierror: (7, 'getaddrinfo failed') a = server.aTestMethod( arg1, arg2, ) print a any suggestions or hints any one.. thanks in advance Edwin The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the

soap call through firewall

2008-08-06 Thread Edwin . Madari
hi, any hints/pointers appreciated if you have succeeded in making a soap call through a firewall. other than this http://www.ibm.com/developerworks/xml/library/x-tipfire.html cannot find much. thanks in advance Edwin The information contained in this message and any attachment may be

Re: UnicodeDecodeError, how to elegantly deal with this?

2008-08-04 Thread Edwin . Madari
if you can print out values of 'filemask', and 'thefile' variables, when it crashes, I can help. thx. Edwin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jorgen Bodde Sent: Monday, August 04, 2008 2:24 PM To: python-lis

Re: xlrd

2008-08-04 Thread Edwin . Madari
here is working code that will read & display contents of all rows & columns in all the sheets, you need xlrd 0.6.1 import xlrd, os, sys book = xlrd.open_workbook(sys.argv[1]) print "The number of worksheets is", book.nsheets for shx in range(book.nsheets): sh = book.sheet_by_index(shx) p

RE: Decimals not equalling themselves (e.g. 0.2 = 0.2000000001)

2008-08-03 Thread Edwin . Madari
... For readability print them with required precision. for example >>> a = .2 >>> b = .4 >>> b = b/2 >>> a == b True >>> a, b (0.20001, 0.20001) >>> '%.2f' % a, '%.2f' % b ('0.20', '0

RE: Continually check object status

2008-08-02 Thread Edwin . Madari
updated creature running in its own thread will get you started. try it for yourself, change sleep times per your need. import os, sys, threading, time class Creature: def __init__(self, status): self.status = status self.state = 'run' def start(self): self.athread = thr

building python from source on HP

2007-05-07 Thread Edwin . Madari
. not sure if output from configure and make would make a difference. If so I can send them. thanks in advance Edwin The information contained in this message and any attachment may be proprietary, confidential, and privileged or subject to the work product doctrine and thus protected from discl

Re: Python-list Digest, Vol 38, Issue 390

2006-11-27 Thread Edwin Gomez
Regarding Topic number 3: 3. Calling a thread asynchronously with a callback (Edwin Gomez): Thanks Bjorn for you quick answer and by the way, that works. Diez, in answer to your question regarding async callbacks in C#; C# runs in a multi threaded apartments. Many times we'll setup lis

Calling a thread asynchronously with a callback

2006-11-27 Thread Edwin Gomez
I'm a C# developer and I'm new to Python. I would like to know if the concept of Asynchronous call-backs exists in Python. Basically what I mean is that I dispatch a thread and when the thread completes it invokes a method from the calling thread. Sort event driven concept with threads. Tha

pexpect problem, spawn says I/O on closed file

2005-04-15 Thread edwin
Hi, I'm using pexpect in a plugin script within bartbot (an python based irc bot). When I execute the plugin, python comes back with: ERROR exceptions.ValueError file: /home/edwin/devel/bartbot/myplugins/rttest.py linenr: 17 msg: I/O \ operation on closed file rttest.py being the plugin s

Re: [Parsing] How do I process loops with PLY?

2004-12-26 Thread Edwin Young
y, you would separate parsing from executing the code. Use PLY to parse the whole thing once and produce a data structure representing the code (usually called an 'abstract syntax tree') then write an interpreter which uses that tree as its input. Regards, -- Edwin -- http://mail.python.org/mailman/listinfo/python-list