Re: [Tutor] monitor number of files in a folder

2009-08-10 Thread Jeff Younker
On Aug 7, 2009, at 9:29 AM, pedro wrote: On my machine (a Mac), os.listdir does include files that begin with "." Having the while loop timeout after 10 or 20 times through as was suggested a couple posts back will work fine for my particular situation. Thanks Yes, it does include files

Re: [Tutor] More type() puzzlement

2007-10-27 Thread Jeff Younker
On Oct 27, 2007, at 12:52 PM, Dick Moores wrote: > At 08:39 AM 10/27/2007, Aditya Lal wrote: >> Hence if type(n) is already long it does not have to get converted >> to int to accommodate something small. > > And that's not a bug? There is no need for a type change to represent zero, so, no, that

Re: [Tutor] Turning multiple Popen calls into a function

2007-11-01 Thread Jeff Younker
On Nov 1, 2007, at 3:04 PM, Alan Gauld wrote: > Where does the if/else syntax come from? It doesn't > seem to work on my Python 2.4. Is it a new feature in 2.5? Yes, it's a new feature in 2.5. - Jeff Younker - [EMAIL PROTECTED] __

Re: [Tutor] Automating operations... os module, mysql operations, more...

2007-11-01 Thread Jeff Younker
(It will do a lot more, but it's really easy to get started to with turbogears.) - Jeff Younker - [EMAIL PROTECTED] ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] assignment question

2007-11-11 Thread Jeff Younker
Append modifies the array as a side effect. It has no meaningful return value. >>> x = [1, 2, 3] >>> x.append(4) >>> print x [1, 2, 3, 4] - Jeff Younker - [EMAIL PROTECTED] - 510.798.5804 - On Nov 11, 2007, at 8:21 PM, Ryan Hughes wrote: Hello, Why does the fo

Re: [Tutor] adding a new folder to Python's importable modules search path

2007-11-25 Thread Jeff Younker
it__.py file in them? - Jeff Younker - [EMAIL PROTECTED] - On Nov 25, 2007, at 9:00 PM, [EMAIL PROTECTED] wrote: ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Questions about wxEvents

2007-12-06 Thread Jeff Younker
tarts with FI', changeCallback= lambda x: self.fpCallback('fp2', x) ) [snip] def fpCallback(self, controlID, evt): print evt.__dict__ print help(evt) value = evt.GetString() [snip] - Jeff Younker - [EMAIL PROTECTED] -

Re: [Tutor] logic for a tree like structure

2007-12-08 Thread Jeff Younker
line = cmd.before print '[main]', line except pexpect.TIMEOUT: print "No output received for ten seconds" except pexpect.EOF: pass finally: cmd.close() if __name__ == '__main__': main() - Jeff Younker - [EMAIL PR

Re: [Tutor] Python Editor For Mac Os X

2007-12-14 Thread Jeff Younker
On Dec 13, 2007, at 8:32 PM, chinni wrote: > Hi which editor for python on Mac os x platform is best with color > syntax compiler etc... I'm pretty happy with Eclipse + Pydev. - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor maillis

Re: [Tutor] Program review

2008-01-05 Thread Jeff Younker
The procesar function is complicated. It tries to do several things that that are better done elsewhere. It needs to be broken up into several functions and methods. This also clarifies and isolates the exception handling. > def procesar(mensaje): >try : The enclosing try block isn't need

Re: [Tutor] Program review

2008-01-06 Thread Jeff Younker
> > Maybe it is my poor understanding of exception handling. My intention > here is to open the first file, if error then report in logging and > finish normally, else open the 2nd file, if error then report in > logging > close the 1st file and finish normally. If no error then process. > Right

Re: [Tutor] Interview questions in python and wxpython

2008-01-19 Thread Jeff Younker
> Your meta-mission is to propose ideas, state assumptions and ask > questions. Is the track infinite in the sense that it resides on an infinite plane, or is it infinite in the sense that it is circular, wrapping around the entire planet and meeting with itself? -jeff _

Re: [Tutor] conditionals with slicing not seeming to work

2008-01-27 Thread Jeff Younker
- Jeff Younker - [EMAIL PROTECTED] - On Jan 27, 2008, at 3:01 PM, Rob Stevenson wrote: I'm working at a certain website's puzzles using pythonin order to learn the language, but am stuck understanding what is going on in my code (ie why it doesn't do as expected) the in

Re: [Tutor] results not quite 100 percent yet

2008-02-21 Thread Jeff Younker
Here is a strict translation of your code. The algorithm remains the same, but it has been cleaned up a bit. Duplications have been removed, and the various logical bits have been broken down into separate functions. I suspect you don't know about random.randint(low, high). It generates

Re: [Tutor] SSH with Python

2008-02-27 Thread Jeff Younker
> What's the path to ssh under windows vista? Paramiko is a pure > python implementation of the SSH protocol, so it should run on any > platform. Paramiko rocks. I have a deployment system that works on linux, osx, and windows without a hitch. If you're writing a custom SSH server or doing

Re: [Tutor] Python oddity

2008-02-27 Thread Jeff Younker
1, 2] # new list >>> b = list(a) # make a copy of the list in b >>> a == b # the original and copy are equal True >>> a is b # but they are not the same list False - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python oddity

2008-02-28 Thread Jeff Younker
4) The typical knee-jerk reaction to this 'oddity' is "what a pain, how stupid" etc, but I'm sure there is a good explanation. Can someone explain why python acts this way? faster processing? preserve memory? etc? This comes down (largely) to a philosophical choice. Does the language

Re: [Tutor] identifying the calling module/function

2008-03-07 Thread Jeff Younker
get this finished). As I advance more in Python, a design > change might happen :) Telling us your goal might allow us to recommend a better and faster way of accomplishing it. - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Const on Python

2008-03-07 Thread Jeff Younker
uage and to use those, but developing fluency is much harder, and it takes a much longer time. - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread Jeff Younker
OMMAND') cmd.expect('# ') # the prompt cmd.sendline('A COMMAND') cmd.expect('# ') # wait for the prompt again output = cmd.before # the stuff before the prompt cmd.sendline('exit') cmd.close() - Jeff Younker - [EMAIL PROTECTED] -

Re: [Tutor] Which Python Script Editor of Choice?

2008-04-04 Thread Jeff Younker
r or so.) I has a feature set that no other python IDE has at this point. (Let me qualify that: I haven't looked at the Iron Python tools on windows, and they might be better, but I don't do much in the windows world so I haven't looked at it yet.) - Jeff Younker - [EMAI

Re: [Tutor] Hoping to benefit from someone's experience...

2008-04-21 Thread Jeff Younker
On Apr 15, 2008, at 11:33 PM, Alan Gauld wrote: > Have you considered driving Word instead of OOo? > That way you leave the documents in their original format > and make the mods using COM from Python. I've used this approach before, and I whole heartedly suggest that you look into it. The Win3

Re: [Tutor] HTML Parsing

2008-04-21 Thread Jeff Younker
On Apr 21, 2008, at 6:40 AM, Stephen Nelson-Smith wrote: > On 4/21/08, Andreas Kostyrka <[EMAIL PROTECTED]> wrote: > I want to stick with standard library. > > How do you capture elements? from xml.etree import ElementTree document = """ foo and bar foo

Re: [Tutor] 6x6 word square solver too slow

2008-04-25 Thread Jeff Younker
However I suspect any attempt to improve performance here needs a new algorithm and probably a clever data structure to minimise brute force tests. If I knew of one, I would have used it :) I'd suggest googling for 'trie'. Tries are method of indexing sets of strings by prefix. As I recall

Re: [Tutor] seeking help to a problem w/ sockets

2008-04-27 Thread Jeff Younker
completes. Try looking at the SocketServer module. It takes care of a lot of the details for you. - Jeff Younker - [EMAIL PROTECTED] - On Apr 26, 2008, at 5:56 PM, James Duffy wrote: I have a problem w/ a file transfer receiver. They way it works is it binds a port for incoming transfer , whe

Re: [Tutor] Memory Leak?

2008-05-07 Thread Jeff Younker
I followed the advice on this page: http://mail.python.org/pipermail/python-list/2006-December/417208.html and the problem is now gone. There are two pieces of advice on that page. Which did you follow? - Jeff Younker - [EMAIL PROTECTED

Re: [Tutor] String Replacement Question

2008-05-21 Thread Jeff Younker
On May 21, 2008, at 6:42 AM, Kinuthia Muchane wrote: st = "String" print "%s " %st*3 String String String Does this help? Another approach is to use dictionaries for string replacement. >>> subst = {'some': 'thing'} >>> print "%(some)s%(some)s%(some)s" % subst thingthingthing -jeff ___

Re: [Tutor] Controlling applications

2008-06-09 Thread Jeff Younker
On Jun 9, 2008, at 8:51 AM, W W wrote: Originally I was planning to use urllib to post/retrieve the data, but as far as I can tell, the bank uses several variables and some javascript to authenticate everything, and it seems overly complicated to try and manually figure it all out. Raw urllib i

Re: [Tutor] IDE

2008-06-11 Thread Jeff Younker
editing via SQLExplorer plugin - HTML/XML/Javascript development plugins - Run external tools from within the IDE - To do lists - Multi-language development - etc. - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] when is object relational mapping for Python warranted?

2008-06-11 Thread Jeff Younker
more growing room, and that this is well worth the initial investment. The documentation for SQLAlchemy tends to be better too. (That said I work primarily with SQLObject, and the addition of a revision system will keep me from switching our product to SQLAlchemy for a while longer.) - Jeff Yo

Re: [Tutor] Web Stats

2008-06-11 Thread Jeff Younker
ges. If you have pages which are no longer referenced from any root pages then a spider won't find them. These dangling pages are precisely the sort of thing you're trying to remove. Consider other options such as looking through the filesy

Re: [Tutor] Object attributes surviving deletion

2008-06-26 Thread Jeff Younker
On Jun 26, 2008, at 2:59 PM, Shrutarshi Basu wrote: self.modules.append(DisplayModule(self.img_map, (self.xOrigin, self.yOrigin), self.rows, self.columns, gram, self.type)) ... As you can see, not only do I delete gram, I also blank out everything that should be cleared. I have to ma

Re: [Tutor] Inheritance help

2008-07-08 Thread Jeff Younker
Hmm. I don't understand the LSP to make any requirements on the constructors. It says that instances of a subclass should be substitutable for instances of the base class, it doesn't say anthing how the instances are created. Constructors as a separate language entity is an idea born of C++, Jav

Re: [Tutor] parsing sendmail logs

2008-07-15 Thread Jeff Younker
On Jul 14, 2008, at 12:29 AM, nibudh wrote: Hi List, I'm looking for some support libraries that will help me to parse sendmail logs. I'm confused about whether i need a "parser" per se, and if i do which parser to use. I found this website http://nedbatchelder.com/text/python-parsers.htm

Re: [Tutor] parsing sendmail logs

2008-07-18 Thread Jeff Younker
If you run a pipeline chain from within subprocess every part of the chain will be a separate process, thats a lot of overhead. Thats why admins tend to prefer writing utilities in Perl rather than bash these days. ... Nobody I know uses perl for systems administration because it doesn't have

Re: [Tutor] Is anybody out there who could help me with URL Authentication?

2008-08-01 Thread Jeff Younker
or more details check out the project's page at: http://wwwsearch.sourceforge.net/mechanize/ - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Is this a "Class" problem?

2008-08-18 Thread Jeff Younker
On Aug 18, 2008, at 9:13 AM, Adrian Greyling wrote: def MainToSecond(self, event): # wxGlade: MyMainFrame. MySecondFrame(self).Show() MySecondFrame.text_ctrl_2.SetValue("This text was generated from the 'MainFrame' window") The expression MySecondFrame(self) creates a n

Re: [Tutor] Is this a "Class" problem?

2008-08-20 Thread Jeff Younker
I'm assuming you do that so that you don't confuse what a Python built-in method (or function) is, compared to methods (or functions) that you've authored. It's done more to distinguish classes from methods and attributes. I can't claim any credit though. It's part of the python coding con

Re: [Tutor] importing strings

2008-09-11 Thread Jeff Younker
ormat = "this is a %s" subst = 'test' print format % subst FYI: You shouldn't reply to a message when you have a new question. That attaches it to the previous topic. - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor mail

Re: [Tutor] Threading

2008-09-11 Thread Jeff Younker
ten the whole program. Instead of passing around arrays or urls and results you can pass around the queues directly. In addition you can run the report function as another thread. It prints the jobs from the result pool as they're completed. These will make the code more elegant, but the

Re: [Tutor] PySQLite vs SQLalchemy

2008-09-12 Thread Jeff Younker
On Sep 12, 2008, at 3:30 PM, Patrick wrote: I like SQLite, it's really easy to work with. I would like to model my database in it natively but I am having quite a bit of trouble mapping the variables in the SQLIte database via PySQLite. It appears that this sort of thing is SQLalchemy's strong

Re: [Tutor] Win32 extensions

2008-09-14 Thread Jeff Younker
rtual machine on whatever flavor of unix you're using. - Jeff Younker - [EMAIL PROTECTED] - -- Spencer Parker ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___

Re: [Tutor] sample python twill scripts?

2008-10-02 Thread Jeff Younker
ed quite a bit for performing functional testing from Python. - Jeff Younker - [EMAIL PROTECTED] - ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor