drawingarea problem

2006-08-16 Thread Rafał Janas
Is somebody try to paint filled boxes in drawingarea? I don't know how to paint line or someting like this. Maybe somebody have tutorial or samples? Thanks Rafal -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with async xmlrpc design

2006-08-16 Thread Amit Khemka
On 8/17/06, David Hirschfield <[EMAIL PROTECTED]> wrote: > I have an xmlrpc client/server system that works fine, but I want to > improve performance on the client side. > > Right now the system operates like this: > > client makes request from server (by calling server.request() via xml-rpc) > ser

Re: Adding a char inside path string

2006-08-16 Thread Anthra Norell
Hitesh, You might want to try this: >>> tricky_path_name = '\\serverName\\C:\\exe files\\example.exe -u ABC -g DEF' >>> import SE >>> Editor = SE.SE ('C:=C$: "exe -=exe"') >>> edited_path_name = Editor (tricky_path_name) >>> print edited_path_name# See what it did \serverName\C$:\exe fil

Re: wxPython Grid Question

2006-08-16 Thread jean-michel bain-cornu
Hi, Jordan a écrit : > Hey Peoples, > I'm wonderg if there is a way to make a subclass of wx.grid.Grid in > which the coloumn labels for the grid appear on the bottom of the grid > instead of the top. > > 1 2 3 4 5 > a| | | | | | > b| | | | | | > c| | | | | | > d|

Re: Newbie needs Help

2006-08-16 Thread John Machin
Dennis Lee Bieber wrote: > c.execute("insert into %s (%s) values (%s)" > % ("statecode", > ", ".join(data.keys() ), > ", ".join(["%s"] * len(data.keys() ) ) ), > data.values() ) > # NOTE: on

Re: Newbie needs Help

2006-08-16 Thread Steve Holden
Steve Holden wrote: [...] > > >>> def insertFromDict(table, d): vector Please ignore the Cygwin mousedroppings ... regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.co

Re: Newbie needs Help

2006-08-16 Thread Steve Holden
len wrote: > Hi all > > I am writing a python program that inserts records into a database on > XP using mxODBC. > > I need to write a section of code which will create the following SQL > command as an example; > > INSERT INTO statecode (state, name) VALUES ('IL', 'Illinois') > > This statemen

wxPython Grid Question

2006-08-16 Thread Jordan
Hey Peoples, I'm wonderg if there is a way to make a subclass of wx.grid.Grid in which the coloumn labels for the grid appear on the bottom of the grid instead of the top. 1 2 3 4 5 a| | | | | | b| | | | | | c| | | | | | d| | | | | | e| | | | | |

Re: Newbie needs Help

2006-08-16 Thread John Machin
[EMAIL PROTECTED] wrote: > Also, it may be easier to use string interpolation, as in: > > return "INSERT INTO statecode (state, name) VALUES ('%(state)s', > '%(name)s')" % insert_dict > > ...after all necessary escaping, of course. > Excuse me!? "statecode" needs to come from the first argument.

MySQLdb installation error

2006-08-16 Thread Yi Xing
I log into the machine remotely. How do I check the Mac OSX version number under command line? Thanks. hiaips rosedb0 at gmail.com Wed Aug 16 01:23:10 CEST 2006 * Previous message: MySQLdb installation error * Next message: What would be the best way to run python client in the backg

Re: Printing n elements per line in a list

2006-08-16 Thread John Machin
Matimus wrote: > Well, I have another at bat, so I will try to redeem myself... using > recursion: > > def printTable(l,c): > print(("%d "*len(l[:c]))%tuple(l[:c])) > if( len(l[:c]) > 0 ): > printTable(l[c:],c) > > printTable(range(1,101),5) Sorry. Recursion disqualified your bat

Re: Newbie needs Help

2006-08-16 Thread johnzenger
Also, it may be easier to use string interpolation, as in: return "INSERT INTO statecode (state, name) VALUES ('%(state)s', '%(name)s')" % insert_dict ...after all necessary escaping, of course. John Machin wrote: > len wrote: > > Hi all > > > > I am writing a python program that inserts records

Re: Newbie needs Help

2006-08-16 Thread John Machin
len wrote: > Hi all > > I am writing a python program that inserts records into a database on > XP using mxODBC. > > I need to write a section of code which will create the following SQL > command as an example; > > INSERT INTO statecode (state, name) VALUES ('IL', 'Illinois') > > This statement wi

Re: Printing n elements per line in a list

2006-08-16 Thread johnzenger
def perline(n): count = 1 while 1: yield (count == n) and "\n" or " " count = count % n + 1 r = range(1,101) p = perline(5) print "".join("%d%s" % (x, p.next()) for x in r) unexpected wrote: > If have a list from 1 to 100, what's the easiest, most elegant way to > print t

Re: no longer can set breakpoint on 'pass' statement?

2006-08-16 Thread Patrick Maupin
I don't know for sure if this is the issue, but Python _used_ to include line number information in the actual codestream (via instructions), and now I think it's a separate table for speed reasons. So perhaps the previous ability to set breakpoints on pass instructions was merely an artifact of c

Re: Printing n elements per line in a list

2006-08-16 Thread Matimus
John Machin wrote: > Matimus wrote: > > unexpected wrote: > > > If have a list from 1 to 100, what's the easiest, most elegant way to > > > print them out, so that there are only n elements per line. > > > > > > So if n=5, the printed list would look like: > > > > > > 1 2 3 4 5 > > > 6 7 8 9 10 > >

Newbie needs Help

2006-08-16 Thread len
Hi all I am writing a python program that inserts records into a database on XP using mxODBC. I need to write a section of code which will create the following SQL command as an example; INSERT INTO statecode (state, name) VALUES ('IL', 'Illinois') This statement will be built up using the foll

Curried class methods?

2006-08-16 Thread Scott Lamb
I'm trying to dynamically generate class methods which have access to some state passed in at creation time. (Basically as a workaround to twisted's trial not having a way to dynamically add stuff. Plain unittest seems to have TestSuite, but the trial runner doesn't know about it.) My first attemp

Re: hide python code !

2006-08-16 Thread enigmadude
I'm pretty sure that just because someone is familiar with the PGP sources, for example, doesn't mean that they have the necessary keys to access other people's data across the internet. Also, I'm pretty sure I know how a prison door lock works, but if I'm behind bars and don't have the key, I'm st

Help with async xmlrpc design

2006-08-16 Thread David Hirschfield
I have an xmlrpc client/server system that works fine, but I want to improve performance on the client side. Right now the system operates like this: client makes request from server (by calling server.request() via xml-rpc) server places "request" on queue and returns a unique ID to the calling

Re: How do I catch ExpatError exception?

2006-08-16 Thread Shuaib
Steve Holden wrote: > import xml.parsers.expat Thanks, that worked. > > def r(): >return 1/0 > > try: >print r() > except: >import sys >t, v, tb = sys.exc_info() > > print "exception on line", tb.tb_lineno How do I get the helpful text that is thrown with the exception? Like i

Python and SAFEARRAY

2006-08-16 Thread bumperdoc
Hi I'm using win32com.client to dispatch a COM serverone of the interface methods has the below parameter: ..., [in, out] SAFEARRAY(BYTE) *Buffer, ... This method goes and queries something and puts it in this buffer...how can I use this method in Python? What type of variable needs to be pa

Re: PySequence_SetItem

2006-08-16 Thread Jack Diederich
On Wed, Aug 16, 2006 at 05:13:23PM -0700, John Machin wrote: > > Jack Diederich wrote: > > On Wed, Aug 16, 2006 at 03:25:39PM -0700, John Machin wrote: > > > > > > > > > > > Not the OP's problem, but a bug in the manual: example in the chapter > > > > > that the OP was reading acts as though the

Re: How do I catch ExpatError exception?

2006-08-16 Thread Steve Holden
Shuaib wrote: > Hey! > > I am getting this exception. > > xml.parsers.expat.ExpatError > > But I am not able to catch it with "except > xml.parsers.expat.ExpatError:" It says "NameError: global name 'xml' is > not defined". > > I am also not able to catch it with "except ExpatError:" Gives > "N

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread John Machin
Ant wrote: > > > Are you sure ps is reporting in bytes not KB? The bare interpreter in > > > Windows is 3368KB. > > > > Where did you get that from? With Python 2.4.3, on my machine (Win XP > > SP2): > > > > C:\junk>dir \python24\python* > > [snip] > > 29/03/2006 05:35 PM 4,608 python

Re: Global Objects...

2006-08-16 Thread Dan
KraftDiner wrote: > I have a question.. > > myGlobalDictionary = dictionary() > > > class someClass: >def __init__(self): > self.x = 0; >def getValue(self, v) > myGlobalDictionary.getVal(v) > > > myGlobalDictionary doesn't seem to be visible to my someClass methods. > Why?

Re: PySequence_SetItem

2006-08-16 Thread John Machin
Jack Diederich wrote: > On Wed, Aug 16, 2006 at 03:25:39PM -0700, John Machin wrote: > > > > > > > > Not the OP's problem, but a bug in the manual: example in the chapter > > > > that the OP was reading acts as though the 2nd arg to PyObject_SetItem > > > > is a C int (as it is for the List and S

Re: How do I catch ExpatError exception?

2006-08-16 Thread Mark Winrock
Shuaib wrote: > Hey! > > I am getting this exception. > > xml.parsers.expat.ExpatError > > But I am not able to catch it with "except > xml.parsers.expat.ExpatError:" It says "NameError: global name 'xml' is > not defined". > > I am also not able to catch it with "except ExpatError:" Gives > "N

Re: python-dev and setting up setting up f2py on Windows XP

2006-08-16 Thread John Machin
Sile wrote: > Hi, > > I've been trying to get f2py working on Windows XP, I am using Python > 2.3. I'm new to python so I'm not too sure what I'm doing yet. I need > the python-dev package to run f2py. I have been told this is just the > header files and .dll and I need to put them somewhere my C c

no longer can set breakpoint on 'pass' statement?

2006-08-16 Thread Mark Winrock
Can someone point me to some documentation as to why pdb breakpoints are not working on 'pass' statements (at least on 2.4.1)? I was used to that working in the 2.2.3 build I was using up to this last year. I just cant seem to find anything on it. Thanks! -- http://mail.python.org/mailman/list

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Tim Williams
On 17/08/06, Tim Williams <[EMAIL PROTECTED]> wrote: > On 16 Aug 2006 15:23:06 -0700, fuzzylollipop <[EMAIL PROTECTED]> wrote: > > I want to do email address format validations, without turning to ANTLR > > or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. > > Most of the ones I

Re: PySequence_SetItem

2006-08-16 Thread Jack Diederich
On Wed, Aug 16, 2006 at 03:25:39PM -0700, John Machin wrote: > > Jack Diederich wrote: > > On Wed, Aug 16, 2006 at 02:39:24PM -0700, John Machin wrote: > > > > > > Jack Diederich wrote: > > > > > > > Changing the PySequence_SetItem to PyList_SetItem and dropping the > > > > DECREF works for me too

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Tim Williams
On 16 Aug 2006 15:23:06 -0700, fuzzylollipop <[EMAIL PROTECTED]> wrote: > I want to do email address format validations, without turning to ANTLR > or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. > Most of the ones I have found from google searches are not really as > robust as

How do I catch ExpatError exception?

2006-08-16 Thread Shuaib
Hey! I am getting this exception. xml.parsers.expat.ExpatError But I am not able to catch it with "except xml.parsers.expat.ExpatError:" It says "NameError: global name 'xml' is not defined". I am also not able to catch it with "except ExpatError:" Gives "NameError: global name 'xml' is not def

Re: Calling a python script, and getting the returned result in C

2006-08-16 Thread Shuaib
John Machin wrote: > > Then you need to read the Python manuals (surprise, surprise); in > particular here's a section that gives you most if not all of what you > want : > > http://docs.python.org/ext/pure-embedding.html > > but I'd suggest that you start reading a few pages back from there. > >

Re: Printing n elements per line in a list

2006-08-16 Thread John Machin
Matimus wrote: > unexpected wrote: > > If have a list from 1 to 100, what's the easiest, most elegant way to > > print them out, so that there are only n elements per line. > > > > So if n=5, the printed list would look like: > > > > 1 2 3 4 5 > > 6 7 8 9 10 > > 11 12 13 14 15 > > etc. > > > > My

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Simon Forman
fuzzylollipop wrote: > I want to do email address format validations, without turning to ANTLR > or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. > Most of the ones I have found from google searches are not really as > robust as I need them to be. Would email.Utils.parseaddr()

Re: How to delete a directory tree in FTP

2006-08-16 Thread ray223
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! Have a look at rmtree in ftp

Re: Mega Newbie Questions: Probably FAQs

2006-08-16 Thread Peter Decker
On 8/15/06, Zeph <[EMAIL PROTECTED]> wrote: > > Framework for what kind of apps? Web, native GUI, client-server, etc? > > MVC is an abstract architecture rather than a specific implementation. > > Even so, many implementations rarely employ a purely MVC design. > > Native GUI with some client-serve

Re: Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread Jean-Paul Calderone
On 16 Aug 2006 16:09:39 -0700, Simon Forman <[EMAIL PROTECTED]> wrote: >fuzzylollipop wrote: >> I want to do email address format validations, without turning to ANTLR >> or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. >> Most of the ones I have found from google searches are n

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: Inheritting Built In Types

2006-08-16 Thread Farshid Lashkari
Digital Logic wrote: > Am I checking for the slice object incorrectly? That's the only thing > I can think of. Yes. The slice object is the "i" variable in your code, not the "data" variable. -Farshid -- http://mail.python.org/mailman/listinfo/python-list

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: Calling a python script, and getting the returned result in C

2006-08-16 Thread John Machin
Shuaib wrote: > John Machin wrote: > > Shuaib wrote: > > > Hi! > > > > > > I have a python script which returns an Integer value. How do I call > > > this script from a C programe, and use the result returned? > > > > To avoid confusion and possible irrelevant responses, please say which > > of th

Re: Printing n elements per line in a list

2006-08-16 Thread Matimus
unexpected wrote: > If have a list from 1 to 100, what's the easiest, most elegant way to > print them out, so that there are only n elements per line. > > So if n=5, the printed list would look like: > > 1 2 3 4 5 > 6 7 8 9 10 > 11 12 13 14 15 > etc. > > My search through the previous posts yields

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-16 Thread John Machin
Simon Forman wrote: > The entire post was meant as a pedantic exercise illustrating what not > to do (and how easy it is to figure that out with an interactive > session,) and sketching how to raise and check for an error instead. > Lessons usually start with the teacher asserting authority and

Re: Calling a python script, and getting the returned result in C

2006-08-16 Thread Shuaib
John Machin wrote: > Shuaib wrote: > > Hi! > > > > I have a python script which returns an Integer value. How do I call > > this script from a C programe, and use the result returned? > > To avoid confusion and possible irrelevant responses, please say which > of the following options best matches

Re: os.path.normpath

2006-08-16 Thread Graham Dumpleton
Hari Sekhon wrote .. > [EMAIL PROTECTED] wrote: > > [EMAIL PROTECTED] wrote: > > > >> I am using a windows box and passing a string like "../foo/../foo2" > to > >> normpath which then returns "..\\foo2". But if this string is going > >> into a webpage link it should really be "../foo". > >> > >>

Re: Calling a python script, and getting the returned result in C

2006-08-16 Thread John Machin
Shuaib wrote: > Hi! > > I have a python script which returns an Integer value. How do I call > this script from a C programe, and use the result returned? To avoid confusion and possible irrelevant responses, please say which of the following options best matches your requirement: (a) your Pytho

Re: PySequence_SetItem

2006-08-16 Thread John Machin
Jack Diederich wrote: > On Wed, Aug 16, 2006 at 02:39:24PM -0700, John Machin wrote: > > > > Jack Diederich wrote: > > > > > Changing the PySequence_SetItem to PyList_SetItem and dropping the > > > DECREF works for me too (PyList functions steal a reference). I also > > > tried setting the list t

Anyone have a link handy to an RFC 821 compliant email address regex for Python?

2006-08-16 Thread fuzzylollipop
I want to do email address format validations, without turning to ANTLR or pyparsing, anyone know of a regex that is COMPLIANT with RFC 821. Most of the ones I have found from google searches are not really as robust as I need them to be. -- http://mail.python.org/mailman/listinfo/python-list

Re: PySequence_SetItem

2006-08-16 Thread John Machin
John Machin wrote: > Jack Diederich wrote: > > > Changing the PySequence_SetItem to PyList_SetItem and dropping the > > DECREF works for me too (PyList functions steal a reference). I also > > tried setting the list to length 1, still no dice. The PySequence > > version segs under 2.4 and 2.5.

Re: Calling a python script, and getting the returned result in C

2006-08-16 Thread [EMAIL PROTECTED]
Shuaib wrote: > Hi! > > I have a python script which returns an Integer value. How do I call > this script from a C programe, and use the result returned? > > Thanks for your time. This is actually a C question, not a Python question. If all you need is the return value of the program, consider l

Re: PySequence_SetItem

2006-08-16 Thread Jack Diederich
On Wed, Aug 16, 2006 at 02:39:24PM -0700, John Machin wrote: > > Jack Diederich wrote: > > > Changing the PySequence_SetItem to PyList_SetItem and dropping the > > DECREF works for me too (PyList functions steal a reference). I also > > tried setting the list to length 1, still no dice. The PyS

Re: inheritance?

2006-08-16 Thread John Henry
Oops! Forgot to remove fromfile from baseClass. Wouldn't matter though. John Henry wrote: > > Here I tried this example and maybe this will explain the difficulties > > I'm having. > > 1) at the time the baseClass is constructed shouldn't the constructor > > of the appropriate > > type be called

Re: inheritance?

2006-08-16 Thread John Henry
> Here I tried this example and maybe this will explain the difficulties > I'm having. > 1) at the time the baseClass is constructed shouldn't the constructor > of the appropriate > type be called. Not automatically. > 2) getName is doing nothing... > > class baseClass: > def __init__(sel

Calling a python script, and getting the returned result in C

2006-08-16 Thread Shuaib
Hi! I have a python script which returns an Integer value. How do I call this script from a C programe, and use the result returned? Thanks for your time. -- http://mail.python.org/mailman/listinfo/python-list

Inheritting Built In Types

2006-08-16 Thread Digital Logic
I am attempting build an object which inherits from the built in list object. Essentially I need to do something every time data is added or changed in a list. I have all the over ridding functions working excepting for the functions that over ride the "set slice" functionalitity. For example:

Re: PySequence_SetItem

2006-08-16 Thread John Machin
Jack Diederich wrote: > Changing the PySequence_SetItem to PyList_SetItem and dropping the > DECREF works for me too (PyList functions steal a reference). I also > tried setting the list to length 1, still no dice. The PySequence > version segs under 2.4 and 2.5. It segs even when the Int is c

Re: PySequence_SetItem

2006-08-16 Thread Jack Diederich
On Wed, Aug 16, 2006 at 01:45:44PM -0700, John Machin wrote: > Bill Pursell wrote: > > Bill Pursell wrote: > > > > Also note that the problem goes away if I replace > > the call to PySequence_SetItem with: > > PySequence_SetItem(l, 0, PyInt_FromLong(1L)); > > Are you sure? It should make absolut

Re: It is __del__ calling twice for some instances?

2006-08-16 Thread Max Yuzhakov
Duncan Booth пишет: DB> Not with the code which you gave as an example, but in the general case DB> yes, the only guarantee that Python gives about the __del__ method on an DB> instance is that it will be called zero, one or more than one times during DB> the run of the program. In pra

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
There was a typo. I corrected it. Hitesh wrote: > How about this: > > def TruncateString(s, Tindex): > return string.ljust(s,Tindex){:Tindex] > > > s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g > > XYZ' > try: > Sindex = s.find(".exe") > if Sindex > 0: >

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
How about this: def TruncateString(s, Tindex): return string.ljust(s,Tindex){:Tindex] s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g XYZ' try: Sindex = s.find(".exe") if Sindex > 0: Sindex = Tindex + 4 s1 = TruncateString(s, Sindex) except:

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
I post a crappy solution but I can add few more stuff to make it fail proof. i.e. I can search for ".exe -u" But if someone names folder like "folder.exe u". This script could fail. Or if in padded garbase I get ".exe u" These are two known issues I have to takcle. Thanks everyone for your help.

Re: Adding a char inside path string

2006-08-16 Thread Grant Edwards
On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote: > > Here is a mediocare solution. > > def TruncateString(s, Tindex): > return string.ljust(s,Tindex){:Tindex] > > s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g > XYZ' > Sindex = s.find(".exe") > Sindex = Tindex +4 > s1 =

Re: Adding a char inside path string

2006-08-16 Thread Grant Edwards
On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote: > anything after .exe should be truncated (or deleted). That will fail if any directory names contain the string ".exe", but if that's what you want, it's trivial enough: for s in ["asdfasdf.exe -u", "soemthing/else", "asdf.exe/qwerqwer/qwerqwer.

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
Here is a mediocare solution. def TruncateString(s, Tindex): return string.ljust(s,Tindex){:Tindex] s = '\\serverName\\C:\\Folder Name1\\FolderName2\\example.exe -u ABC -g XYZ' Sindex = s.find(".exe") Sindex = Tindex +4 s1 = TruncateString(s, Sindex) Hitesh wrote: > anything after .exe sh

Re: PySequence_SetItem

2006-08-16 Thread John Machin
Bill Pursell wrote: > Bill Pursell wrote: > > Also note that the problem goes away if I replace > the call to PySequence_SetItem with: > PySequence_SetItem(l, 0, PyInt_FromLong(1L)); Are you sure? It should make absolutely no difference. My experience so far: 1. crashes in call to PySequence_Se

Re: hide python code !

2006-08-16 Thread danielx
Steven D'Aprano wrote: > On Tue, 15 Aug 2006 09:00:16 -0700, Ben Sizer wrote: > > > Yes, in much the same way that there is no point ever locking your > > doors or installing burglar alarms, as a determined thief will > > eventually steal your belongings. > > That's an utterly pointless and foolish

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
anything after .exe should be truncated (or deleted). Grant Edwards wrote: > On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote: > > > That might work but what if I get (in future) a path name where > > foldername (and in windows it is very common, someone might name a > > folder something like "Sc

Re: Adding a char inside path string

2006-08-16 Thread Grant Edwards
On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote: > That might work but what if I get (in future) a path name where > foldername (and in windows it is very common, someone might name a > folder something like "Screw You") with space? You must come up with a rigorous specification for what is and i

Re: trouble understanding inheritance...

2006-08-16 Thread KraftDiner
Simon Brunning wrote: > On 16 Aug 2006 12:53:12 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: > > I can see that this might work... > > c = [a, b] > > for c in [a,b]: > >c.getName() > > > > but when does baseClass ever get used? > > Why did i even have to define it? > > Well, quite. > I agree..

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
>>> s = '\\serverName\C:\Folder Name1\FolderName2\example.exe -u ABC -g XYZ' >>> p = s.split(" ", 1)[0] >>> p '\\serverName\\C:\\Folder' hj Larry Bates wrote: > Sounds like you can split the string on a space and throw > away the right side: > > s='\\serverName\C:\FolderName1\FolderName2\exampl

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
That might work but what if I get (in future) a path name where foldername (and in windows it is very common, someone might name a folder something like "Screw You") with space? Larry Bates wrote: > Sounds like you can split the string on a space and throw > away the right side: > > s='\\server

Re: Adding a char inside path string

2006-08-16 Thread Larry Bates
Sounds like you can split the string on a space and throw away the right side: s='\\serverName\C:\FolderName1\FolderName2\example.exe' -u ABC -g XYZ p=s.split(" ", 1)[0] print p '\\serverName\C:\FolderName1\FolderName2\example.exe' Larry Bates Hitesh wrote: > > > Hi, > > Everything is workin

Re: trouble understanding inheritance...

2006-08-16 Thread Simon Brunning
On 16 Aug 2006 12:53:12 -0700, KraftDiner <[EMAIL PROTECTED]> wrote: > I can see that this might work... > c = [a, b] > for c in [a,b]: >c.getName() > > but when does baseClass ever get used? > Why did i even have to define it? Well, quite. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.b

Re: trouble understanding inheritance...

2006-08-16 Thread KraftDiner
Simon Forman wrote: > KraftDiner wrote: > > Fredrik Lundh wrote: > > > KraftDiner wrote: > > > > > > > This is not working the way I think it should > > > > it would appear that fromfile and getName are calling the baseClass > > > > methods which are > > > > simple passes What have I done

Re: Adding a char inside path string

2006-08-16 Thread Hitesh
Hi, Everything is working fine and dandy but I ran across another issue here. Some of the path comes with some extra chars padded at the end. i.e. '\\serverName\C:\FolderName1\FolderName2\example.exe' -u ABC -g XYZ abcdef Now those padded chars are not constant all the time. It can be anythin

Re: getting database column names from query

2006-08-16 Thread skip
Jason> I'm using MySQLdb and can connect and issue queries that return Jason> result sets, but I how do I get the column names for those result Jason> sets? >>> c = MySQLdb.connect(*creds) >>> k = c.cursor() >>> k.execute("select * from account") 3L >>> k.fetchall

Re: getting database column names from query

2006-08-16 Thread Bob Kline
Jason Nordwick wrote: > I'm using MySQLdb and can connect and issue queries that return result > sets, but I how do I get the column names for those result sets? [d[0] for d in k.description] Cheers, Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: getting database column names from query

2006-08-16 Thread Simon Forman
Jason Nordwick wrote: > I'm using MySQLdb and can connect and issue queries that return result sets, > but I how do I get the column names for those result sets? > > >>> c = MySQLdb.connect(*creds) > >>> k = c.cursor() > >>> k.execute("select * from account") > 3L > >>> k.fetchall() > ((1L, 'test'

Re: Documentation Question About Depricated String Functions

2006-08-16 Thread Hitesh
Thank you guys. hj Duncan Booth wrote: > Hitesh wrote: > > > In python doc -- 4.1.4 Deprecated string functions -- I read that "The > > following list of functions are also defined as methods of string and > > Unicode objects; see ``String Methods'' (section 2.3.6) for more > > information on t

Re: It is __del__ calling twice for some instances?

2006-08-16 Thread Duncan Booth
Max Yuzhakov wrote: > It is correct behaviour for python to call __del__ on some > identity of a class object more than once? Not with the code which you gave as an example, but in the general case yes, the only guarantee that Python gives about the __del__ method on an instance is that it will

getting database column names from query

2006-08-16 Thread Jason Nordwick
I'm using MySQLdb and can connect and issue queries that return result sets, but I how do I get the column names for those result sets? >>> c = MySQLdb.connect(*creds) >>> k = c.cursor() >>> k.execute("select * from account") 3L >>> k.fetchall() ((1L, 'test', -1L), (2L, 'Test', -1L), (3L, 'Test2'

Re: trouble understanding inheritance...

2006-08-16 Thread Simon Forman
KraftDiner wrote: > Fredrik Lundh wrote: > > KraftDiner wrote: > > > > > This is not working the way I think it should > > > it would appear that fromfile and getName are calling the baseClass > > > methods which are > > > simple passes What have I done wrong? > > > > > > class baseClass: >

Re: Documentation Question About Depricated String Functions

2006-08-16 Thread Simon Forman
Hitesh wrote: > Hi, > > In python doc -- 4.1.4 Deprecated string functions -- I read that "The > following list of functions are also defined as methods of string and > Unicode objects; see ``String Methods'' (section 2.3.6) for more > information on those. You should consider these functions as >

Re: PySequence_SetItem

2006-08-16 Thread Bill Pursell
Bill Pursell wrote: > The following code is pretty much straight out of > section 1.2.1.1 of the Python/C reference manual: > > #include > > int > main(void) > { > PyObject *l, *x; > > Py_Initialize(); > > l = PyList_New(3); > x = PyInt_FromLong(1L); > > if

Re: Documentation Question About Depricated String Functions

2006-08-16 Thread Duncan Booth
Hitesh wrote: > In python doc -- 4.1.4 Deprecated string functions -- I read that "The > following list of functions are also defined as methods of string and > Unicode objects; see ``String Methods'' (section 2.3.6) for more > information on those. You should consider these functions as > deprec

Re: inheritance?

2006-08-16 Thread Inyeol Lee
On Wed, Aug 16, 2006 at 11:07:08AM -0700, KraftDiner wrote: [...] > Here I tried this example and maybe this will explain the difficulties > I'm having. > 1) at the time the baseClass is constructed shouldn't the constructor > of the appropriate > type be called. > 2) getName is doing nothing... >

PySequence_SetItem

2006-08-16 Thread Bill Pursell
The following code is pretty much straight out of section 1.2.1.1 of the Python/C reference manual: #include int main(void) { PyObject *l, *x; Py_Initialize(); l = PyList_New(3); x = PyInt_FromLong(1L); if (l == NULL || x == NULL) { PyE

Re: trouble understanding inheritance...

2006-08-16 Thread KraftDiner
Fredrik Lundh wrote: > KraftDiner wrote: > > > This is not working the way I think it should > > it would appear that fromfile and getName are calling the baseClass > > methods which are > > simple passes What have I done wrong? > > > > class baseClass: > > def __init__(self, type): >

Re: Error with: pickle.dumps(numpy.float32)

2006-08-16 Thread Iljya
Thanks, Ziga I have submitted the bug to http://projects.scipy.org/scipy/numpy I am using the following workaround for now: >>> import numpy >>> import pickle >>> import __builtin__ >>> __builtin__.float32_arrtype = numpy.float32 >>> pickle.dumps(numpy.float32) 'c__builtin__\nfloat32_arrtype\np0

Re: Adding a char inside path string

2006-08-16 Thread Tim Williams
On 16 Aug 2006 10:30:26 -0700, Hitesh <[EMAIL PROTECTED]> wrote: > > Thank you all it worked!. > > Tim, > > > modRows = ['\\'+itm[0].replace(":", "$") for itm in rows] > > What are those two forward slashes for? Hi Hitesh, \ is an escape character, it can give unexpected results depending on t

Documentation Question About Depricated String Functions

2006-08-16 Thread Hitesh
Hi, In python doc -- 4.1.4 Deprecated string functions -- I read that "The following list of functions are also defined as methods of string and Unicode objects; see ``String Methods'' (section 2.3.6) for more information on those. You should consider these functions as deprecated, although they

Re: It is __del__ calling twice for some instances?

2006-08-16 Thread Fredrik Lundh
Max Yuzhakov wrote: > This is a sample code for clearness: that code snippet doesn't create any foo() instances, what I can see... -- http://mail.python.org/mailman/listinfo/python-list

Re: Clean way to not get object back from instantiation attempt gone bad

2006-08-16 Thread Simon Forman
John Machin wrote: > Simon Forman wrote: > > > > > |>> class f: > > ... def __init__(self): > > ... del self > > Of course nothing happens. Args are local variables. 'self' is is a > vanilla arg of a vanilla function. I know. > > ... > > |>> e = f() > > |>> e > > <__main__.f insta

Re: trouble understanding inheritance...

2006-08-16 Thread Fredrik Lundh
KraftDiner wrote: > This is not working the way I think it should > it would appear that fromfile and getName are calling the baseClass > methods which are > simple passes What have I done wrong? > > class baseClass: > def __init__(self, type): > if type == 'A': >

Re: sending mailing list with smtplib

2006-08-16 Thread 3KWA
3KWA wrote: > Just for education purposes (mine I guess :P) what was the idea behind > that design decision? >From the doc (self education :P) The following methods implement a mapping-like interface for accessing the message's RFC 2822 headers. Note that there are some semantic differences bet

Problems with Sizers

2006-08-16 Thread Mario Lacunza
Hello, I have troubbles in this code when I try to resize the form, all the widgets dont move. Any idea? Thansk in advance! - # -*- coding: utf8 -*-# #Boa:Dialog:frmPostales import wx #import modGlobals #from Conect

Re: It is __del__ calling twice for some instances?

2006-08-16 Thread Max Yuzhakov
Max Yuzhakov writes: MY> print "difference = %d" % init_cnt-del_cnt Little correction. print "difference = %d" % (init_cnt-del_cnt) -- GMT More Then ... -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >