Re: string splitting

2006-10-16 Thread hiaips
tting the string on "." and using rfind to find the last instance of "_". i.e., myStr = "wisconsin_state.txt" pieces = myStr.split(".") substr = pieces[0][pieces[0].rfind("_") + 1:] --hiaips -- http://mail.python.org/mailman/listinfo/python-list

Re: OS X and Python - wxPython has forced a rehash of my approach

2006-09-04 Thread hiaips
Kevin Walzer wrote: > hiaips wrote: > > [EMAIL PROTECTED] wrote: > >> Earlier I asked about how people installed Python on OS X, given that > >> one can choose from Xcode, Fink, Darwin, ActiveState and source builds: > >> > >> http://groups.google.co

Re: OS X and Python - wxPython has forced a rehash of my approach

2006-09-04 Thread hiaips
[EMAIL PROTECTED] wrote: > Earlier I asked about how people installed Python on OS X, given that > one can choose from Xcode, Fink, Darwin, ActiveState and source builds: > > http://groups.google.com/group/comp.lang.python/browse_thread/thread/5c4cde4206d1fbb7/37de06a6bb6b2361?lnk=gst&q=OS+X+and+P

Re: Newbie Question. Class definitions on the fly.

2006-08-27 Thread hiaips
ishtar2020 wrote: > Hi everyone > > I'm sure this question is kinda stupid and has been answered a few > times before... but I need your help! > > I'm writing a small application where the user can analyze some text > based on a set of changing conditions , and right now I'm stuck on a > point wh

Re: Is this a good idea or a waste of time?

2006-08-24 Thread hiaips
asincero wrote: > Would it be considered good form to begin every method or function with > a bunch of asserts checking to see if the parameters are of the correct > type (in addition to seeing if they meet other kinds of precondition > constraints)? Like: > > def foo(a, b, c, d): >as

Re: OS X and Python - what is your install strategy?

2006-08-24 Thread hiaips
metaperl wrote: > I'm about to get a new OS X box on which I will rewrite a bunch of data > munging scripts from Perl to Python. I know that there are several port > services for OS X (fink, darwin ports, opendarwin). So I am not sure > whether to use their port of Python or whether to build from

Re: Python + Java Integration

2006-08-23 Thread hiaips
> Java itself never deserved to be the 'next' anything anyway. It was > sold on hype and has never lived up to it. I can see your point from a > business perspective but I like to think Python is sold on its merits > and not on being the new panacea for middle managers to deploy. Bravo. I could

Re: key not found in dictionary

2006-08-22 Thread hiaips
KraftDiner wrote: > I have a dictionary and sometime the lookup fails... > it seems to raise an exception when this happens. > What should I do to fix/catch this problem? > > desc = self.numericDict[k][2] > KeyError: 589824 < This is the error that is being produced, > because there is n

Re: Permission Denied

2006-08-19 Thread hiaips
Tom Strickland wrote: > Hopefully this is a simple question. I've started to program in Python > after an absence of about a year, so I'm very rusty. I wrote a short > program and tried to run it using Python2.4 in Linux. I keep getting > "permission denied" messages after entering the path to the

Re: MySQLdb installation error

2006-08-17 Thread hiaips
What I'm getting at is that it looks like one of these arch flags needs to be removed, as a previous poster said. I remember having a similar issue with an arch flag when installing some Python module (don't remember whether it was MySQLdb or not), and I fixed it by installing the Universal SDK th

Re: How to delete a directory tree in FTP

2006-08-16 Thread hiaips
T wrote: > I connect to a FTP server which can be either unix or windows server. > Once in the FTP session, I would like to delete a directory tree on the > server. Is there a command that will do this? If not, can someone > point me to a right direction? > > Thanks! Oops...just noticed that yo

Re: How to delete a directory tree in FTP

2006-08-16 Thread hiaips
T wrote: > I connect to a FTP server which can be either unix or windows server. > Once in the FTP session, I would like to delete a directory tree on the > server. Is there a command that will do this? If not, can someone > point me to a right direction? > > Thanks! Try using an "FTP" object f

Re: MySQLdb installation error

2006-08-15 Thread hiaips
Yi Xing wrote: > Hi, > > I met the following error when I tried to install MySQLdb. I had no > problem installing numarray, Numeric, Rpy, etc. Does anyone know > what's the problem? Thanks! > > running install > running build > running build_py > creating build > creating build/lib.darwin-7.9.0-P

Re: Beginner Textbook

2006-08-15 Thread hiaips
M_M wrote: > Michiel Sikma wrote: > > Introducing 13 year olds to a programming language? You're gonna have a > > hard time finding good literature for that. Even if you do, it's going > > to cost a lot of time to guide them. > > > > "Beginning Python: From Novice to Professional" by Magnus Lee He

Re: Best IDE for Python

2006-08-14 Thread hiaips
I'm assuming that FOS = "free open source"... In any case, what operating system do you run? If you're on OS X, I highly recommend TextMate. It's not free, but it has good support (either via built-in or third-party plugins) for Python as well as HTML, SQL, XML, Django templates, and the like. A

Re: newb question: file searching

2006-08-08 Thread hiaips
Oops, what I wrote above isn't quite correct. As another poster pointed out, you'd want to do for file in x[2]: ... --dave -- http://mail.python.org/mailman/listinfo/python-list

Re: newb question: file searching

2006-08-08 Thread hiaips
[EMAIL PROTECTED] wrote: > Thanks, Dave. That's exactly what I was looking for, well, except for > a few small alterations I'll make to achieve the desired effect. I > must ask, in the interest of learning, what is > > [file for file in files if file.endswith(extension)] > > actually doing? I k

Re: newb question: file searching

2006-08-08 Thread hiaips
> I'm thinking os.walk() could definitely be a big part of my solution, > but I need a little for info. If I'm reading this correctly, os.walk() > just goes file by file and serves it up for your script to decide what > to do with each one. Is that right? So, for each file it found, I'd > have

Re: newb question: file searching

2006-08-08 Thread hiaips
> [EMAIL PROTECTED] wrote: > > I'm new at Python and I need a little advice. Part of the script I'm > > trying to write needs to be aware of all the files of a certain > > extension in the script's path and all sub-directories. Can someone > > set me on the right path to what modules and calls t

Re: Which Python API for PostgreSQL?

2006-08-04 Thread hiaips
I also recommend psycopg. --Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Running queries on large data structure

2006-08-03 Thread hiaips
Christoph, Well, if you format the data as a Python dictionary and give the data file a .py extension, it becomes a Python module that you can load and reload dynamically. That's sort of what I was thinking. --Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Running queries on large data structure

2006-08-03 Thread hiaips
y about parsing it.) I don't know whether any of this makes sense for your problem, but in any case, good luck. --hiaips -- http://mail.python.org/mailman/listinfo/python-list

Re: exception handling; python program that interacts with postgresql db

2006-08-02 Thread hiaips
Another option would be to use the psycopg module to connect to postgres from within your Python code. See http://www.initd.org/projects/psycopg1 for more information. --hiaips -- http://mail.python.org/mailman/listinfo/python-list

Re: exception handling; python program that interacts with postgresql db

2006-08-02 Thread hiaips
well > addressed. =) > > thanks. have a nice one. Hi, damacy, Maybe I'm not understanding your code 100%, but have you tried catching the return value of the psql process that you're launching? Just a thought... --hiaips -- http://mail.python.org/mailman/listinfo/python-list

Re: Are there any AOP project in python community?

2006-08-02 Thread hiaips
steve wrote: > I mean Aspect-Oriented Programming. > If any please give me some of links. > Thanks a lot. See http://en.wikipedia.org/wiki/Aspect-oriented_programming. There is a list of AOP implementations for a number of languages (including Python) near the bottom of the page.