Re: BadValueError: Property title is required

2011-06-03 Thread Casey Dwyer
On May 31, 1:21 am, "michal.bulla" wrote: > Hello, > > I'm trying to create simple method to create category. I set the model > category: > > class Category(db.Model): >   title = db.StringProperty(required=True) >   clashes_count = db.IntegerProperty(default=0) > > And the class New Category as w

pexpect: TIMEOUT no longer clears child.before

2011-05-19 Thread Adrian Casey
The behaviour of pexpect has changed between version 2.1 and 2.3. In version 2.1, the following code would result in child.before being cleared -: >>>child.expect(pexpect.TIMEOUT,1) In version 2.3, this is no longer the case. No matter how many times the above code is run, child.before con

Re: QCoreApplication will not quit

2011-04-02 Thread Adrian Casey
Dennis Lee Bieber wrote: > On Sat, 02 Apr 2011 14:12:38 +0930, Adrian Casey > declaimed the following in gmane.comp.python.general: > >> Can someone please explain why this simple PyQt4 application never exits? >> >> #!/usr/bin/env python >> from PyQt4 import

QCoreApplication will not quit

2011-04-01 Thread Adrian Casey
Can someone please explain why this simple PyQt4 application never exits? #!/usr/bin/env python from PyQt4 import QtCore import sys class foo(QtCore.QObject): def __init__(self, parent): QtCore.QObject.__init__(self, parent) self.parent = parent

logging and PyQt4

2011-03-14 Thread Adrian Casey
eciated. Thank you. Adrian Casey. -- http://mail.python.org/mailman/listinfo/python-list

pyqt4: multi-threaded database access

2010-11-24 Thread Adrian Casey
I have a PyQt4 multi-threaded application which accesses many hosts concurrently via ssh. I would like each thread to have access to a database so that it can look up details about the particular system it is connected to. The easy way is to have each thread create a connection to the database.

Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Casey Hawthorne
Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility. http://blog.extracheese.org/2010/02/python-vs-ruby-a-battle-to-the-death.html -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Hubris connects Ruby to Haskell, will there be such a connection between Python and Haskell?

2010-02-16 Thread Casey Hawthorne
Hubris connects Ruby to Haskell, will there be such a connection between Python and Haskell? -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: easy question, how to double a variable

2009-09-23 Thread Casey Webster
On Sep 22, 9:57 am, Grant Edwards wrote: > > No, no, no.  The plan is to do his homework for him so that > he's incompetent when he graduates and won't be competition for > the rest of us who did do our homework. Don't forget the Peter principal --- we might end up working for him! Btw, I can't

Threading.py Class Syntax and Super

2009-09-16 Thread Casey
en" if the class __init__ method does not make a call to super? [1] http://svn.python.org/view/python/trunk/Lib/threading.py?view=markup Thanks, - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Suggestions for Python MapReduce?

2009-07-22 Thread Casey Webster
On Jul 22, 5:27 am, Phillip B Oldham wrote: > I understand that there are a number of MapReduce frameworks/tools > that play nicely with Python (Disco, Dumbo/Hadoop), however these have > "large" dependencies (Erlang/Java). Are there any MapReduce frameworks/ > tools which are either pure-Python,

SMTPlib and SMTPd Performance Issues

2009-07-21 Thread Casey McGinty
f._SMTPChannel__rcpttos = [] self._SMTPChannel__mailfrom = None self._SMTPChannel__state = self.COMMAND self.set_terminator('\r\n') if not status: self.push('250 Ok') else: self.push(status Thanks, - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Equivalent for dd & fold

2009-07-16 Thread Casey Webster
On Jul 16, 10:12 am, seldan24 wrote: > On Jul 15, 1:48 pm, Emile van Sebille wrote: > > > > > On 7/15/2009 10:23 AM MRAB said... > > > >> On Jul 15, 12:47 pm, Michiel Overtoom wrote: > > >>> seldan24 wrote: > > what can I use as the equivalent for the Unix 'fold' command? > > >>> def fold(s

Re: PEP368 and pixeliterators

2009-07-02 Thread Casey Webster
On Jul 2, 4:32 am, Joachim Strömbergson wrote: > But, wouldn't it be more Pythonic and simpler to have an iterator that > iterates over all pixels in an image? Starting with upper left corner > and moving left-right and (line by line) to lower right. This would > change the code above to: Unless

Re: performance problem with time.strptime()

2009-07-02 Thread Casey Webster
On Jul 2, 7:30 am, Nils Rüttershoff wrote: > Rec = > re.compile(r"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\s-\s\d+\s\[(\d{2}/\w+/\d{4}:\d{2}:\d{2}:\d{2})\s\+\d{4}\].*") > Line = '1.2.3.4 - 4459 [02/Jul/2009:01:50:26 +0200] "GET /foo HTTP/1.0" 200 - > "-" "www.example.org" "-" "-" "-"' I'm not sure how

Re: What does Guido want in a GUI toolkit for Python?

2009-06-27 Thread Casey Hawthorne
JVM. -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: strip char from list of strings

2009-05-19 Thread Casey Webster
On May 18, 3:30 pm, Laurent Luce wrote: > I have the following list: > > [ 'test\n', test2\n', 'test3\n' ] > > I want to remove the '\n' from each string in place, what is the most > efficient way to do that ? > > Regards, > > Laurent Do you _really_ need to do this in place? If not, the simple

Re: Complete frustration

2009-05-08 Thread Casey Hawthorne
#x27;t want to see it every >> time I just want to run a python program! >> -- >> http://mail.python.org/mailman/listinfo/python-list >> >This is a windows question -- you'll need to reassign the default >association of PYW files. Look in explorer|tools|folder options. > >Emile I believe this option is in the Python init file! -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

I'm intrigued that Python has some functional constructions in the language.

2009-05-08 Thread Casey Hawthorne
s of functional programming but why does it have to be so cryptic." -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Can't one collect twitts and twits in any language?

2009-04-04 Thread Casey Hawthorne
:) -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: How complex is complex?

2009-03-18 Thread Casey Webster
On Mar 18, 1:30 pm, Kottiyath wrote: > When we say readability counts over complexity, how do we define what > level of complexity is ok? > For example: > Say I have dict a = {'a': 2, 'c': 4, 'b': 3} > I want to increment the values by 1 for all keys in the dictionary. > So, should we do:>>> for k

Re: How to add months to a date (datetime object)?

2009-03-15 Thread Casey Webster
On Mar 15, 2:00 pm, tinn...@isbd.co.uk wrote: > No, it's perfectly possible applying simple logic.  My reminder > program manages it perfectly well.  I have, for example, two sets of > three monthly reminders. > >     One starts on Jan 19th and repeats three monthly, that means Jan >     19th, Apri

Re: Compute working days

2009-03-14 Thread Casey Webster
How about: from datetime import date, timedelta # Define the weekday mnemonics to match the date.weekday function (MON, TUE, WED, THU, FRI, SAT, SUN) = range(7) def workdays(start_date, end_date, whichdays=(MON,TUE,WED,THU,FRI)): ''' Calculate the number of working days between two dates

Winsound Problems on Vista 64

2009-03-06 Thread Casey
I have a new laptop that came with Vista 64 and I'm having problems with some of my older code that I use for multimedia processing. I narrowed the problem down to the winsound library; any attempt to play sounds results in a fatal error. The simplest case is: >>> from winsound import Beep >>> B

Re: printing bytes to stdout in Py3

2009-02-17 Thread Casey
On Feb 17, 12:33 pm, Christian Heimes wrote: > Yes, it's really the official way. You can google up the discussion > between me and Guido on the python-dev list if you don't trust me. ;) > The docs concur with me, too. > > http://docs.python.org/3.0/library/sys.html#sys.stdin > > Note: The standar

Re: printing bytes to stdout in Py3

2009-02-17 Thread Casey
On Feb 17, 7:28 am, Christian Heimes wrote: > Peter Billam schrieb: > > > Greetings. (Newbie warning as usual) In Python3, sys.stdout is a > > io.TextIOWrapper object; but I want to output bytes > >   (e.g. muscript -midi t > t.mid ) > > and they're coming out stringified :-(  How can I either cha

Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code?

2009-01-23 Thread Casey Hawthorne
Is there anyway Vpython and pyODE can be made to work with newer versions of Python 2.6.1 etc. without a lot of changes to source code? I suppose I'm thinking of an extra layer of indirection, which might slow things down to much. :) -- Regards, Casey -- http://mail.python.org/mailman/lis

Re: Regular expression that skips single line comments?

2009-01-19 Thread Casey
Another option (I cheated a little and turned sInput into a sequence of lines, similar to what you would get reading a text file): sInput = [ '; $1 test1', '; test2 $2', 'test3 ; $3 $3 $3', 'test4', '$5 test5', ' $6', ' test7 $7 test7', ] import re re_exp =

Re: Py3 - converting bytes to ascii

2009-01-15 Thread Casey
On Jan 15, 9:54 am, "Anjanesh Lekshminarayanan" wrote: > Using Python 3.0 > > So how do I to convert res.read() to ascii on opening the file in > ascii mode f = open('file.txt', 'w')? > I think this is what you are looking for: res = urllib.request.urlopen(url) f = open('file.txt', 'w') f.write(

Re: Free place to host python files?

2009-01-07 Thread Casey McGinty
Check out nearlyfreespeech.net for a free account. You could store hundreds of scripts on there for about 12 cents a year. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 nonlocal statement

2009-01-06 Thread Casey
On Jan 6, 11:46 am, Rob Williscroft wrote: > Matimus wrote in news:2a3d6700-85f0-4861-84c9-9f269791f044 > Searching (AKA googling) for: nonlocal site:bugs.python.org > leads to:http://bugs.python.org/issue4199 > > Rob. > --http://www.victim-prime.dsl.pipex.com/ Doh. I looked at the PEP and the 3

Re: Python 3.0 nonlocal statement

2009-01-06 Thread Casey
x27; on one line and 'x += 1' on another makes it a little less clear. But I do appreciate the reply! Casey -- http://mail.python.org/mailman/listinfo/python-list

Python 3.0 nonlocal statement

2009-01-06 Thread Casey
I use nested functions where it does make the code seem a little cleaner. Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug in Python or something I do not understand.

2009-01-01 Thread Casey
, 1, 1] >>> r = [q, q, q] >>> r [[1, 1, 1], [1, 1, 1], [1, 1, 1]] >>> r[0][0] = 999 >>> r [[999, 1, 1], [999, 1, 1], [999, 1, 1]] Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Project structure - Best practices

2008-12-05 Thread Casey McGinty
. If anyone wants to add some suggestions, I'd love to have more discussion to organize thoughts and see if any new ideas come out. As a starting point, what is a good markup language to use for some slick HTML and PDF output? - Casey McGinty [1] http://www.python.org/dev/peps/pep-0008/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Reverse zip() ?

2008-12-03 Thread Casey McGinty
> The corner case is when dealing with empty lists and there aren't > enough items to unpack. > > Another solution to zip(), with a slightly different behaviour for conner cases >>> a = (1,2,3) >>> b = (1,2,3) >>> c = (1,2,3,4) >>> zip(a,b) [(1, 1), (2, 2), (3, 3)] >>> map(None,a,b) [(1, 1),

Re: Google App Engine Code Challenge - write a tetris playing algorithm

2008-12-01 Thread Casey McGinty
'j' or 'l', is there any way to fill in the two blocked squares, without removing the top portion first? - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Google App Engine Code Challenge - write a tetris playing algorithm

2008-12-01 Thread Casey McGinty
On Sun, Nov 30, 2008 at 2:41 PM, russ.au <[EMAIL PROTECTED]> wrote: > I've got more features to add, depending on how > popular it is.. > Are you going to create a leader board to track the high scores? -- http://mail.python.org/mailman/listin

Dot operator magic has me stymied...

2008-10-29 Thread Casey Rodarmor
nstance instead of a function instance has messed up the magic of the dot operator, causing it not to bind the foo instance to the self argument. Can anybody shed some light on what's happening here? Also, I really do like using classes as decorators. Are there any workarounds to get it to wor

Re: Favorite Python System Administration Examples

2008-10-06 Thread Casey
On Oct 6, 3:05 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > I'm giving a talk at LISA this year, and while the slides are ready I > would like to go armed with as many examples of good system > administration code as possible. > > If you have a favorite administration tool that you wouldn't mind m

Re: Usual practice: running/testing modules in a package

2008-09-03 Thread Casey
On Aug 26, 10:21 pm, Casey <[EMAIL PROTECTED]> wrote: > On Aug 12, 9:57 pm, alito <[EMAIL PROTECTED]> wrote: > > > > > A wrapper on the level up works: > > > ~/python$ cat importercaller.py > > from testpackage import config > > config.hello()

Re: Usual practice: running/testing modules in a package

2008-08-27 Thread Casey
On Aug 12, 9:57 pm, alito <[EMAIL PROTECTED]> wrote: > > A wrapper on the level up works: > > ~/python$ cat importercaller.py > from testpackage import config > config.hello() > > ~/python$ python importercaller.py > hello > > So, how do I run these modules without writing a wrapper script for > ea

Re: PIL Question: Inverse of .load()?

2008-08-16 Thread Casey
On Aug 16, 3:53 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Casey wrote: > > I'm doing some image processing that requires accessing the individual > > pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of > > pixel RGB tuples using t

PIL Question: Inverse of .load()?

2008-08-15 Thread Casey
I'm doing some image processing that requires accessing the individual pixels of the image. I'm using PIL 1.1.6 and creating a 2D array of pixel RGB tuples using the Image class instance load() method. Unfortunately, I can't seem to find a reciprocal function that converts the 2D array of RGB tupl

Re: for x,y in word1, word2 ?

2008-08-11 Thread Casey
My first thought is that you should be looking at implementations of Hamming Distance. If you are actually looking for something like SOUNDEX you might also want to look at the double metaphor algorithm, which is significantly harder to implement but provides better matching and is less susceptibl

Re: paretovariate

2008-08-11 Thread Casey
On Aug 11, 3:14 am, "zhjchen" <[EMAIL PROTECTED]> wrote: > I want to realize a list of numbers. They follow pareto distribution. > For instance, the average value is 10 and alpha is 1.0 > I do not know how to use the function of paretovariate(alpha). It only > provides > alpha parameter. How shoul

Re: Inserting into a combo box

2008-08-05 Thread Casey McGinty
What toolkit are you using? -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I check nbr of cores of computer?

2008-07-29 Thread Casey McGinty
On Tue, Jul 29, 2008 at 12:53 PM, defn noob <[EMAIL PROTECTED]> wrote: > How can I check how many cores my computer has? > Is it possible to do this in a Python-app? > -- > http://mail.python.org/mailman/listinfo/python-list > You can use the HAL interface from the DBUS module. See also the gnome

Re: Where is the correct round() method?

2008-07-28 Thread Casey
On Jul 28, 12:34 am, Gary Herron <[EMAIL PROTECTED]> wrote: > This will work as you wish: >   math.floor(x+0.5) This works fine for positive x but what about negative: >>> round(2.5) 3.0 >>> floor(2.5 + 0.5) 3.0 >>> round(-2.5) -3.0 >>> floor(-2.5 + 0.5) -2.0 Maybe: def round2(x): return m

Re: Pwnie awards

2008-07-26 Thread Casey McGinty
One more award from award winner Tim Neshman ... http://www.thenewsh.com/ -- http://mail.python.org/mailman/listinfo/python-list

DBUS/HAL Manager Interface Help

2008-07-25 Thread Casey McGinty
Can someone explain to me why this sample code does not work? I am trying to test if a device exists. dbus_test.py -- import dbus bus = dbus.SystemBus() proxy = bus.get_object( 'org.freedesktop.Hal', '/org/freedesktop/Hal/Manager' ) manager = dbus.Interfa

Re: Python Written in C?

2008-07-20 Thread Casey McGinty
On Sun, Jul 20, 2008 at 5:06 PM, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2008-07-21, Dan Upton <[EMAIL PROTECTED]> wrote: > > Using punch-cards and paper-tape. Real programmers can edit > their programs with a pointy stick and some home-made > sticky-tape. > > Doesn't everyone know that REA

Re: screencapture with PIL question

2008-07-14 Thread Casey
On Jul 14, 11:11 am, greg <[EMAIL PROTECTED]> wrote: > I am able to use the PIL module to capture a screen or specific > window.  My problem is when capturing a window (on windows XP) I can > only capture the "visible" portion of the window.  Is there any way to > capture the entire window?  specif

Re: Perfect hashing for Py

2008-07-11 Thread Casey
On Jul 11, 8:01 am, [EMAIL PROTECTED] wrote: > Following links from this > thread:http://groups.google.com/group/comp.lang.python/browse_thread/thread/... > > I have found this perfect hash (minimal too) > implementation:http://burtleburtle.net/bob/hash/perfect.html > > I have already translated

Unit Testing Techniques

2008-07-10 Thread Casey McGinty
I'm familiar with the unittest module in Python, however I'm hoping someone can point me to some examples of more advanced usages of the framework. For example: 1. Using the framework to test a package with nested sub-packages and modules without having to hard code the location/name of each test

Re: Anyone happen to have optimization hints for this loop?

2008-07-09 Thread Casey
On Jul 9, 12:04 pm, dp_pearce <[EMAIL PROTECTED]> wrote: > I have some code that takes data from an Access database and processes > it into text files for another application. At the moment, I am using > a number of loops that are pretty slow. I am not a hugely experienced > python user so I would

Re: Interest not met.

2008-07-07 Thread Casey McGinty
On Thu, Jul 3, 2008 at 5:01 AM, david odey <[EMAIL PROTECTED]> wrote: > I write to inform you that the reason I subscribed to this web page > is not been met. > > I want to be sent sample codes in programming languages especially > python and an email tutorial on C#. I will be happy if these deman

Re: Help with Borg design Pattern

2008-06-30 Thread Casey McGinty
unning into a slight problem however that my run-time defined logging level is not correctly set until after the module has initialized, preventing any log messages from showing up. Is there a pythonic way to get around this? I'm thinking of adding a module init routine, but I don't feel like this is clean solution. - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with Borg design Pattern

2008-06-27 Thread Casey McGinty
On Fri, Jun 27, 2008 at 3:21 PM, Casey McGinty <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to implement a simple Borg or Singleton pattern for a class that > inherits from 'dict'. Can someone point out why this code does not work? > > class MyDict( dict

Help with Borg design Pattern

2008-06-27 Thread Casey McGinty
Hi, I'm trying to implement a simple Borg or Singleton pattern for a class that inherits from 'dict'. Can someone point out why this code does not work? class MyDict( dict ): __state = {} def __init__(self): self.__dict__ = self.__state a = MyDict() a['one'] = 1 a['two'] = 2 print a

Re: python-dbus example request

2008-06-26 Thread Casey McGinty
You will need this page to figure out the name of the device, and details on how to access it. However it is not python specific. http://people.freedesktop.org/~david/hal-spec/hal-spec.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Guide to organizing modules?

2008-06-06 Thread Casey McGinty
nctions are in distinct files from outside of the package. - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: ClassName.attribute vs self.__class__.attribute

2008-06-06 Thread Casey McGinty
On Thu, Jun 5, 2008 at 11:39 AM, Terry Reedy <[EMAIL PROTECTED]> wrote: > > If you want to access the attribute of a particular class, to read or > write, use that class. > SomeClass.attr > Note that no instance is required or relevant. > > If you want to read the attrubute of the class of an in

Re: ClassName.attribute vs self.__class__.attribute

2008-06-05 Thread Casey McGinty
-list > Thanks for the info. Can anyone explain more about the differences between the two techniques? Why does one work and the other one fail? Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Harry Potter?

2008-06-05 Thread Casey
Python fan??? Harry speaks Python fluently. We should all be so lucky! I'm told Harry is looking forward to Py3K and getting rid of all the old (hog)warts -- http://mail.python.org/mailman/listinfo/python-list

Re: Code execution in imported modules

2008-05-29 Thread Casey McGinty
On Thu, May 29, 2008 at 2:43 PM, Eric Wertman <[EMAIL PROTECTED]> wrote: > So I'm working on some file parsing and building up a stack of regular > expressions that I need to use. I was thinking of dropping them in an > external module. I was wondering.. if I put them in a file called > regex.py

Re: Struct usages in Python

2008-05-27 Thread Casey McGinty
>self.event[] = Event() *# Seems this is not allowed ?? * > self.event = [Event()] - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Organizing a Python project

2008-05-25 Thread Casey McGinty
like they idea of keeping most of application code (argument parsing, help output, initialization) inside of the package. The '_' should indicate that any other modules using your package should import that module. - Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: finding icons for Apps

2008-05-25 Thread Casey McGinty
http://art.gnome.org/ http://www.gnome-look.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Code correctness, and testing strategies

2008-05-24 Thread Casey McGinty
> Seriously, 10 hours of testing for code developed in 10 hours? What > > kind of environment do you write code for? This may be practical for > > large companies with hordes of full-time testing & QA staff, but not > > for small companies with just a handful of developers (and where you > > need t

Re: Organizing a Python project

2008-05-21 Thread Casey McGinty
hought an '__all__' define in the module would prevent this, but it does not seem to work. Thanks for reading, - Casey -- http://mail.python.org/mailman/listinfo/python-list

Making Variable Text Output More Pythonic?

2008-05-15 Thread Casey
Hi, I have some classes that print variable outputs depending on their internal state, like so: def __str__(self): out = [] if self.opt1: out += ['option 1 is %s' % self.opt1'] if self.opt2: out += ['option 2 is %s' % self.opt2'] return '\n'.join(out) Is there any way to

test

2008-05-15 Thread Casey McGinty
test -- http://mail.python.org/mailman/listinfo/python-list

Re: Sanitised Newsgroup Feeds?

2008-05-15 Thread Casey McGinty
irectly in your Inbox. Good luck. - Casey -- http://mail.python.org/mailman/listinfo/python-list

Making Variable Text Output More Pythonic?

2008-05-15 Thread Casey McGinty
Hi, I have some classes that print variable outputs depending on their internal state, like so: def __str__(self): out = [] if self.opt1: out += ['option 1 is %s' % self.opt1'] if self.opt2: out += ['option 2 is %s' % self.opt2'] return '\n'.join(out) Is there any way to

Problem with help() in python/ipython interpreters

2008-05-09 Thread Casey
I'm running python 2.5.2 on WinXP. I've always used a GUI for interactive development, but I wanted to try out ipython which better supports matplotlib in this mode. Unfortunately, whenever I try to use help() I get the following error: (Sys) The system cannot find the file specified. "C:\docum

Re: Getting PyUnit to run Package Test Modules

2008-04-22 Thread Casey McGinty
= __import__(name) components = name.split('.') for comp in components[1:]: print comp mod = getattr(mod,comp) alltests.addTest(unittest.findTestCases(mod)) return alltest On Tue, Apr 22, 2008 at 12:12 AM, Casey McGinty <[EMAIL PROTECTED]> wro

Getting PyUnit to run Package Test Modules

2008-04-22 Thread Casey McGinty
Hopefully this is an easy question for someone to answer. I have a directory structure like so: alltest.py prog.py ../package __init__.py mod1.py test_mod1.py modn. py (and so on...) Each test_mod*.py file contains some PyUnit test cases. I am using the following code in

Re: Different results when running script from IDLE versus Command Line

2008-03-13 Thread Casey T
On Mar 12, 5:28 pm, Chris <[EMAIL PROTECTED]> wrote: > On Mar 12, 8:10 pm, Casey T <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I'm new to Python and I'm having some problems with getting different > > results from my script when I run it

Different results when running script from IDLE versus Command Line

2008-03-12 Thread Casey T
Hi, I'm new to Python and I'm having some problems with getting different results from my script when I run it from IDLE versus just double- clicking the .py file and having it run through the command line. Basically, my script reads some CSV files, assembles a text files, then uploads that test f

Stop tab-completing empty lines!

2008-01-17 Thread Casey Rodarmor
line and just want a tab, it tries to tab complete, which kind of a pain. -=SIMULATED PYTHON PROMPT=- >>> def mega_awesome_function(cool_stuff, **some_sweet_kwargs): ... X (The X is where I press tab and get super annoyed) I could just rebind the key, but i like tab ;-) Any suggestions?

Re: Replace stop words (remove words from a string)

2008-01-17 Thread Casey Rodarmor
That's much better than what I was about to post: for s in stoplist: string.join(mystr.split(s, "")) Berlin: Why are you keen on avoiding split()? On 1/17/08, Karthik <[EMAIL PROTECTED]> wrote: > > How about - > > for s in stoplist: > string.replace(mystr, s, "") > > Hope this should

Extending the readline module?

2008-01-16 Thread Casey Rodarmor
branch. What is the best way to go about doing this? Best regards, Casey Rodarmor -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a nicer way to do this?

2007-10-04 Thread Casey
On Oct 4, 5:42 pm, Casey <[EMAIL PROTECTED]> wrote: > Not sure if this is really better or even more pythonic, but if you > like one-liners that exercise the language: Hmm, I guess it WAS more pythonic, since three of us gave essentially identical responses in a 10-minute period. Tha

Re: Is there a nicer way to do this?

2007-10-04 Thread Casey
Not sure if this is really better or even more pythonic, but if you like one-liners that exercise the language: attributeNames = dict( [("AttributeName.%d" % (n+1), attribute) for n,attribute in enumerate(attributes)] ) What this does is create a list (using a list comprehension and the enumerate

Re: What does the syntax [::-1] really mean?

2007-10-04 Thread Casey
On Oct 4, 4:58 pm, Casey <[EMAIL PROTECTED]> wrote: > Thanks, again! I figured it out from Fred's and your initial posts. Oops - I meant Kurt, not Fred. Sorry for the mis-attribution! -- http://mail.python.org/mailman/listinfo/python-list

Re: What does the syntax [::-1] really mean?

2007-10-04 Thread Casey
On Oct 4, 4:32 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Duncan Booth <[EMAIL PROTECTED]> wrote: > > the invariant that you are looking for is that for all non-negative a, b: > >x[a:b:1] reversed is x[-len(x)+b-1:-len(x)+a-1:-1] > > I should of course have said "all a, b in the range 0 <= a

Re: What does the syntax [::-1] really mean?

2007-10-04 Thread Casey
On Oct 4, 1:41 pm, "Kurt Smith" <[EMAIL PROTECTED]> wrote: > >>> 'abc'[None:None:-1] > 'cba' > Kurt Thanks! -- http://mail.python.org/mailman/listinfo/python-list

What does the syntax [::-1] really mean?

2007-10-04 Thread Casey
I've used [::-1] as a shorthand for reverse on several occasions, but it occurred to me yesterday I never really thought about why it works. First, I checked out the documentation. >From section 3.6 of the Python Library Reference: "The slice of s from i to j with step k is defined as the sequen

Re: getopt with negative numbers?

2007-09-28 Thread Casey
On Sep 27, 10:47 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > I believe they shouldn't because the established interface is that a > hyphen always introduced an option unless (for those programs that > support it) a '--' option is used, as discussed. Not "THE" established interface; "AN" established

Re: getopt with negative numbers?

2007-09-27 Thread Casey
On Sep 27, 7:57 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > One person's "brilliant" is another's "kludge". Well, it is a hack and certainly not as clean as having getopt or optparse handle this natively (which I believe they should). But I think it is a simple and clever hack and still allows ge

Re: getopt with negative numbers?

2007-09-27 Thread Casey
On Sep 27, 2:21 pm, "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote: > If you can access the argument list manually, you could scan it for a > negative integer, > and then insert a '--' argument before that, if needed, before passing it to > getopt/optparse. > Then you wouldn't have to worry about i

Re: getopt with negative numbers?

2007-09-27 Thread Casey
On Sep 27, 2:21 pm, "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote: > If you can access the argument list manually, you could scan it for a > negative integer, and then insert a '--' argument before that, > if needed, before passing it to getopt/optparse. Then you wouldn't have to > worry about it

Re: getopt with negative numbers?

2007-09-27 Thread Casey
On Sep 27, 1:34 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > optparse can handle options with a negative int value; "--" can be used to > signal that no more options will follow: Thanks, Peter. getopt supports the POSIX "--" end of options indicator as well, but that seems a little less elegant t

Re: True of False

2007-09-27 Thread Casey
On Sep 27, 1:12 pm, "Richard Thomas" <[EMAIL PROTECTED]> wrote: > On 27/09/2007, Casey <[EMAIL PROTECTED]> wrote: > > > > > On Sep 27, 12:48 pm, "Simon Brunning" <[EMAIL PROTECTED]> > > wrote: > > > On 9/27/07, [EMAIL PROTECTED

getopt with negative numbers?

2007-09-27 Thread Casey
Is there an easy way to use getopt and still allow negative numbers as args? I can easily write a workaround (pre-process the tail end of the arguments, stripping off any non-options including negative numbers into a separate sequence and ignore the (now empty) args list returned by getopt, but it

Re: True of False

2007-09-27 Thread Casey
On Sep 27, 12:48 pm, "Simon Brunning" <[EMAIL PROTECTED]> wrote: > On 9/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > I tried writing a true and false If statement and didn't get > > anything? I read some previous posts, but I must be missing > > something. I just tried something easy

Re: [ANN] Update to Python Quick Reference Card (for Python 2.4) (v0.67)

2007-05-02 Thread Casey Hawthorne
tal/python/pqrc/ > -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: a better solution for GUI in python

2007-03-11 Thread Casey Hawthorne
For a browser interface have you thought of Ajax and possibly WPF/E? http://en.wikipedia.org/wiki/AJAX http://en.wikipedia.org/wiki/Windows_Presentation_Foundation -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: Using signal.alarm to terminate a thread

2006-11-15 Thread Adrian Casey
Nick Craig-Wood wrote: > Adrian Casey <[EMAIL PROTECTED]> wrote: >> > Adrian Casey <[EMAIL PROTECTED]> wrote: >> > import os, pexpect, threading >> > >> > def runyes(): >> > print "Running yes command..." >> &g

  1   2   >