organizing python code with tests

2008-08-14 Thread eliben
Hello, At the moment, I place all the code of my project in a src/ directory, and all the tests in a sibling tests/ directory, so for instance a sample project can look like this: doc/ ... src/ play.py write.py tests/ test_play.py test_write.py While this works fine, I have a couple of

Re: newb loop problem

2008-08-14 Thread Dave
On Aug 13, 8:46 am, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > Dave <[EMAIL PROTECTED]> wrote: > >hitNum = 0 > >stopCnt = 6 + hitNum > >offSet = 5 > > >for i in range(0,10,1): > > The step argument to range defaults to 1: it's tidier to omit it. > Similarly, the start argument defaults to 0, so

Re: Cutting and Pasting in Windows IDLE

2008-08-14 Thread Terry Reedy
Gabriel Genellina wrote: En Tue, 12 Aug 2008 13:04:05 -0300, Victor Subervi <[EMAIL PROTECTED]> escribi�: A couple of weeks ago I asked how to cut and paste multiple lines in the Windows IDLE interface. I can only paste one line at a time! Frustrating. You can paste a multi-line statement

Re: precedence of [] vs .

2008-08-14 Thread Carl Banks
On Aug 14, 7:17 pm, Michael Tobis <[EMAIL PROTECTED]> wrote: > On Aug 14, 6:01 pm, "Calvin Spealman" <[EMAIL PROTECTED]> wrote: > > > > > attribute access (foo.bar) binds more tightly than subscripting (foo[bar]). > > That certainly looks right, and in retrospect I wonder that I even > doubted it.

Re: precedence of [] vs .

2008-08-14 Thread Terry Reedy
Michael Tobis wrote: On Aug 14, 6:01 pm, "Calvin Spealman" <[EMAIL PROTECTED]> wrote: attribute access (foo.bar) binds more tightly than subscripting (foo[bar]). That certainly looks right, and in retrospect I wonder that I even doubted it. But even the official docs seem to me to specify o

Re: dynamically getting loggers

2008-08-14 Thread Gabriel Genellina
En Thu, 14 Aug 2008 18:29:41 -0300, belred <[EMAIL PROTECTED]> escribi�: is there a way to dynamically get all the active loggers? i currently have code like this in different areas of the program: import logging log = logging.getLogger('foo') i would like to write a function that dynamicall

Re: Don´t find HTMLgen

2008-08-14 Thread Gabriel Genellina
En Thu, 14 Aug 2008 17:10:26 -0300, <[EMAIL PROTECTED]> escribi�: I am looking for HTMLgen module but not to find this, the link referenced in www.python.org it does not exist. I have need to develop in cgi and would want to do it of the possible traditional form but, i like any module for

Re: a podcast for music algo-comped with python

2008-08-14 Thread castironpi
On Aug 14, 4:01 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 14 Aug, 22:44, '2+ <[EMAIL PROTECTED]> wrote: > > I'm not sure if I follow the question. I don't have much experience > with making sound effects, preferring to compose and "pre-render" my > music, but I imagine there are some tricks t

Re: negative numbers are not equal...

2008-08-14 Thread castironpi
On Aug 14, 4:31 pm, Wojtek Walczak <[EMAIL PROTECTED]> wrote: > On Thu, 14 Aug 2008 18:23:21 -0300, ariel ledesma wrote: > > i see now, so i guess that's also why id() returns the same address for > > them as well... > > It just have to work like this. > > a is b > > is actually equal to: > > id(a)

Re: Don´t find HTMLgen

2008-08-14 Thread Daniel Fetchinson
> Good day Mr. Guido, excuse my poor english. > > I am looking for HTMLgen module but not to find this, the link > referenced in www.python.org it does not exist. > > I have need to develop in cgi and would want to do it of the possible > traditional form but, i like any module for my help. Since

Re: Cutting and Pasting in Windows IDLE

2008-08-14 Thread Gabriel Genellina
En Tue, 12 Aug 2008 13:04:05 -0300, Victor Subervi <[EMAIL PROTECTED]> escribi�: A couple of weeks ago I asked how to cut and paste multiple lines in the Windows IDLE interface. I can only paste one line at a time! Frustrating. I want it to work like my Linux interpreter. Why doesn´t it? Pl

Re: Factory for Struct-like classes

2008-08-14 Thread Matthew Wilson
On Thu 14 Aug 2008 11:19:06 AM EDT, Larry Bates wrote: > eliben wrote: >> Hello, >> >> I want to be able to do something like this: >> >> Employee = Struct(name, salary) >> >> And then: >> >> john = Employee('john doe', 34000) >> print john.salary I find something like this useful, especially

Re: updating dictionaries from/to dictionaries

2008-08-14 Thread John Machin
On Aug 15, 11:45 am, [EMAIL PROTECTED] wrote: > 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 My first posting in this th

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: Madari, Edwin

Re: updating dictionaries from/to dictionaries

2008-08-14 Thread John Machin
On Aug 15, 11:23 am, [EMAIL PROTECTED] wrote: > if the values for any of the keys are None, both do not work as can be seen > below!!. > If any of the values are None, nothing can work. The OP justifiably (given his problem domain (bigram frequencies)) expects that all values will be integers. If

RE: updating dictionaries from/to dictionaries

2008-08-14 Thread Edwin . Madari
if the values for any of the keys are None, both do not work as can be seen below!!. since both loops are iterating over keys(), 'get' method which would return a '0' for non existing key does not encounter any non-existing keys. impo

RE: SOAPpy and ArrayOfString

2008-08-14 Thread Edwin . Madari
for someMethod(Field1 ArrayOf_xsd_string, other_parameters) a call someMethod( ['str1', 'str2', 'str3'], other_parameters) *works for me* with SOAPpy 0.12.0. yes sir it does. in PERL, let alone array types, even for simple types it was hard for me with all the '->', and '$' prefixing for obje

Re: updating dictionaries from/to dictionaries

2008-08-14 Thread Brandon
> (1) iterating over foo: > for key in foo: >foo[key] += bar.get(key, 0) > > (2) iterating over bar: > for key in bar: >foo[key] += bar[key] > > I (again) challenge you to say *why* you feel that the "iterating over > bar" solution will not work. Well if you're going to be clever enough

Re: Fixed-length text file to database script

2008-08-14 Thread John Machin
On Aug 15, 4:55 am, [EMAIL PROTECTED] wrote: > #your thought is right. > === > def sizes2fields(sizes): >d = [] >begin = 0 >for i in sizes: > if begin: > end = begin + i > else: end = i > d.append((begin, end

Re: The Importance of Terminology's Quality

2008-08-14 Thread norseman
John W Kennedy wrote: Robert Maas, http://tinyurl.com/uh3t wrote: John W Kennedy <[EMAIL PROTECTED]> wrote: JWK> Into the 60s, indeed, there were still machines being made JWK> that had no instruction comparable to the mainframe BASx/BALx JWK> family, or to Intel's CALL. You had to do a subprogr

Tkinter and TableList - Registering alternative Cell widgets

2008-08-14 Thread lee . walczak
Hi, I hope someone can help here. I have made lots of progress implementing a gui application which at present uses the TableList python wrapper to interface with Tcl TableList implemention. http://tkinter.unpythonic.net/wiki/TableListTileWrapper, http://tkinter.unpythonic.net/wiki/TableListWrapp

Re: precedence of [] vs .

2008-08-14 Thread Michael Tobis
On Aug 14, 6:01 pm, "Calvin Spealman" <[EMAIL PROTECTED]> wrote: > > attribute access (foo.bar) binds more tightly than subscripting (foo[bar]). That certainly looks right, and in retrospect I wonder that I even doubted it. But even the official docs seem to me to specify otherwise: http://docs.

comp.lang.python driver

2008-08-14 Thread Dick . Rutter
http://qualification.googlebong.com Title: Norm Mabus GoogleBong -- http://mail.python.org/mailman/listinfo/python-list

Re: precedence of [] vs .

2008-08-14 Thread Calvin Spealman
On Thu, Aug 14, 2008 at 6:46 PM, Michael Tobis <[EMAIL PROTECTED]> wrote: > I wrote some code to test the precedence of getitem vs getattr; it > shows that getitem binds tighter. > > I have been handed some code that relies on the observed behavior. > However, the Nutshell precedence list claims th

precedence of [] vs .

2008-08-14 Thread Michael Tobis
I wrote some code to test the precedence of getitem vs getattr; it shows that getitem binds tighter. I have been handed some code that relies on the observed behavior. However, the Nutshell precedence list claims the opposite. Is the Nutshell wrong or am I missing something or is this a bug? clas

parsing form with a website question...

2008-08-14 Thread bruce
Hi guys... Got a question that I figured I'd ask before I reinvent the wheel. A basic website has a form, or multiple forms. within the form, there might be multiple elements (lists/select statements, etc...). each item would have a varname, which would in turn be used as part of the form action

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread Steven D'Aprano
On Thu, 14 Aug 2008 10:54:25 -0700, korean_dave wrote: > Well, here is the whole problem. > > It works perfectly. I can see why that might be a problem. To solve it, open the source code in a text editor and make random changes to the code. -- Steven -- http://mail.python.org/mailman/listin

Re: The Importance of Terminology's Quality

2008-08-14 Thread John W Kennedy
Robert Maas, http://tinyurl.com/uh3t wrote: John W Kennedy <[EMAIL PROTECTED]> wrote: JWK> Into the 60s, indeed, there were still machines being made JWK> that had no instruction comparable to the mainframe BASx/BALx JWK> family, or to Intel's CALL. You had to do a subprogram call by JWK> first o

Re: Tkinter updates - Easiest way to install/use Tile?

2008-08-14 Thread Guilherme Polo
On Thu, Aug 14, 2008 at 12:05 PM, Guilherme Polo <[EMAIL PROTECTED]> wrote: > On Wed, Aug 13, 2008 at 2:10 PM, Mudcat <[EMAIL PROTECTED]> wrote: >> So I haven't programmed much in Python the past couple of years and >> have been catching up the last few days by reading the boards. I'll be >> making

Re: negative numbers are not equal...

2008-08-14 Thread Wojtek Walczak
On Thu, 14 Aug 2008 18:23:21 -0300, ariel ledesma wrote: > i see now, so i guess that's also why id() returns the same address for > them as well... It just have to work like this. a is b is actually equal to: id(a) == id(b) so there is no other way for id() in such case. Hope this helps.

dynamically getting loggers

2008-08-14 Thread belred
is there a way to dynamically get all the active loggers? i currently have code like this in different areas of the program: import logging log = logging.getLogger('foo') i would like to write a function that dynamically get a list of all the logger names such as 'foo'. or get a list of the lo

Re: negative numbers are not equal...

2008-08-14 Thread Terry Reedy
When you ask the interpreter to create an immutable object with a particular value, it may at its discretion, to conserve space and possibly conserve time, return an existing object with that same value. This is documented somewhere in the reference. The result of comparing two 'different' o

Re: negative numbers are not equal...

2008-08-14 Thread ariel ledesma
Christian Heimes wrote: You are getting the result because Python optimized small integers. See http://svn.python.org/projects/python/trunk/Objects/intobject.c Integers between -5 and +256 are singletons as are some other objects like strings with one element or empty tuples. You must not rel

RE: urldecode function?

2008-08-14 Thread Edwin . Madari
afraid not.. simple to create your own, NOTE that key words can be supplied more than once. Hence... import urllib def urldecode(query): d = {} a = query.split('&') for s in a: if s.find('='): k,v = map(urllib.unquote, s.split

Re: help on import libxml2

2008-08-14 Thread Paul Boddie
On 14 Aug, 22:43, [EMAIL PROTECTED] wrote: > > Traceback (most recent call last): > File "", line 1, in > File "/sea/local/lib/python2.5/site-packages/libxml2.py", line 1, in > > import libxml2mod > ImportError: ld.so.1: python: fatal: relocation error: file /usr/local/ > lib/python2.5/si

Re: a podcast for music algo-comped with python

2008-08-14 Thread Paul Boddie
On 14 Aug, 22:44, '2+ <[EMAIL PROTECTED]> wrote: > hey thanx > maybe these days .. game-programmers are doing algo-comp > without talking loud about it? > > is python running as backbones of some games? Here's a link to a fairly reasonable summary of Python and games: http://wiki.python.org/moin/

help on import libxml2

2008-08-14 Thread jianbing . chen
Hi, I have this weird situation where on the same machine(solaris 8, python 2.5), one user can do this with no problem: >>> import libxml2 >>> libxml2 >>> While the another one get this: >>> import libxml2 Traceback (most recent call last): File "", line 1, in File "/sea/local/lib/python2

Re: a podcast for music algo-comped with python

2008-08-14 Thread '2+
hey thanx maybe these days .. game-programmers are doing algo-comp without talking loud about it? is python running as backbones of some games? well ... maybe i'd simply want to start from writing a funny cute one that can play strange sounds with pc-kbd ... is it simple if is not about sound-fil

Re: negative numbers are not equal...

2008-08-14 Thread Christian Heimes
ariel ledesma wrote: i read that 'is' compares if they are really the same object, but i don't that's it because then why does -5 return True? of course i could only use == to compare, but still, what am i missing here? Rule of thumb: Never use 'is' with any kind of string or numeric object.

Re: negative numbers are not equal...

2008-08-14 Thread Josh English
On Aug 14, 1:18 pm, ariel ledesma <[EMAIL PROTECTED]> wrote: > hello guys > > i just ran into this when comparing negative numbers, they start > returning False from -6 down, but only when comparing with 'is' > >  >>> m = -5 >  >>> a = -5 >  >>> m is a > True >  >>> m = -6 >  >>> a = -6 >  >>> m is

Re: Cannot download SendKeys module

2008-08-14 Thread Stef Mientki
kpd wrote: Same thing here, would greatly appreciate a copy myself. -- http://mail.python.org/mailman/listinfo/python-list here you can find a copy: http://code.google.com/p/pylab-works/downloads/list cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list

negative numbers are not equal...

2008-08-14 Thread ariel ledesma
hello guys i just ran into this when comparing negative numbers, they start returning False from -6 down, but only when comparing with 'is' >>> m = -5 >>> a = -5 >>> m is a True >>> m = -6 >>> a = -6 >>> m is a False >>> m == a True i read that 'is' compares if they are really the same object

Re: Cannot download SendKeys module

2008-08-14 Thread kpd
Same thing here, would greatly appreciate a copy myself. -- http://mail.python.org/mailman/listinfo/python-list

Don´t find HTMLgen

2008-08-14 Thread econtreras . bantech
Good day Mr. Guido, excuse my poor english. I am looking for HTMLgen module but not to find this, the link referenced in www.python.org it does not exist. I have need to develop in cgi and would want to do it of the possible traditional form but, i like any module for my help. Thank a lot, Erne

Re: python interpreter

2008-08-14 Thread Alexandru Mosoi
On Aug 12, 7:46 pm, "Calvin Spealman" <[EMAIL PROTECTED]> wrote: > The best answer is: Don't do that! > > That isn't how you test things. Write test scripts, probably using the > unittest framework. You'll save yourself time and trouble having > easily reproducible tests. Many people suggested relo

Re: a question about mysqldb

2008-08-14 Thread Carsten Haese
Eric Wertman wrote: This means I could use this type of syntax? sql = 'SELECT (date,time,name,size,count,stuff,flavor) FROM crazyTable where monster=:1 and feet=:2 and price=:3' cursor.execute(sql,('cookie','3',77.44)) ? That depends on which database and DB-API module you're using. Numeric

RE: threading

2008-08-14 Thread Edwin . Madari
1. check out the Caveats for thread module: http://docs.python.org/lib/module-thread.html Threads interact strangely with interrupts: the KeyboardInterrupt exception will be received by an arbitrary thread. (When the signal module is available, interrupts always go to the main thread.) i.e.,

RE: Fixed-length text file to database script

2008-08-14 Thread Edwin . Madari
#your thought is right. === def sizes2fields(sizes): d = [] begin = 0 for i in sizes: if begin: end = begin + i else: end = i d.append((begin, end)) begin += i return tuple(d) def slicestring(s, field

Re: threading

2008-08-14 Thread Rhamphoryncus
On Aug 14, 3:30 am, "Mathieu Prevot" <[EMAIL PROTECTED]> wrote: > 2008/8/13 Parimala <[EMAIL PROTECTED]>: > > > > > Hello, > > >        I am using python2.5.1 version to run my test scripts. I want to use > > 'threading' module in my tests. As a startup program, I had run the > > following one. > >

Re: a question about mysqldb

2008-08-14 Thread Eric Wertman
Just to make sure I understand what you are showing me here: > columns = ('tID', 'tNote') > table_name = 'tmp' > sql = 'select %s from %s where tID=:1' % ( ', '.join(columns), table_name) > cursor.execute(sql, (1,)) > > # sql is now 'select tID, tNote from tmp where tID=:1' > # note the comma in a

RE: a question about mysqldb

2008-08-14 Thread Edwin . Madari
db module properly formats arguments, if input arguments are separated from table_name and colum_names. columns = ('tID', 'tNote') table_name = 'tmp' sql = 'select %s from %s where tID=:1' % ( ', '.join(columns), table_name) cursor.execute(sql, (1,)) # sql is now 'select tID, tNote from tmp

Re: Fixed-length text file to database script

2008-08-14 Thread Michael Ströder
Larry Bates wrote: While you are correct, that is not what the OP asked. There is no reference to processing data prior to insertion into MySQL database. Also the OP said they had a 1 day deadline. Larry, having a bad day? I'm confident that the OP is able to sort out *himself* what he need

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Christian Heimes
Diez B. Roggisch wrote: But that's a great deal more complicated! It requires merging, and while this of course is possible, you should have mentioned it because otherwise the OP might run into problems. A lock doesn't do the job at all. ZODB supports clustering through ZEO. Multiple ZEO clie

Re: a question about mysqldb

2008-08-14 Thread Eric Wertman
I also like to use escaped identifiers in cases like this: sql = "select tID,tNote from %s where %s = %%s" % ("tmp","tID") cursor.execute(sql,1) should work fine. -- http://mail.python.org/mailman/listinfo/python-list

Re: Fixed-length text file to database script

2008-08-14 Thread Eric Wertman
Sorry, didn't get to finish my script. Have to figure out the deal with gmail and the tab key someday. myfile = '/somewhere/somefile.txt' sizes = [16,4,8,8,8] fd = open(myfile,r) data = [] for line in fd.readlines() : a = [] idx1 = 0 for l in sizes : idx2 = idx1 + l

Re: Random Problems

2008-08-14 Thread Cousin Stanley
>> Well the othe day I was making a program to make a list >> of all the songs in certian directorys but I got a problem, >> only one of the directorys was added to the list. >> Heres my code: >> >> import random >> import os >> import glob >> >> songs = glob.glob('C:\Documents and Settings\Adm

Re: Fixed-length text file to database script

2008-08-14 Thread Eric Wertman
I have a machine (PLC) that is dumping its test results into a fixed- length text file. While it has nothing to do with python, I found that creating a MySQL table with the proper fixed length char() fields and using 'load data infile' was the easiest way to deal with that sort of scenario. T

Re: a podcast for music algo-comped with python

2008-08-14 Thread Paul Boddie
On 12 Aug, 05:05, '2+ <[EMAIL PROTECTED]> wrote: > > oh .. am just curious who are the guys over here composing weird music with > python > > as my self-introduction... > this is the podcast am focusing on cs.py: > http://www002.upp.so-net.ne.jp/buyobuyo/micro/rss.xml > files of scripts i used to

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread korean_dave
Well, here is the whole problem. It works perfectly. We are using a 3rd party automation program. Basically instead of print() i used a test.log() command that feeds into the 3rd party program and gives me output. I can sort output by date, time, category, etc. As you've seen, the program runs fas

Re: ActiveState Python v2.5 doesn't come with Tkinter or Tk installed.

2008-08-14 Thread Trent Mick
Dudeja, Rajat wrote: So, now I've finally started using Eclipse and PyDev as an IDE for my GUI Application. I just wrote some sample programs as an hands on. Now I would like to take up Tkinter. I'm using Active State Python version 2.5 and found that there is not Tkinter and Tk module in it. T

Re: Formatting input text file

2008-08-14 Thread Gerard flanagan
[EMAIL PROTECTED] wrote: Hi, it's me again with tons of questions. I hava an input file structured like this: X XYData-1 1. 3.08333 2. 9.05526 3. 3.13581

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Diez B. Roggisch
Jean-Paul Calderone schrieb: On Thu, 14 Aug 2008 16:15:11 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone wrote: On Thu, 14 Aug 2008 05:22:35 -0700 (PDT), Phillip B Oldham <[EMAIL PROTECTED]> wrote: [snip] How would one assign a unique ID to the root at that point?

Re: Getting stdout using ctypes.

2008-08-14 Thread Christian Heimes
Grant Edwards wrote: If he's running Unix, he needs to replace the stdout file descriptor (fd 1), with something that's connected to the "write" end of a pipe. Then he needs to read the other ("read") end of the pipe in his application. You do that using the dup2() system call: It's dangerous

Re: ActiveState Python v2.5 doesn't come with Tkinter or Tk installed.

2008-08-14 Thread Guilherme Polo
On Thu, Aug 14, 2008 at 1:20 PM, Russell E. Owen <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "Dudeja, Rajat" <[EMAIL PROTECTED]> wrote: > >> Hi, >> >> So, now I've finally started using Eclipse and PyDev as an IDE for my >> GUI Application. I just wrote some sample programs as a

Re: RPM of a Python program

2008-08-14 Thread Jason Scheirer
On Aug 13, 5:52 pm, Clay Hobbs <[EMAIL PROTECTED]> wrote: > I want to make an RPM (Redhat Package Manager) file to install a Python > program (not a module).  How is this done?  Does it use Distutils, or > something completely different?  Thanks in advance. > > -- Ratfink You first want to make su

Re: Getting stdout using ctypes.

2008-08-14 Thread Grant Edwards
On 2008-08-14, Larry Bates <[EMAIL PROTECTED]> wrote: > Mathias Lorente wrote: >> Hello all. >> >> I have a simple application (C++) that relies on shared libraries. It >> works fine in console mode. >> Lot of job is done into the shared library, so there is some calls to >> 'std::cout' to infor

Re: Fixed-length text file to database script

2008-08-14 Thread Larry Bates
Michael Ströder wrote: Larry Bates wrote: [EMAIL PROTECTED] wrote: I have a machine (PLC) that is dumping its test results into a fixed- length text file. I need to pull this data into a database (MySQL most likely) so that I can access it with Crystal Reports to create daily reports for my en

Re: Getting stdout using ctypes.

2008-08-14 Thread Larry Bates
Mathias Lorente wrote: Hello all. I have a simple application (C++) that relies on shared libraries. It works fine in console mode. Lot of job is done into the shared library, so there is some calls to 'std::cout' to inform the user in it. Now, I would like to wrap everything into a GUI, rem

Re: urldecode function?

2008-08-14 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: is there a function that does the opposite of urllib.urlencode? for example urldecode('Cat=1&by=down&start=1827') returns a dictionary with {'Cat':1, 'by':'down','start':1827) the cgi modules contains assorted stuff for parsing serialized HTTP forms and query string

Re: win32service and Python

2008-08-14 Thread David
Il Wed, 13 Aug 2008 16:03:33 -0500, Larry Bates ha scritto: > Actually those examples in Python for Win32 book are quite good and basically > all services are built using the same framework shown there. If you run into > a > problem post something here or better yet on comp.python.windows grou

urldecode function?

2008-08-14 Thread [EMAIL PROTECTED]
hi is there a function that does the opposite of urllib.urlencode? for example urldecode('Cat=1&by=down&start=1827') returns a dictionary with {'Cat':1, 'by':'down','start':1827) thanks -- http://mail.python.org/mailman/listinfo/python-list

Getting stdout using ctypes.

2008-08-14 Thread Mathias Lorente
Hello all. I have a simple application (C++) that relies on shared libraries. It works fine in console mode. Lot of job is done into the shared library, so there is some calls to 'std::cout' to inform the user in it. Now, I would like to wrap everything into a GUI, remove the application and

Re: ActiveState Python v2.5 doesn't come with Tkinter or Tk installed.

2008-08-14 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, "Dudeja, Rajat" <[EMAIL PROTECTED]> wrote: > Hi, > > So, now I've finally started using Eclipse and PyDev as an IDE for my > GUI Application. I just wrote some sample programs as an hands on. > > Now I would like to take up Tkinter. I'm using Active State Python

Re: ActiveState Python v2.5 doesn't come with Tkinter or Tk installed.

2008-08-14 Thread Larry Bates
Dudeja, Rajat wrote: Hi, So, now I've finally started using Eclipse and PyDev as an IDE for my GUI Application. I just wrote some sample programs as an hands on. Now I would like to take up Tkinter. I'm using Active State Python version 2.5 and found that there is not Tkinter and Tk module in i

SOAPpy and ArrayOfString

2008-08-14 Thread annu miya
Hi,   In the article below you mention that you were succesful at doing this through perl. Would it be possible to send me the perl code?   http://mail.python.org/pipermail/python-list/2007-January/423311.html   Thank You   Regards   Sid -- http://mail.python.org/mailman/listinfo/python-l

Re: strptime and timezones

2008-08-14 Thread Tom Anderson
On Wed, 13 Aug 2008, Christian Heimes wrote: Tom Anderson wrote: Secondly, do you really have to do this just to parse a date with a timezone? If so, that's ridiculous. No, you don't. :) Download the pytz package from the Python package index. It's *the* tool for timezone handling in Python

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread Bruno Desthuilliers
korean_dave a écrit : Still the same output... "same" as what, with what ??? Do yourself (and the world) a favour : learn to quote the posts you're answering to. Here's the actual code... for x in range(0,2): for y in range(0,27): for z in range(0,15):

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread Wojtek Walczak
On Thu, 14 Aug 2008 08:35:15 -0700 (PDT), korean_dave wrote: > Still the same output... > > Here's the actual code... > > for x in range(0,2): > for y in range(0,27): > for z in range(0,15): > print(str(x) + " " + str(y) + " " + str(z)) This code won't produ

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread korean_dave
hahah true. Sorry folks. I am running a third party scripting machine that uses python. It's the third-party program that is at fault. More detail involved that you don't need to know, but it's not python's "fault". Sorry for the inconvenience. On Aug 14, 11:47 am, Fredrik Lundh <[EMAIL PROTECTE

Re: a question about mysqldb

2008-08-14 Thread Bruno Desthuilliers
Evan a écrit : a simple problem but I do not know why...:(, could anyone help me? MySQLdb nominally uses just the %s placeholder style, in my script, i got error if you want to use placeholder(%s) for table name: db-api placeholders won't work for table names - or for anything that isn't supp

help with parsing email

2008-08-14 Thread Ahmed, Shakir
Hi all, I do appreciate if any one can help me for my following problem: I need to grab/parse numeric numbers such as app number from incoming emails stored in Microsoft Outlook (Microsoft Exchange server) with specified subject line. Any help with the python script is highly appreciat

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread Fredrik Lundh
korean_dave wrote: Still the same output... > Here's the actual code... for x in range(0,2): for y in range(0,27): for z in range(0,15): print(str(x) + " " + str(y) + " " + str(z)) umm. that's even less related to your original output than your earli

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: a question about mysqldb

2008-08-14 Thread Fredrik Lundh
Evan wrote: a simple problem but I do not know why...:(, could anyone help me? MySQLdb nominally uses just the %s placeholder style, in my script, i got error if you want to use placeholder(%s) for table name: Placeholders are supposed to be used for *values*, not other parts of the SQL stat

ActiveState Python v2.5 doesn't come with Tkinter or Tk installed.

2008-08-14 Thread Dudeja, Rajat
Hi, So, now I've finally started using Eclipse and PyDev as an IDE for my GUI Application. I just wrote some sample programs as an hands on. Now I would like to take up Tkinter. I'm using Active State Python version 2.5 and found that there is not Tkinter and Tk module in it. To use Tkinter do I

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread korean_dave
Still the same output... Here's the actual code... for x in range(0,2): for y in range(0,27): for z in range(0,15): print(str(x) + " " + str(y) + " " + str(z)) -- http://mail.python.org/mailman/listinfo/python-list

RE: How do I organize my Python application code?

2008-08-14 Thread Dudeja, Rajat
>>Fredrik Lundh wrote: >> That's all there is; there's no header files or declaration files or >> explicitly maintained object files etc; the program itself is just a >> bunch of Python files. >I would simply add that if your python script produces one or more output files (for example a text

a question about mysqldb

2008-08-14 Thread Evan
a simple problem but I do not know why...:(, could anyone help me? MySQLdb nominally uses just the %s placeholder style, in my script, i got error if you want to use placeholder(%s) for table name: + >>> str="select tID,tNote from %s wher

Re: Replace Several Items

2008-08-14 Thread Gewton Jhames
thanks, guys. On Thu, Aug 14, 2008 at 7:35 AM, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > On 2008-08-13 23:54, John Krukoff wrote: > >> On Wed, 2008-08-13 at 09:39 -0700, gjhames wrote: >> >>> I wish to replace several characters in my string to only one. >>> Example, "-", "." and "/" to nothing

Re: Factory for Struct-like classes

2008-08-14 Thread Larry Bates
eliben wrote: Hello, I want to be able to do something like this: Employee = Struct(name, salary) And then: john = Employee('john doe', 34000) print john.salary Basically, Employee = Struct(name, salary) should be equivalent to: class Employee(object): def __init__(self, name, salary):

Re: i want to control python using keyboard

2008-08-14 Thread Larry Bates
[EMAIL PROTECTED] wrote: hi i want to play alarm sound when i press a particular key in keyboard.so someone help me in doing it. Thanks and Regards Sasil.G When you post to this list you need to give us more to go on than you have. 1) What have you tried that doesn't work? 2) What type of s

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Jean-Paul Calderone
On Thu, 14 Aug 2008 16:41:57 +0200, Thomas Guettler <[EMAIL PROTECTED]> wrote: auto increment: Here's one way class Sequence(Persistence): def __init__(self): self.current = 0 def next(self): self.current += 1 return self.current ticketSequ

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread Bruno Desthuilliers
korean_dave a écrit : for y in range(0,iNumItems): print(str(y)) How do i make the output go IN ORDER 0 1 2 3 4 5 6 etc. instead of 0 1 10 11 12 13 14 2 3 4 5 6 7 8 9 Your code doesn't expose this problem: [EMAIL PROTECTED]:~$ python Python 2.5.1 (r251:54863, Mar 7 2008, 03:41:45) [GCC 4.1

Re: for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread Larry Bates
korean_dave wrote: for y in range(0,iNumItems): print(str(y)) How do i make the output go IN ORDER 0 1 2 3 4 5 6 etc. instead of 0 1 10 11 12 13 14 2 3 4 5 6 7 8 9 That's not what it does on my system (Python 2.5.2 on Windows). Please post the code that you are "actually" running. >>> fo

RE: Fixed-length text file to database script

2008-08-14 Thread Edwin . Madari
here is a working code snippet to read from MySQL db. python tutorial has examples of reading from files. put them together to do your task. === import MySQLdb con = MySQLdb.connect(host='127.0.0.1', port=4321, user='joe', passwd='shmoe', db='t

Re: Tkinter updates - Easiest way to install/use Tile?

2008-08-14 Thread Guilherme Polo
On Wed, Aug 13, 2008 at 2:10 PM, Mudcat <[EMAIL PROTECTED]> wrote: > So I haven't programmed much in Python the past couple of years and > have been catching up the last few days by reading the boards. I'll be > making commercial Python applications again and wanted to see what's > new in the Gui d

Re: xlrd cell background color

2008-08-14 Thread patrick . waldo
Thank you very much. I did not know there was a python-excel group, which I will certainly take note of in the future. The previous post answered my question, but I wanted to clarify the difference between xf.background.background_colour_index, xf.background.pattern_colour_index, and book.colour_

for y in range (0,iNumItems)--> not in order?

2008-08-14 Thread korean_dave
for y in range(0,iNumItems): print(str(y)) How do i make the output go IN ORDER 0 1 2 3 4 5 6 etc. instead of 0 1 10 11 12 13 14 2 3 4 5 6 7 8 9 -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Thomas Guettler
auto increment: Here's one way class Sequence(Persistence): def __init__(self): self.current = 0 def next(self): self.current += 1 return self.current ticketSequence = Sequence() class Ticket(Persistence): def __init__(self):

Re: Trying ZODB, background in Relational: mimic auto_increment?

2008-08-14 Thread Jean-Paul Calderone
On Thu, 14 Aug 2008 16:15:11 +0200, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Jean-Paul Calderone wrote: On Thu, 14 Aug 2008 05:22:35 -0700 (PDT), Phillip B Oldham <[EMAIL PROTECTED]> wrote: [snip] How would one assign a unique ID to the root at that point? Here's one way class Se

  1   2   >