Re: Sets in Python

2007-09-19 Thread Paddy
On Sep 19, 1:59 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Sep 18, 5:39 pm, sapsi <[EMAIL PROTECTED]> wrote: > > > I recently tried using the set function in Python and was surprised to > > find that > > > a=[ 1, 2,3, [1,2] ] > > > doesn't work with 'set', throwing TyperError (unhashable

Re: Tutorial or Example (or Tutorial) of Using Canvas to Produce a Plot

2007-09-19 Thread exhuma.twn
On Sep 18, 11:58 pm, Richard Townsend <[EMAIL PROTECTED]> wrote: > On Tue, 18 Sep 2007 13:18:36 -0700, "W. Watson" > > <[EMAIL PROTECTED]> wrote: > >Tk is it. I'm really not interested in the others at this point. > > John Grayson's book 'Python and Tkinter Programming' has a chapter on > plotting

Re: Troubleshooting installing new package

2007-09-19 Thread nickel_and_dime_2death
On Sep 13, 8:10 pm, "Gheorghe Postelnicu" <[EMAIL PROTECTED]> wrote: > Hi, > > I have Python 2.5 installed on WinXP and I am trying to install a new > package. I ran thesetup.pybuild and I get the following message: > > C:\packages\reedsolomon-0.1>setup.pybuild > running build > running build_ext >

Re: Using python to create windows apps that everyone can use?

2007-09-19 Thread exhuma.twn
On Sep 18, 9:22 pm, "Matt McCredie" <[EMAIL PROTECTED]> wrote: > On 9/18/07, Thomas Harding <[EMAIL PROTECTED]> wrote: > > > Hi guys, sorry to post another topic on this, as I am aware that it has > > already been posted a few times, but not with specifically what I am looking > > for. I want an ap

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Ben Finney <[EMAIL PROTECTED]> writes: > Hrvoje Niksic <[EMAIL PROTECTED]> writes: > >> class X(Y): >> def foo(self): >> super(X, self).foo() >> >> ...there is in fact no guarantee that super() calls a superclass of >> X. However, it is certainly guaranteed that it will call a superclass >

Re: Sets in Python

2007-09-19 Thread Francesco Guerrieri
On 9/19/07, Paddy <[EMAIL PROTECTED]> wrote: > frozenset over turning the embedded list into a tuple? > The tuple would preserve order in the item (1,2) > a = set([1,2,3, (1,2)]) The OP was probably thinking in mathematical terms as in "the set of all the possible subsets of the set composed b

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Ben Finney <[EMAIL PROTECTED]> writes: > Evan is claiming that "the next class in the MRO _is_ a superclass", > apparently by his definition or some other that I've not seen. The definition of superclass is not the issue, the issue is "superclass *of which class*"? You expect super(A, self) to i

Re: Extracting xml from html

2007-09-19 Thread Stefan Behnel
George Sakkis wrote: > Given that you can do in 2 lines what > took you around 15 with lxml, I wouldn't think it twice. Don't judge a tool by beginner's code. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Help, I'm going mad with this

2007-09-19 Thread Peter Otten
azrael wrote: > Help, I'm going mad with this Is "Otsu threshold algorithm" to boring as a subject? > Meanwhile I tried about 5 different implementations of the otsu > threshold algorithm. I'll go mad. > Please help me. I don't know what to do. I even tried to implement it > from c and java, but

help, I'll go crazy

2007-09-19 Thread azrael
Some time ago I started a thread about the Otsu Threshold. Well I didn' manage to make any progress to acomplish this task. I tried to implement it from other Languages including Java and C. Well, this is the example list. histogram=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

Re: Pseudo-Private Class Attributes

2007-09-19 Thread Bruno Desthuilliers
Ricardo Aráoz a écrit : > That is self.__attributes > > Been reading about the reasons to introduce them and am a little > concerned. As far as I understand it if you have a class that inherits > from two other classes which have both the same name for an attribute > then you will have a name clas

Re: Creating OpenOffice doc's

2007-09-19 Thread hemanth
Go to http://ooolib.sourceforge.net/ and download the Python version and unzip the file. There are a few examples illustrating various features. I have used this to create simple OO spreadsheets. Regards, Hemanth Sethuram -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting xml from html

2007-09-19 Thread Laurent Pointal
[EMAIL PROTECTED] a écrit : > On Sep 18, 1:56 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> I am attempting to extract some XML from an HTML document that I get >>> returned from a form based web page. For some reason, I cannot figure >>> out how to do this. >>> Here'

lxml codespeak pages empty ?

2007-09-19 Thread Laurent Pointal
I can no longer get codespeak's lxml page at http://codespeak.net/lxml/ (get an empty HTML document )... Am-I alone in this case ? Any codespeaker reading ? A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list

Re: Extracting xml from html

2007-09-19 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Does this make sense? It works pretty well, but I don't really > understand everything that I'm doing. > > def Parser(filename): It's uncommon to give a function a capitalised name, unless it's a factory function (which this isn't). > parser = etree.HTMLParser() >

Re: lxml codespeak pages empty ?

2007-09-19 Thread Stefan Behnel
Laurent Pointal wrote: > I can no longer get codespeak's lxml page at http://codespeak.net/lxml/ > (get an empty HTML document Transitional//EN">)... > > > Am-I alone in this case ? > Any codespeaker reading ? Hmm, it's working for me... Stefan -- http://mail.python.org/mailman/listinfo/pytho

Re: lxml codespeak pages empty ? Come back.

2007-09-19 Thread Laurent Pointal
Laurent Pointal a écrit : > I can no longer get codespeak's lxml page at http://codespeak.net/lxml/ > (get an empty HTML document Transitional//EN">)... > > > Am-I alone in this case ? > Any codespeaker reading ? It magically come-back -- http://mail.python.org/mailman/listinfo/python-li

Re: The meaning of a = b in object oriented languages

2007-09-19 Thread Roel Schroeven
Lew schreef: > Roel Schroeven wrote: >> Laurent Pointal schreef: >>> Summercool a écrit : The meaning of a = b in object oriented languages. >>> >>> >>> Oups, reading the subject I thought it was a Xah Lee post. >> me too ... > > Na

Re: Using pseudonyms

2007-09-19 Thread Paddy
On Sep 19, 5:07 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Aahz <[EMAIL PROTECTED]> wrote: > > For that matter, there are plenty of people who are better known by some > > nickname that is not their legal name. > > Yep. For example, some people whose legal name is "Alessandro" (which > no Amer

How to know the starting point

2007-09-19 Thread Raj kumar
Hi, I need help regarding the starting point in python project, As we can find main() function in java class to know the starting class in java, what is the starting point in python project? How to find the starting point. Thank you - Get the freedom to save

Re: How to know the starting point

2007-09-19 Thread Francesco Guerrieri
On 9/19/07, Raj kumar <[EMAIL PROTECTED]> wrote: > Hi, > I need help regarding the starting point in python project, > As we can find main() function in java class to know the starting class in > java, > what is the starting point in python project? > How to find the starting point. > Thank you >

AttributeError: How to list existing attributes?

2007-09-19 Thread Thomas Guettler
Hi, how can you list the attributes of an object if you catch an AttributeError? I couldn't find a reference in the exception object, which points to the object. I want to call dir() on the object to list the user the known attributes. Is there a way to find the object by inspecting the stacktr

Re: How can I know how much to read from a subprocess

2007-09-19 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > ... how can I know if the process wrote something to its > output, and how much it wrote? Others have mentioned using one-byte reads. To tell if something is available for reading, use select

Quick shallow-copy idiom

2007-09-19 Thread Lawrence D'Oliveiro
y = type(x)(x) -- http://mail.python.org/mailman/listinfo/python-list

Re: AttributeError: How to list existing attributes?

2007-09-19 Thread Diez B. Roggisch
Thomas Guettler wrote: > Hi, > > how can you list the attributes of an object if you catch an > AttributeError? > > I couldn't find a reference in the exception object, which > points to the object. > > I want to call dir() on the object to list the user the known > attributes. > > Is there a

Re: Help, I'm going mad with this

2007-09-19 Thread azrael
I didn't found this one. Looks interesting and complex because I ran away from C to Python because of the developing speed and pointers. Thanks mate, I'll try it. Other C implementations I found were much shorter, at least this is going to be a little challenge. :D -- http://mail.python.org/mail

still get a using a python script in the crontab

2007-09-19 Thread martijn
H! I have made a program that is checking if a program is running or not. If the program is not running then it must start the program again. in the /etc/crontab: * * * * * root/usr/sbin/ program_prgchk in the /usr/sbin/program_prgchk: /usr/local/bin/python /home/

Re: Metatest 0.1.0

2007-09-19 Thread Kay Schluehr
On 19 Sep., 01:30, Jonathan Fine <[EMAIL PROTECTED]> wrote: > > there is no fundamental reason why it can't be separated from > > eeconsole.py. > > OK. That might be a good idea. Ironically, I liked the idea of having more expressive assert statements - a discussion you brought up. But this requ

Re: Metatest 0.1.0

2007-09-19 Thread Kay Schluehr
On 19 Sep., 01:30, Jonathan Fine <[EMAIL PROTECTED]> wrote: > > there is no fundamental reason why it can't be separated from > > eeconsole.py. > > OK. That might be a good idea. Ironically, I liked the idea of having more expressive assert statements - a discussion you brought up. But this requ

HTTP Protocol Client

2007-09-19 Thread welcomestocontact
Hi, I am writing http protocol to get some data from servers. If i was using my localhost, getting replay from local and if want access other remote sites, i am getting error. Please reply it My localhost client script::: Code: ( python ) import httplib h = httplib.HTTP('localhost',80) h.pu

HTTP Protocol Client

2007-09-19 Thread welcomestocontact
Hi, I am writing http protocol to get some data from servers. If i was using my localhost, getting replay from local and if want access other remote sites, i am getting error. Please reply it My localhost client script::: Code: ( python ) import httplib h = httplib.HTTP('localhost',80) h.pu

Re: super() doesn't get superclass

2007-09-19 Thread Bruno Desthuilliers
Ben Finney a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >> Ben Finney a écrit : >>> Evan Klitzke <[EMAIL PROTECTED]> writes: On Tue, 2007-09-18 at 14:15 +1000, Ben Finney wrote: > [the 'super' function] doesn't return the superclass, it returns > the next class in the

Re: super() doesn't get superclass

2007-09-19 Thread Michele Simionato
On Sep 19, 12:36 pm, Bruno Desthuilliers wrote: > The next class in the MRO *is* a superclass of the *instance*. Else it > wouldn't be in the MRO !-) Bruno, there is no such a thing as a superclass in a multiple inheritance world, and it is a very bad idea to continue to use that terminology. I

Help for Otsu implementation from C

2007-09-19 Thread azrael
Can somone look at this def otsu(hi): fmax=-1.0 border=len(hi) for i in range(border): if hi[i]!=0:break for j in range(border-1,0-1,-1): if hi[j] != 0:break s = sum([k*hi[k] for k in range(border)]) n = sum(hi) # product(im.size) n1=n2=csum=0.0 for

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Michele Simionato <[EMAIL PROTECTED]> writes: > On Sep 19, 12:36 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: > >> The next class in the MRO *is* a superclass of the *instance*. Else it >> wouldn't be in the MRO !-) > > Bruno, there is no such a thing as a superclass in a multiple > inherita

Re: uninstall python2.5 on debian

2007-09-19 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, dimitri pater wrote: > I would like to uninstall Python2.5 which was installed > from source (make install) and keep 2.3. How about doing the make install again, and making a note of which files were installed, and removing those? -- http://mail.python.org/mailman

Re: super() doesn't get superclass

2007-09-19 Thread Michele Simionato
On Sep 19, 1:16 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Your arguments against the superclass term seem to assume that there > is only a single superclass to a particular class. If you say "the" superclass, then you also assume it is unique. But the big issue is that the order of the method

lambda-funcs problem

2007-09-19 Thread dmitrey . kroshko
hi all, I need to create a Python list of lambda-funcs that are dependent on the number of the ones, for example F = [] for i in xrange(N): F.append(lambda x: x + i) however, the example don't work - since i in end is N-1 it yields x+ (N-1) for any func. So what's the best way to make it val

UTF-8 characters in doctest

2007-09-19 Thread Bzyczek
Hello, I have problems with running doctests if I use czech national characters in UTF-8 encoding. I have Python script, which begin with encoding definition: # -*- coding: utf-8 -*- I have this function with doctest: def get_inventary_number(block): """ >>> t = u'''28. České králov

Re: super() doesn't get superclass

2007-09-19 Thread Bruno Desthuilliers
Michele Simionato a écrit : > On Sep 19, 12:36 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: > >> The next class in the MRO *is* a superclass of the *instance*. Else it >> wouldn't be in the MRO !-) > > Bruno, there is no such a thing as a superclass in a multiple > inheritance May I disagr

Re: lambda-funcs problem

2007-09-19 Thread Marc 'BlackJack' Rintsch
On Wed, 19 Sep 2007 04:39:44 -0700, dmitrey.kroshko wrote: > I need to create a Python list of lambda-funcs that are dependent on > the number of the ones, for example > > F = [] > for i in xrange(N): > F.append(lambda x: x + i) > > however, the example don't work - since i in end is N-1 it

Re: Help for Otsu implementation from C

2007-09-19 Thread Peter Otten
azrael wrote: > Can somone look at this > def otsu(hi): > fmax=-1.0 > border=len(hi) > for i in range(border): > if hi[i]!=0:break > for j in range(border-1,0-1,-1): > if hi[j] != 0:break > s = sum([k*hi[k] for k in range(border)]) n = sum(hi) # > product(i

RE: lambda-funcs problem

2007-09-19 Thread Ryan Ginstrom
> On Behalf Of [EMAIL PROTECTED] > F = [] > for i in xrange(N): > F.append(lambda x: x + i) > > however, the example don't work - since i in end is N-1 it yields x+ > (N-1) for any func. How about: >>> def make_adder(i): def adder(x): return x+i return adder

Re: super() doesn't get superclass

2007-09-19 Thread Hrvoje Niksic
Michele Simionato <[EMAIL PROTECTED]> writes: > On Sep 19, 1:16 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: >> Your arguments against the superclass term seem to assume that there >> is only a single superclass to a particular class. > > If you say "the" superclass, then you also assume it is uni

Re: lambda-funcs problem

2007-09-19 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > hi all, > I need to create a Python list of lambda-funcs that are dependent on > the number of the ones, for example > > F = [] > for i in xrange(N): > F.append(lambda x: x + i) > > however, the example don't work - since i in end is N-1 it yields x+ > (N-1) for

Re: UTF-8 characters in doctest

2007-09-19 Thread Peter Otten
Bzyczek wrote: > So my question is: Is it possible to run doctests with UTF-8 > characters? And if your answer will be YES, tell me please how... Use raw strings in combination with explicit decoding and a little try-and-error. E. g. this little gem passes ;) # -*- coding: utf8 -*- r""" >>> f("ä

stdout and embedding into Windows apps

2007-09-19 Thread Thomas Schreiner
Hi, I'm extending a windows application (C++) by embedding Python calls. It seems to be a known problem that windows applications detach immediately from the calling console, so that all output to stdout (from both C++ and Python) doesn't get shown anywhere. A workaround seems to be the allocatio

cannot create my own dict

2007-09-19 Thread A.T.Hofkamp
Hello all, This morning I tried to create my own read-only dictionary, and failed miserably. I don't understand why, can somebody enlighten me? Below is a brute-force experiment that cannot deal with "x in obj", plz read the explanation below the code: class myown

Re: How can I know how much to read from a subprocess

2007-09-19 Thread A.T.Hofkamp
On 2007-09-18, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Sep 18, 1:48 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: >> On 2007-09-17, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > It seems that another solution is gobject.io_add_watch, but I don't >> > see how it tells me how much I c

re question

2007-09-19 Thread Dan Bar Dov
I'm trying to construct a regular expression to match valid IP address, without leading zeroes (i.e 1.2.3.4, 254.10.0.0, but not 324.1.1.1, nor 010.10.10.1) This is what I come up with, and it does not work. r'(^[12]?\d{0,2}\.){3,3}[12]?\d{0,2}' What am I doing wrong? Any common knowledge IP mat

Odd files; just left behind?

2007-09-19 Thread Robin Becker
I see a folder .python-eggs in my home directory on one of our servers with various .so files ~/.python-eggs/MySQL_python-1.2.2-py2.3-freebsd-6.1-SECURITY-i386.egg-tmp/_mysql.so are these just left behind from some install process? -- Robin Becker -- http://mail.python.org/mailman/listinfo/py

Re: How to know the starting point

2007-09-19 Thread Steve Holden
Raj kumar wrote: > Hi, > I need help regarding the starting point in python project, > As we can find main() function in java class to know the starting class > in java, > what is the starting point in python project? > How to find the starting point. > Thank you The starting point is the top of

Re: super() doesn't get superclass

2007-09-19 Thread Neil Cerutti
On 2007-09-19, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> writes: > >> Hrvoje Niksic <[EMAIL PROTECTED]> writes: >> >>> class X(Y): >>> def foo(self): >>> super(X, self).foo() >>> >>> ...there is in fact no guarantee that super() calls a superclass of >>> X. H

Re: HTTP Protocol Client

2007-09-19 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hi, > > I am writing http protocol to get some data from servers. If i was > using my localhost, getting replay from local and if want access other > remote sites, i am getting error. Please reply it > > My localhost client script::: > > Code: ( python ) > > > impor

Re: HTTP Protocol Client

2007-09-19 Thread [EMAIL PROTECTED]
On Sep 19, 6:10 am, [EMAIL PROTECTED] wrote: > Hi, > > I am writing http protocol to get some data from servers. If i was > using my localhost, getting replay from local and if want access other > remote sites, i am getting error. Please reply it > > My localhost client script::: > > Code: ( pytho

Re: cannot create my own dict

2007-09-19 Thread Steve Holden
A.T.Hofkamp wrote: > Hello all, > > This morning I tried to create my own read-only dictionary, and failed > miserably. > I don't understand why, can somebody enlighten me? > > Below is a brute-force experiment that cannot deal with "x in obj", plz read > the explanation below the code: > ---

Re: cannot create my own dict

2007-09-19 Thread Peter Otten
A.T.Hofkamp wrote: > This morning I tried to create my own read-only dictionary, and failed > miserably. > I don't understand why, can somebody enlighten me? > > Below is a brute-force experiment that cannot deal with "x in obj", plz read > the explanation below the code: > --

Re: super() doesn't get superclass

2007-09-19 Thread Robin Becker
Michele Simionato wrote: ... interesting stuff ommitted super seems to return an object of type super, but I cannot seem to find any documention on this type except for 3.4.2.3 "Super Binding If a is an instance of super, then the binding super(B, obj).m() searches obj.__class__.__mro__ for

Re: Tutorial or Example (or Tutorial) of Using Canvas to Produce a Plot

2007-09-19 Thread W. Watson
I'm just trying to get some feel for how canvas works. I'm about to modify a program I use for meteor work. It uses canvas to display images, and I plan to draw on the image. For example, I plan to draw compass headings on a circle every 30 degrees. Just warming up to the task. exhuma.twn wrote

Re: Tutorial or Example (or Tutorial) of Using Canvas to Produce a Plot

2007-09-19 Thread W. Watson
Here seems to be another good source. W. Watson wrote: > Ah, I missed your link to Chap 11. That looks very helpful. > > W. Watson wrote: >> Thanks. I've arranged for an inter-library loan(ILL), and probably >> will not get his book for several days yet

Re: Sets in Python

2007-09-19 Thread Sion Arrowsmith
sapsi <[EMAIL PROTECTED]> wrote: > Why can't lists be hashed? Several people have answered "because they're mutable" without explaining why mutability precludes hashing. So: Consider a dict (dicts have been in Python a *lot* longer than sets, and have the same restriction) which allowed lists as

Re: super() doesn't get superclass

2007-09-19 Thread Sion Arrowsmith
Ben Finney <[EMAIL PROTECTED]> wrote: > If a function is named 'super' and operates on >classes, it's a pretty strong implication that it's about >superclasses. But it doesn't (under normal circumstances) operate on classes. It operates on an *instance*. And what you get back is a (proxy to) a su

Re: Puzzled in the coding of Chinese

2007-09-19 Thread Carsten Haese
On Wed, 2007-09-19 at 13:57 +0800, Xing wrote: > Dear list members, > I am a newcomer in the world of Python. But I am attracted by > Python's power in handling text! Now I apply it to handle Chinese but > the Chinese character cann't be displayed on the screen. What > displayed on the screen

Keeping a database connection with a Singleton?

2007-09-19 Thread exhuma.twn
I remember reading about the Singleton pattern in python and how it's an unpythonic pattern and all. At the time I did not need the Singleton anyways, so I just glanced over the document. But, setting this aside: I have an application where I have a connection to a database. At some point in the a

Re: lambda-funcs problem

2007-09-19 Thread Stéphane Larouche
Ryan Ginstrom ginstrom.com> writes: > How about: > > >>> def make_adder(i): > def adder(x): > return x+i > return adder > > >>> funcs = [make_adder(i) for i in xrange(10)] > >>> print [func(10) for func in funcs] > [10, 11, 12, 13, 14, 15, 16, 17, 18, 19] > >>> Or if

Re: Keeping a database connection with a Singleton?

2007-09-19 Thread Jason
On Sep 19, 7:26 am, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > I remember reading about the Singleton pattern in python and how it's > an unpythonic pattern and all. At the time I did not need the > Singleton anyways, so I just glanced over the document. > > But, setting this aside: I have an applic

Find the ID, but how to select/copy the whole string by ID?

2007-09-19 Thread Leon
Hi everybody, I am a beginer for Python, hope can get help from you guys. What I want to do is : Input an ID -> find the ID in the file -> copy the whole string y stringID = str(raw_input('Enter the string ID : ')) file = open('strings.txt') sourcefile = file.read() file.close() sourcefile.

Re: super() doesn't get superclass

2007-09-19 Thread Michele Simionato
On Sep 19, 3:22 pm, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > Ben Finney <[EMAIL PROTECTED]> wrote: > > > If a function is named 'super' and operates on > >classes, it's a pretty strong implication that it's about > >superclasses. > > But it doesn't (under normal circumstances) operate on class

Re: Keeping a database connection with a Singleton?

2007-09-19 Thread Peter Otten
exhuma.twn wrote: > I remember reading about the Singleton pattern in python and how it's > an unpythonic pattern and all. At the time I did not need the > Singleton anyways, so I just glanced over the document. > > But, setting this aside: I have an application where I have a > connection to a d

Re: Keeping a database connection with a Singleton?

2007-09-19 Thread exhuma.twn
On Sep 19, 3:45 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > exhuma.twn wrote: [...] > > By the way, there is a pythonic (near) singleton: the module. So if you go > with option 2, just move the connection setup into a separate module that > you can import into client code. > > Peter You say "(nea

Re: Keeping a database connection with a Singleton?

2007-09-19 Thread Peter Otten
exhuma.twn wrote: > On Sep 19, 3:45 pm, Peter Otten <[EMAIL PROTECTED]> wrote: >> exhuma.twn wrote: > [...] >> >> By the way, there is a pythonic (near) singleton: the module. So if you go >> with option 2, just move the connection setup into a separate module that >> you can import into client co

Re: Extracting xml from html

2007-09-19 Thread kyosohma
On Sep 19, 3:13 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Does this make sense? It works pretty well, but I don't really > > understand everything that I'm doing. > > > def Parser(filename): > > It's uncommon to give a function a capitalised name, unless it's a fac

Re: Keeping a database connection with a Singleton?

2007-09-19 Thread exhuma.twn
On Sep 19, 4:03 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > exhuma.twn wrote: > > On Sep 19, 3:45 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > >> exhuma.twn wrote: > > [...] > > >> By the way, there is a pythonic (near) singleton: the module. So if you go > >> with option 2, just move the connecti

Re: Drag image

2007-09-19 Thread kyosohma
On Sep 19, 1:06 am, ndoe <[EMAIL PROTECTED]> wrote: > i want show image from button? and the image can be drag and rezise ? > any body help me!!! i try to make it but is not sucsseful yet Please post some code so we can see what you're up to. Mike -- http://mail.python.org/mailman/listinfo/pyt

Re: super() doesn't get superclass

2007-09-19 Thread Neil Cerutti
On 2007-09-19, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Sep 19, 3:22 pm, Sion Arrowsmith <[EMAIL PROTECTED]> > wrote: >> Ben Finney <[EMAIL PROTECTED]> wrote: >> >> > If a function is named 'super' and operates on >> >classes, it's a pretty strong implication that it's about >> >superclas

ONYX

2007-09-19 Thread korovev76
Hi everybody! Is there anything out there that can validate and parse some "onyx-style" xml? I searched the web, but coulnd't find nothing really interesting about it... thank you! korovev -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python to create windows apps that everyone can use?

2007-09-19 Thread Larry Bates
Matt McCredie wrote: > On 9/18/07, Thomas Harding <[EMAIL PROTECTED]> wrote: >> Hi guys, sorry to post another topic on this, as I am aware that it has >> already been posted a few times, but not with specifically what I am looking >> for. I want an app that makes a gui interface for python (simila

Re: Find the ID, but how to select/copy the whole string by ID?

2007-09-19 Thread Francesco Guerrieri
On 9/19/07, Leon <[EMAIL PROTECTED]> wrote: > stringID = str(raw_input('Enter the string ID : ')) > file = open('strings.txt') > sourcefile = file.read() > file.close() > sourcefile.find (stringID) > > but how can I select and copy the specific string from to > with id I input? If the file you a

Re: Find the ID, but how to select/copy the whole string by ID?

2007-09-19 Thread Zentrader
sourcefile.find(stringID) returns the start location. You can use print to see this. You can then slice from start+len(stringID) and print it out. That should give you enough info to figure out how to find and extract to the end of the string tag as well. There are other ways to do this, but str

Re: still get a using a python script in the crontab

2007-09-19 Thread Zentrader
> If I run the command /usr/sbin/program_prgchk everything works (no > process) > But when I use it in the crontab I get a process The crontabs file on my system is stored in /var/spool/cron/ crontabs/. It appears you are checking the wrong file. Try a "crontab -e" from the command line and co

Re: Find the ID, but how to select/copy the whole string by ID?

2007-09-19 Thread Carsten Haese
On Wed, 2007-09-19 at 16:41 +0200, Francesco Guerrieri wrote: > On 9/19/07, Leon <[EMAIL PROTECTED]> wrote: > > stringID = str(raw_input('Enter the string ID : ')) > > file = open('strings.txt') > > sourcefile = file.read() > > file.close() > > sourcefile.find (stringID) > > > > but how can I selec

Re: Metatest 0.1.0

2007-09-19 Thread Jonathan Fine
Kay Schluehr wrote: > On 19 Sep., 01:30, Jonathan Fine <[EMAIL PROTECTED]> wrote: > > >>>there is no fundamental reason why it can't be separated from >>>eeconsole.py. >> >>OK. That might be a good idea. > > > Ironically, I liked the idea of having more expressive assert > statements - a discu

Re: still get a using a python script in the crontab

2007-09-19 Thread martijn
On 19 sep, 16:50, Zentrader <[EMAIL PROTECTED]> wrote: > > If I run the command /usr/sbin/program_prgchk everything works (no > > process) > > But when I use it in the crontab I get a process > > The crontabs file on my system is stored in /var/spool/cron/ > crontabs/. It appears you are checkin

psycopg2 or pygresql?

2007-09-19 Thread exhuma.twn
Plain and simple. What would you use? So far I have written everything with psycopg2. One thing that annoys me is that I cannot easily access the column names from a query. I know that this is not part of the DBAPI2 so I cannot expect the model to suport it. I quite like the "mogrify" method of

Re: AttributeError: How to list existing attributes?

2007-09-19 Thread Thomas Guettler
Diez B. Roggisch wrote: > Thomas Guettler wrote: > >> Hi, >> >> how can you list the attributes of an object if you catch an >> AttributeError? >> >> I couldn't find a reference in the exception object, which >> points to the object. >> >> I want to call dir() on the object to list the user the

Re: Find the ID, but how to select/copy the whole string by ID?

2007-09-19 Thread Francesco Guerrieri
On 9/19/07, Carsten Haese <[EMAIL PROTECTED]> wrote: > , then looking for id 12 is going to match on the wrong ID. Besides, > that code only tells you where something that looks like the ID you're > looking for is in the file. There is no guarantee that the match > actually occurs inside an ID att

Re: Using pseudonyms (was Re: Python 3K or Python 2.9?)

2007-09-19 Thread Aahz
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Aahz a écrit : >> In article <[EMAIL PROTECTED]>, >> Steve Holden <[EMAIL PROTECTED]> wrote: >>> Aahz wrote: In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Aahz a écrit

Re: The meaning of a = b in object oriented languages

2007-09-19 Thread Ken Bloom
On Tue, 18 Sep 2007 18:02:59 -0400, Lew wrote: > Summercool wrote: >> when a writing or a book reads "a is a Hash object; a is an Array >> object; or a is an Animal object" it is just a short form to say that >> "a is a reference to that object." >> >> b = a means "whatever a is referencing to, n

Re: psycopg2 or pygresql?

2007-09-19 Thread jay graves
On Sep 19, 10:06 am, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > And before someone says: "Use the DictCursor-factory to access column > names". Yes I can do that. But a dict does not guarantee the same > order of keys as the columns were specified in the query. But you can iterate over the cursor.d

Re: psycopg2 or pygresql?

2007-09-19 Thread Steve Holden
exhuma.twn wrote: > Plain and simple. What would you use? > > So far I have written everything with psycopg2. One thing that annoys > me is that I cannot easily access the column names from a query. I > know that this is not part of the DBAPI2 so I cannot expect the model > to suport it. > Yes i

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-19 Thread Grant Edwards
On 2007-09-19, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 18 Sep 2007 18:09:26 -0700, TheFlyingDutchman wrote: > >> How much faster/slower would Greg Stein's code be on today's >> processors versus CPython running on the processors of the >> late 1990's? > > I think a better question is,

Re: Will Python 3.0 remove the global interpreter lock (GIL)

2007-09-19 Thread Steven D'Aprano
On Tue, 18 Sep 2007 18:09:26 -0700, TheFlyingDutchman wrote: > How much faster/slower would Greg Stein's code be on today's processors > versus CPython running on the processors of the late 1990's? I think a better question is, how much faster/slower would Stein's code be on today's processors,

Re: Quick shallow-copy idiom

2007-09-19 Thread paulhankin
On Sep 19, 10:48 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > y = type(x)(x) Nice trick, but is it better than the explicit: y = copy.copy(x) (I think not, because copy.copy works for example, on classes which take more than one argument to their constructor). --

Simple threading example freezes IDLE?

2007-09-19 Thread writser
hey all, For my study I'm writing a simple threaded webcrawler and I am trying to do this in python. But somehow, using threads causes IDLE to crash on Windows XP (with the latest python distribution 2.5.1). Even a simple example such as this: import thread, time def doSomething(): print "some

Re: Deserializing specific objects from a file

2007-09-19 Thread Aaron J. M.
That's exactly what I needed. Thank you. Aaron J. M. -- http://mail.python.org/mailman/listinfo/python-list

Re: psycopg2 or pygresql?

2007-09-19 Thread exhuma.twn
On Sep 19, 5:47 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > exhuma.twn wrote: > > Plain and simple. What would you use? > > > So far I have written everything with psycopg2. One thing that annoys > > me is that I cannot easily access the column names from a query. I > > know that this is not part

Re: Extracting xml from html

2007-09-19 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: >>row = tree.find("//Row") >>print row.findtext("primaryowner") >>print row.findtext("customeraddress") > > I tried this your way and Laurent's way and both give me this error: > > AttributeError: 'NoneType' object has no attribute 'findtext' Well, error hand

Embedding a executable inside Python Script

2007-09-19 Thread Shankarjee Krishnamoorthi
Hi I have a python routine which calls an executable file created by someone else (I dont have the source code. All I have is an exe file). I do # My Python Code output = os.system('other_executable.exe') # Rest of my program. I need to give this routine to others to use it. I have a exe made

Re: psycopg2 or pygresql?

2007-09-19 Thread Steve Holden
exhuma.twn wrote: [...] > > Apparently I am deaf dumb and blind :( Sorry. I grepped several > times through the PEP for various other reasons, and this little bit > escaped me. > You forgot "stupid" ;-) > Thanks for being nice guys and answering anyhow. Much appreciated. > A pleasure. bee

Re: Embedding a executable inside Python Script

2007-09-19 Thread Grant Edwards
On 2007-09-19, Shankarjee Krishnamoorthi <[EMAIL PROTECTED]> wrote: > I have a exe made with py2exe for my Python routine. The issue > I am running into is this. All the exes (mycode.exe and > other_executable.exe) are placed in a Network drive(Say I:) so > that people can access it. > > When the

  1   2   >