Re: Import without executing module

2009-02-01 Thread Stephen Hansen
On Sun, Feb 1, 2009 at 11:43 PM, Taskinoor Hasan wrote: > Can anyone explain what is the necessity of executing whole script when > importing. Isn't it enough to just put the module name in the namespace and > execute when some function is called? I'm not sure if I'm going to explain this right--

Re: Problem With py2exe and ConfigParser

2009-02-01 Thread berserker...@gmail.com
You can set an example? My English is bad, so I do not quite understand > > Hello, i use python 2.6 + PyQt4. > > I compile my main.pyw. It is compile, but don't run. In > > "index.exe.log" error log: > >  File "index.pyw", line 100, in GetVal > ConfigParser.NoSectionError: No section:

Re: Python package Management GUI - New Project on Sourceforge

2009-02-01 Thread Stephen Hansen
> Well, isn't tkinter being removed? > (http://www.python.org/dev/peps/pep-3108/) PEP3108 isn't only about removals, but some renaming and reorganizations of certain packages / modules to be consistent within the standard library. In that section of PEP3108 they're talking about grouping tkinter m

Re: Import without executing module

2009-02-01 Thread Taskinoor Hasan
Can anyone explain what is the necessity of executing whole script when importing. Isn't it enough to just put the module name in the namespace and execute when some function is called? On Mon, Feb 2, 2009 at 1:36 PM, Stephen Hansen wrote: > > Maybe he can wrap the things he dont need inside > >

how to create data to dump into yaml file

2009-02-01 Thread sibteym
hi I have to create a yaml file using my list of objects.shall i need to create a string using my objects and then load and dump that string or is there any other way to create the yaml file. i want a yaml file to be created from [Text, Author,..]in this format Text: - value1 - val

Re: Python package Management GUI - New Project on Sourceforge

2009-02-01 Thread Gabriel Rossetti
James Mills wrote: On Mon, Feb 2, 2009 at 2:57 PM, David Lyon wrote: To be truly cross platform, consider using the Tcl/Tk toolkit rather tahn wxWindows. Why ? Because Tcl/TK is packaged and provided along with most Python distributions. I agree with your point.. The problem is that

Re: Import without executing module

2009-02-01 Thread Stephen Hansen
> Maybe he can wrap the things he dont need inside > if __name__ == '__main__': > check. > -- > http://mail.python.org/mailman/listinfo/python-list > Yeah but he said he doesn't want to modify the file itself-- if he can modify the file this can all go away readily, yes. --S -- http://mail.python

Re: Import without executing module

2009-02-01 Thread Kottiyath
On Feb 2, 12:19 pm, Stephen Hansen wrote: > On Sun, Feb 1, 2009 at 11:05 PM, Ray wrote: > > Basically, someone has created a python script and I would like to > > make use of his functions.  I would prefer to not modify his file so > > what I would like to do is just write my script and import pa

Re: Import without executing module

2009-02-01 Thread Stephen Hansen
On Sun, Feb 1, 2009 at 11:05 PM, Ray wrote: > Basically, someone has created a python script and I would like to > make use of his functions. I would prefer to not modify his file so > what I would like to do is just write my script and import parts that > are needed. i.e., I would like to separ

Import without executing module

2009-02-01 Thread Ray
Hi all, I'm quite new to python as I've only just started to learn about it a few days ago... I am trying to do something and after reading about it, I'm still not sure whether or not it can be done. Basically, someone has created a python script and I would like to make use of his functions.

Re: nth root

2009-02-01 Thread casevh
On Feb 1, 10:02 pm, Mensanator wrote: > On Feb 1, 8:20 pm, casevh wrote: > > > > > On Feb 1, 1:04 pm, Mensanator wrote: > > > > On Feb 1, 2:27 am, casevh wrote: > > > > > On Jan 31, 9:36 pm, "Tim Roberts" wrote: > > > > > > Actually, all I'm interested in is whether the 100 digit numbers have

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Christoph Zwerschke
Steve Holden schrieb: Search for the subject line "socket.create_connection slow" - this was discovered by Kristjan Valur Jonsson. It certainly seems like a Microsoft weirdness. Thanks for the pointer, Steve. I hadn't seen that yet. I agree that's actually the real problem here. The solution s

key capture

2009-02-01 Thread swamynathan
hello, im making a virtual piano in python where on key stroke a wav is played from a location now to implement a fully functional piano i need to have multiple key stroke captures ie if 2 or 3 keys pressed then the function which playes the wav is called with 3 parameters how to implement this

Re: Why such different HTTP response results between 2.5 and 3.0

2009-02-01 Thread Brian Allen Vanderburg II
an0...@gmail.com wrote: Below are two semantically same snippets for querying the same partial HTTP response, for Python2.5 and Python 3.0 respectively. However, the 3.0 version returns a not-so-right result(msg) which is a bytes of length 239775, while the 2.5 version returns a good msg which is

Re: nth root

2009-02-01 Thread Mensanator
On Feb 1, 8:20�pm, casevh wrote: > On Feb 1, 1:04�pm, Mensanator wrote: > > > > > On Feb 1, 2:27�am, casevh wrote: > > > > On Jan 31, 9:36�pm, "Tim Roberts" wrote: > > > > > Actually, all I'm interested in is whether the 100 digit numbers have > > > > an exact integral root, or not. �At the mo

Why such different HTTP response results between 2.5 and 3.0

2009-02-01 Thread an0
Below are two semantically same snippets for querying the same partial HTTP response, for Python2.5 and Python 3.0 respectively. However, the 3.0 version returns a not-so-right result(msg) which is a bytes of length 239775, while the 2.5 version returns a good msg which is a 239733 byte-long string

Re: Python package Management GUI - New Project on Sourceforge

2009-02-01 Thread James Mills
On Mon, Feb 2, 2009 at 2:57 PM, David Lyon wrote: >> To be truly cross platform, consider >> using the Tcl/Tk toolkit rather tahn >> wxWindows. Why ? Because Tcl/TK >> is packaged and provided along with >> most Python distributions. > > I agree with your point.. > > The problem is that Tcl/TK is

Re: Python package Management GUI - New Project on Sourceforge

2009-02-01 Thread David Lyon
> What's wrong with Enstaller from Enthought ? for a start on https://svn.enthought.com/enthought/wiki/Enstaller it claims to be depracated... > Can I make a few suggestions ? Sure.. > To be truly cross platform, consider > using the Tcl/Tk toolkit rather tahn > wxWindows. Why ? Because T

Re: Python package Management GUI - New Project on Sourceforge

2009-02-01 Thread James Mills
On Mon, Feb 2, 2009 at 2:17 PM, David Lyon wrote: > Hi all, > > I am pleased to announce that we have started a new python > project on sourceforge. > > Python Package Manager > pythonpkgmgr.sourceforge.net > > The goal is to provide a cross platform GUI tool that will > vastly simplify loading

Re: is python Object oriented??

2009-02-01 Thread Hung Vo
On Feb 2, 4:10 am, Stephen Hansen wrote: > Anyway, it doesn't matter. We're losing the point here. The point is > that language support for private access, by disallowing user access > to private data, provides an unambiguous information hiding mechanism > which encourages encapsulation. Python's

Python package Management GUI - New Project on Sourceforge

2009-02-01 Thread David Lyon
Hi all, I am pleased to announce that we have started a new python project on sourceforge. Python Package Manager pythonpkgmgr.sourceforge.net The goal is to provide a cross platform GUI tool that will vastly simplify loading and installing packages under python. - written in python

Re: what IDE is the best to write python?

2009-02-01 Thread Chris Jones
On Sun, Feb 01, 2009 at 07:26:24PM EST, Ben Finney wrote: > a...@pythoncraft.com (Aahz) writes: > > > Just to register a contrary opinion: I *hate* syntax highlighting > > On what basis? Real men hate syntax highlighting. -- http://mail.python.org/mailman/listinfo/python-list

Re: getting values from a text file (newby)

2009-02-01 Thread John Machin
On Feb 2, 10:18 am, vsoler wrote: > On 1 feb, 23:57, John Machin wrote: > > > On Feb 2, 6:18 am, vsoler wrote: > > > > r: in the open statement, why do you use 'rb' as 2nd argument? b is > > > supposed to be binary, and my file is text! > > > Because unlike Stephen, r has read the csv manual. Bi

Re: Membership of multiple items to a list

2009-02-01 Thread Ben Finney
rdmur...@bitdance.com writes: > I don't even see Stephen Hansen's posts. My newsreader just shows > the header and says "[HTML part not displayed]". Likewise. Note to people who want to communicate in online fora: Set your client to generate a “text/plain” body only. HTML is either irrelevant to

Re: Completer with history for Python 3 ?

2009-02-01 Thread Дамјан Георгиевски
> I've been long using this recipe [1] „Completer with history viewer > support and more features“ with the interactive prompt of python 2.x > But it's not compatible with Python 3.0 > > Anyone know of a similar functionality for Python 3.0 or I should try > to port this script? > > [1] > http://

Re: call other program

2009-02-01 Thread Chris Rebert
On Sun, Feb 1, 2009 at 7:35 PM, JuanPablo wrote: > hi, > I have a newbie question. > In bash is posible call other program, send and recieve message with this. > > example: > $ python > output << EOF >> print "hello world" >> EOF > $ cat output > hello world > > in python exist some similar ?

call other program

2009-02-01 Thread JuanPablo
hi, I have a newbie question. In bash is posible call other program, send and recieve message with this. example: $ python > output << EOF > print "hello world" > EOF $ cat output hello world in python exist some similar ? many thanks JuanPablo -- http://mail.python.org/mailman/listinfo/pytho

Re: Auto Logon to site and get page

2009-02-01 Thread Stephen Hansen
> This doesn't however, it just sends me back to the main login page, doenst > say invalid password or anything. I've checked, yes the python hmac hash > function produces the same results (encrypted password) as the md5.js file. > Does anyone know what I am doing wrong?? My guess? After you succe

Re: Membership of multiple items to a list

2009-02-01 Thread Stephen Hansen
> Stephen, do you see the utter mess your posts look like to some others? Whoops, I was experimenting with a new Firefox add-on that fiddled with Gmail, and hadn't noticed it changed my output format to HTML out from under me. Sorry! --S -- http://mail.python.org/mailman/listinfo/python-list

Re: Membership of multiple items to a list

2009-02-01 Thread rdmurray
Quoth Steven D'Aprano : > On Sun, 01 Feb 2009 12:01:11 -0800, Stephen Hansen wrote: > > > > style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt > > 0.8ex; padding-left: 1ex;"> I'd like to know how to elegantly check > > a list for the membership of any of its items to another li

Re: AssertionError not caught?

2009-02-01 Thread Steve Holden
LX wrote: > This one has me mystified good! > > This works (print statement is executed as the Exception is caught) as > advertised: > try: > raise AssertionError > except AssertionError: > print "caught AssertionError" > > > But this one does not: > >def test(): >

Re: AssertionError not caught?

2009-02-01 Thread Ben Finney
LX writes: > This works (print statement is executed as the Exception is caught) > as advertised: You don't actually show us the output you get. > try: > raise AssertionError > except AssertionError: > print "caught AssertionError" >>> try: ... raise Asserti

Re: Question about wx folder browser widget

2009-02-01 Thread Steve Holden
Sam Price wrote: > Is there any good wx widgets that provide the same feel as folder/file > browser. > I want to be notified when a user tries to drag and drop a file/folder > on the widget, and then copy that file/folder to a new folder an do > operations on it. > > Wanted to check first to see i

Completer with history for Python 3 ?

2009-02-01 Thread Дамјан Георгиевски
I've been long using this recipe [1] „Completer with history viewer support and more features“ with the interactive prompt of python 2.x But it's not compatible with Python 3.0 Anyone know of a similar functionality for Python 3.0 or I should try to port this script? [1] http://code.activestate

Re: AssertionError not caught?

2009-02-01 Thread Alexander Kain
Thank you for restoring sanity to my world! Indeed, it seems to have to do with the way that the WingIDE debugger works - it actually catches the error correctly , but it -->sets a breakpoint at the original raise first<---. This only occurs for the AssertionError. The debugger can then be

Re: AssertionError not caught?

2009-02-01 Thread Chris Rebert
On Sun, Feb 1, 2009 at 6:31 PM, LX wrote: > This one has me mystified good! > > This works (print statement is executed as the Exception is caught) as > advertised: >try: >raise AssertionError >except AssertionError: >print "caught AssertionError" > > > But this one does no

AssertionError not caught?

2009-02-01 Thread LX
This one has me mystified good! This works (print statement is executed as the Exception is caught) as advertised: try: raise AssertionError except AssertionError: print "caught AssertionError" But this one does not: def test(): raise AssertionError try:

Question about wx folder browser widget

2009-02-01 Thread Sam Price
Is there any good wx widgets that provide the same feel as folder/file browser. I want to be notified when a user tries to drag and drop a file/folder on the widget, and then copy that file/folder to a new folder an do operations on it. Wanted to check first to see if something exists, and not rei

Re: nth root

2009-02-01 Thread casevh
On Feb 1, 1:04 pm, Mensanator wrote: > On Feb 1, 2:27 am, casevh wrote: > > > On Jan 31, 9:36 pm, "Tim Roberts" wrote: > > > > Actually, all I'm interested in is whether the 100 digit numbers have an > > > exact integral root, or not.  At the moment, because of accuracy > > > concerns, I'm doi

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Steve Holden
rdmur...@bitdance.com wrote: > Quoth Christoph Zwerschke : >> rdmur...@bitdance.com schrieb: >>> Quoth Christoph Zwerschke : With Py 2.3 (without IPv6 support) this is only the IPv4 address, but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address first, then th

Re: is python Object oriented??

2009-02-01 Thread Steve Holden
Steven D'Aprano wrote: > On Sun, 01 Feb 2009 12:31:27 -0500, Steve Holden wrote: > >> I think it's noticeable that the people who have been arguing against >> what I might tipify as this "libertarian view" are those for whom the >> consequences of programming error are serious to extreme. > ... >>

Re: is python Object oriented??

2009-02-01 Thread Steve Holden
Rhodri James wrote: > On Sun, 01 Feb 2009 17:31:27 -, Steve Holden > wrote: > >> Stephen Hansen wrote: >>> [...] >>> don't play with anyone else's >>> privates. >>> >> A good rule in life as well as programming. > > Unless, of course, you're both consenting adults. > > What? Someone had to

Re: is python Object oriented??

2009-02-01 Thread Luis Zarrabeitia
On Sunday 01 February 2009 08:00:18 pm Steven D'Aprano wrote: > On Sun, 01 Feb 2009 12:31:27 -0500, Steve Holden wrote: > Except of course it isn't. Nobody sensibly complains that they can't > mangle the length of a list, or move keys around inside dicts, or > whatever. This data hiding is a goo

Re: question about Z=[[x for y in range(1, 2) if AList[x]==y] for x in range(0,5)]

2009-02-01 Thread Chris Rebert
On Fri, Jan 30, 2009 at 5:33 PM, Vincent Davis wrote: > Z=[[x for y in range(1,2) if AList[x]==y] for x in range(0,5)] > I am not sure how to ask this but which "for" is looped first? I could > test but was wondering if there was a nice explanation I could apply > to future situations. The outer

Re: problem with program - debugging leading nowhere

2009-02-01 Thread Ben Finney
Ben Finney writes: > Step three: When asking people to help with understanding an error > message, it helps to post the actual (complete) error message :-) My apologies, you did provide this and I missed it. -- \ “One time I went to a drive-in in a cab. The movie cost me | `\

Re: len()

2009-02-01 Thread Pat
Tobiah wrote: Just out of curiosity, why was len() made to be it's own function? I often find myself typing things like my_list.len before I catch myself. Thanks, Toby I'm surprised that no one responded to that question. I keep making that mistake all the time myself. -- http://mail.python

Re: database wrapper ?

2009-02-01 Thread Ben Finney
Stef Mientki writes: > Is SQLalchemy the best / most popular database wrapper ? In my opinion, yes it's the best. It gives a good ORM (letting you treat your data as objects and have them persistently stored in the database), while still allowing all the power and flexibility of full SQL wheneve

Re: Where to host a (Python) project?

2009-02-01 Thread Colin J. Williams
andrew cooke wrote: On Jan 31, 11:22 am, eliben wrote: code.google.com provides all of these in a free and convenient manner. Recommended. unfortunately google don't seem that reliable ;o) (have you tried a google search today?) I had a search problem today (10:00), the first I can rememb

Re: Get thread pid

2009-02-01 Thread Alejandro
On Jan 30, 1:40 pm, Christian Heimes wrote: > May I ask why you want to get the TID? htop shows the TID of each thread. Knowing the TID allows me to know which thread is hogging the CPU. If there is a better way to do this, or there is something fundamentally wrong with this approach, please let

Re: Get thread pid

2009-02-01 Thread Alejandro
On Jan 30, 10:10 am, Jean-Paul Calderone wrote: >     >>> ctypes.CDLL('libc.so.6').syscall(224) Great! ctypes.CDLL('libc.so.6').syscall(224) does the trick. Thank you. Regards, Alejandro. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does the Python community really follow the philospy of "Community Matters?"

2009-02-01 Thread John Machin
On Feb 1, 11:19 am, r wrote: > Steve you are defiantly the better of two evils around here :D A most munificent malapropism! Sherman's goat must be serene with entropy!! -- http://mail.python.org/mailman/listinfo/python-list

Pyggy Awards Judging Underway

2009-02-01 Thread Greg Ewing
Judging for the Feb'09 Pyggy Awards has started. All registered users of the PyWeek web site are eligible to rate entries, so even if you haven't submitted an entry, you can still be a judge if you want. And if you're not a PyWeek user, it's not too late to sign up. The entries are here: http:

Please help to play 5 jpegs as a slideshow in JES(Jython) --- BEGINNER.

2009-02-01 Thread steve
Hello, I am a brand brand new programming student in Jython and I have been working on a simple homework assignment in JES for the last 12 hours and am completely lost. Basically, we have to make a jpeg slideshow with 5 different pictures with audio background that lasts 60 seconds. I have absolut

Auto Logon to site and get page

2009-02-01 Thread John Smith
I'm trying to automatically log into a site and store the resulting html using python. The site uses a form and encrypts the password with some kind of md5 hash. This is the important parts of the form:

question about Z=[[x for y in range(1,2) if AList[x]==y] for x in range(0,5)]

2009-02-01 Thread Vincent Davis
Z=[[x for y in range(1,2) if AList[x]==y] for x in range(0,5)] I am not sure how to ask this but which "for" is looped first? I could test but was wondering if there was a nice explanation I could apply to future situations. Thanks Vincent Davis 720-301-3003 -- http://mail.python.org/mailman/listi

Re: accessing elements of a tuple

2009-02-01 Thread Steven D'Aprano
On Sun, 01 Feb 2009 09:32:42 -0500, D'Arcy J.M. Cain wrote: > On Sun, 01 Feb 2009 19:23:58 +1100 > Steven D'Aprano wrote: >> D'Arcy J.M. Cain wrote: >> >> > First of all, list is a reserved word.  Don't use it as a variable >> > name. >> >> Unless you mean to. Shadowing built-ins is only a bad

Re: is python Object oriented??

2009-02-01 Thread Steven D'Aprano
On Sun, 01 Feb 2009 12:31:27 -0500, Steve Holden wrote: > I think it's noticeable that the people who have been arguing against > what I might tipify as this "libertarian view" are those for whom the > consequences of programming error are serious to extreme. ... > Just the same, it still doesn't

Re: Membership of multiple items to a list

2009-02-01 Thread Steven D'Aprano
On Sun, 01 Feb 2009 12:01:11 -0800, Stephen Hansen wrote: > style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt > 0.8ex; padding-left: 1ex;"> I'd like to know how to elegantly check > a list for the membership of any of its items to another list. >  Not caring for elegance, I wo

Re: database wrapper ?

2009-02-01 Thread andrew cooke
> I wish all DB solutions were like this - my hope is that EmpireDB will > do the same for Java, but it's too early to tell... Hmmm - I should correct the above. I had assumed EmpireDB was new, because it's an Apache Incubator project, but now I look at their site I see it's actually been around

Re: what IDE is the best to write python?

2009-02-01 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: > Just to register a contrary opinion: I *hate* syntax highlighting On what basis? -- \ “The man who is denied the opportunity of taking decisions of | `\ importance begins to regard as important the decisions he is | _o__)

Using lxml to screen scrap a site, problem with charset

2009-02-01 Thread Дамјан Георгиевски
So, I'm using lxml to screen scrap a site that uses the cyrillic alphabet (windows-1251 encoding). The sites HTML doesn't have the header, but does have a HTTP header that specifies the charset... so they are standards compliant enough. Now when I run this code: from lxml import html doc = htm

Re: Where to host a (Python) project?

2009-02-01 Thread andrew cooke
On Feb 1, 8:45 pm, a...@pythoncraft.com (Aahz) wrote: > Note that it's fairly easy to get a new list hosted at python.org, just > ask postmaster.  I for one won't participate in any list hosted on > Google because of the need for a Google login. ah well - i guess you can use pyparsing ;o) http://

Re: database wrapper ?

2009-02-01 Thread andrew cooke
> Is SQLalchemy the best / most popular database wrapper ? SQLAlchemy is the best SQL library I have ever used. But it may depend on who you ask. For me, what makes SQLAlchemy so good is the way it allows you to use SQL from within Python. I have used the ORM side, and that's fine, but it's the

Re: Where to host a (Python) project?

2009-02-01 Thread Aahz
In article <387f23cd-90e2-46fc-8c91-1c2f6b31c...@u13g2000yqg.googlegroups.com>, andrew cooke wrote: > >However, i am thinking I could really do with: >- a mailing list >- simple bug tracking >- subversion >and am wondering which is the best (free) provider for these (the code >is LGPL open source

Re: database wrapper ?

2009-02-01 Thread Stephen Hansen
Googling, I found SQLalchemy, which looks quit good. SQLAlchemy is very good. I'm very slowly migrating our entire codebase to it.   But as I only want to choose once, I googled for  "SQLalchemy alternatives", but it didn't find many answers. (Storm / Grok are of no interest, because manipu

Re: what IDE is the best to write python?

2009-02-01 Thread Aahz
In article , MattBD wrote: > >I like Vim, that works really well for me when coding in Python. >Enable syntax highlighting and it's a great development environment. >It's a little tough at first but run vimtutor and you'll soon start to >get the hang of it. Just to register a contrary opinion: I

Re: database wrapper ?

2009-02-01 Thread Chris Rebert
On Sun, Feb 1, 2009 at 2:56 PM, Stef Mientki wrote: > hello, > > Until now I used a simple wrapper around pysqlite and pyodbc to manage my > databases. > Now I'm looking for a better solution, > because I've to support a (for this moment) unknown database, > and I'm not the one who will choose the

Re: is python Object oriented??

2009-02-01 Thread Rhodri James
On Sun, 01 Feb 2009 17:31:27 -, Steve Holden wrote: Stephen Hansen wrote: [...] don't play with anyone else's privates. A good rule in life as well as programming. Unless, of course, you're both consenting adults. What? Someone had to say it! -- Rhodri James *-* Wildebeeste Herder

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke : > rdmur...@bitdance.com schrieb: > > Quoth Christoph Zwerschke : > >>With Py 2.3 (without IPv6 support) this is only the IPv4 address, > >>but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address > >>first, then the IPv4 address. Since the IPv6 a

Re: getting values from a text file (newby)

2009-02-01 Thread vsoler
On 1 feb, 23:57, John Machin wrote: > On Feb 2, 6:18 am, vsoler wrote: > > > > > r: in the open statement, why do you use 'rb' as 2nd argument? b is > > supposed to be binary, and my file is text! > > Because unlike Stephen, r has read the csv manual. Binary mode is > required to handle properly

Re: getting values from a text file (newby)

2009-02-01 Thread John Machin
On Feb 2, 6:18 am, vsoler wrote: > > r: in the open statement, why do you use 'rb' as 2nd argument? b is > supposed to be binary, and my file is text! Because unlike Stephen, r has read the csv manual. Binary mode is required to handle properly cases like '\n' embedded in a field -- something whi

database wrapper ?

2009-02-01 Thread Stef Mientki
hello, Until now I used a simple wrapper around pysqlite and pyodbc to manage my databases. Now I'm looking for a better solution, because I've to support a (for this moment) unknown database, and I'm not the one who will choose the database. Googling, I found SQLalchemy, which looks quit good

Re: Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread Christoph Zwerschke
rdmur...@bitdance.com schrieb: Quoth Christoph Zwerschke : With Py 2.3 (without IPv6 support) this is only the IPv4 address, but with Py 2.4-2.6 the order is (on my Win XP host) the IPv6 address first, then the IPv4 address. Since the IPv6 address is checked first, this gives a timeo

Re: nth root

2009-02-01 Thread Mensanator
On Feb 1, 2:27 am, casevh wrote: > On Jan 31, 9:36 pm, "Tim Roberts" wrote: > > > Actually, all I'm interested in is whether the 100 digit numbers have an > > exact integral root, or not.  At the moment, because of accuracy concerns, > > I'm doing something like > > >                     for ro

Re: SimpleXMLRPCServer question

2009-02-01 Thread flagg
On Feb 1, 12:38 am, "Hendrik van Rooyen" wrote: >  "flagg" wrote: > >Let me see if i can elaborate on the requirements.  I have 20+ > >different zone files.  I want the xmlrpc server to be able to > >determine what zone file to open by looking at the incoming xml > >request.  For example one of t

Re: Membership of multiple items to a list

2009-02-01 Thread inkhorn
Wow thanks for the lightning fast reply! This does exactly the right job. Matt On Feb 1, 3:01 pm, Stephen Hansen wrote: > I'd like to know how to elegantly check a list for the membership of > any of its items to another list.  Not caring for elegance, I would > use the following code: > That's

Re: Membership of multiple items to a list

2009-02-01 Thread Paul Rubin
inkhorn writes: > blah = [1,2,3] > yadda = [3,4,5,6] > > blah[0] or blah[1] or blah[2] in yadda if set(blah) & set(yadda): print "yes" -- http://mail.python.org/mailman/listinfo/python-list

Re: Membership of multiple items to a list

2009-02-01 Thread Stephen Hansen
I'd like to know how to elegantly check a list for the membership of any of its items to another list.  Not caring for elegance, I would use the following code: That's one of the useful properties of sets:>>> a = [1,2,3]>>> b = [3,4,5,6]>>> set(a) & set(b)set([3])>>> set(a).intersection(b)set(

Re: Membership of multiple items to a list

2009-02-01 Thread Christian Heimes
inkhorn schrieb: > Dear all, > > I'd like to know how to elegantly check a list for the membership of > any of its items to another list. Not caring for elegance, I would > use the following code: > > blah = [1,2,3] > yadda = [3,4,5,6] > > blah[0] or blah[1] or blah[2] in yadda > > Please tell

Re: subprocess.Popen not creating a pipe

2009-02-01 Thread Andrew Parker
On Sun, Feb 1, 2009 at 1:46 PM, Andrew Parker wrote: > I'm having some fun with Popen. I have the following line: > >process = subprocess.Popen(command, stdout=subprocess.PIPE, > stderr=subprocess.STDOUT) >print process.stdout > > Under normal circumstances, this displays: > >', mode

Membership of multiple items to a list

2009-02-01 Thread inkhorn
Dear all, I'd like to know how to elegantly check a list for the membership of any of its items to another list. Not caring for elegance, I would use the following code: blah = [1,2,3] yadda = [3,4,5,6] blah[0] or blah[1] or blah[2] in yadda Please tell me how to change the preceding code into

Problem with slow httplib connections on Windows (and maybe other platforms)

2009-02-01 Thread rdmurray
Quoth Christoph Zwerschke : > What actually happens is the following: > > * BaseHTTPServer binds only to the IPv4 address of localhost, because >it's based on TCPServer which has address_family=AF_INET by default. > > * HTTPConnection.connect() however tries to connect to all IP addresses >

Re: getting values from a text file (newby)

2009-02-01 Thread Steve Holden
Stephen Hansen wrote: > > > On Sun, Feb 1, 2009 at 9:24 AM, vsoler wrote: > > Hi, > > My foo.txt file contains the following: > > 1,"house","2,5" > 2,"table","6,7" > 3,"chair","-4,5" > > ... as seen with notepad. > > This file was created with the OpenOffice Calc

Re: search speed

2009-02-01 Thread Aaron Watters
On Jan 30, 3:49 am, "Diez B. Roggisch" wrote: > alex23 gave you a set of tools that you can use for full-text-search. > However, that's not necessarily the best thing to do if things have a > record-like structure. In Nucular (and others I think) you can do searches for terms anywhere (full text)

Re: getting values from a text file (newby)

2009-02-01 Thread vsoler
On 1 feb, 19:02, Stephen Hansen wrote: > On Sun, Feb 1, 2009 at 9:24 AM, vsolerwrote:Hi, > My foo.txt file contains the following: > 1,"house","2,5" > 2,"table","6,7" > 3,"chair","-4,5" > ... as seen with notepad. > This file was created with the OpenOffice Calc spreadsheet, but since > I use comm

Re: nth root

2009-02-01 Thread Peter Pearson
On Sun, 1 Feb 2009 15:36:43 +1000, Tim Roberts wrote: > > Actually, all I'm interested in is whether the 100 digit > numbers have an exact integral root, or not. At the > moment, because of accuracy concerns, I'm doing something > like > > for root in powersp: >

Re: error on building 2.6.1. (_ctypes)

2009-02-01 Thread Bernard Rankin
> > >> > I am trying to build python 2.6 on a machine (web server) that I do not > have > >> root access to. (has 2.4 installed) > >> > > >> > Python 2.5 builds fine, but I am getting an error when I run "make" for > 2.6.1. > > >> Mmm... my 2.6.1 source show different line numbers, maybe you

Re: Pipe stdout && stderr to a TkLabel widget

2009-02-01 Thread rantingrick
PS: The braces are there because i used *arg in the fuction, so that is not a problem now. All i want to do is overide the print statement to sent all it's output to a Tkinter Label widget Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: is python Object oriented??

2009-02-01 Thread rdmurray
Quoth thmpsn@gmail.com: > Anyway, it doesn't matter. We're losing the point here. The point is > that language support for private access, by disallowing user access > to private data, provides an unambiguous information hiding mechanism > which encourages encapsulation. Python's approach, howe

Re: Pythonic list/tuple/dict layout?

2009-02-01 Thread Aahz
In article <871vur39k7@benfinney.id.au>, Ben Finney wrote: > >I actually use this style: > >foo = { >0: 'spam', >1: 'eggs', >2: 'beans', >} > >because that makes it clear that *all* the indented lines are a >continuation of the same statement, just like a s

Re: Pipe stdout && stderr to a TkLabel widget

2009-02-01 Thread rantingrick
Hello, anybody. Any help would be good help Thanks -- http://mail.python.org/mailman/listinfo/python-list

subprocess.Popen not creating a pipe

2009-02-01 Thread Andrew Parker
I'm having some fun with Popen. I have the following line: process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) print process.stdout Under normal circumstances, this displays: ', mode 'w' at 0xb7f8e068> However, I have a binary that I use to kick of

Re: Python time measure question (timeit)

2009-02-01 Thread Steve Holden
vedrandeko...@yahoo.com wrote: > On 1 velj, 17:42, Steve Holden wrote: >> vedrandeko...@yahoo.com wrote: >>> Hello, >>> When I run following code with os.popen (for this time measure I'm >>> using python module timeit): >>> for i in range(50): >>> print i >>> I get this result: 0.00246958761

Re: getting values from a text file (newby)

2009-02-01 Thread Stephen Hansen
On Sun, Feb 1, 2009 at 9:24 AM, vsoler wrote:Hi, My foo.txt file contains the following: 1,"house","2,5" 2,"table","6,7" 3,"chair","-4,5" ... as seen with notepad. This file was created with the OpenOffice Calc spreadsheet, but since I use comma as the decimal separator for numbers,

Re: getting values from a text file (newby)

2009-02-01 Thread r
On Feb 1, 11:50 am, Steve Holden wrote: > And then, to conert the last field to numbers? ... Are you asking me Steve? Well i did not want to short-circuit the OP's learning process by spoon-feeding him the entire answer. I thought i would give him a push in the right direction and observe the out

Re: Problems installing PySQLite, SQLite and Trac

2009-02-01 Thread Jon Clements
On 1 Feb, 15:48, kimwlias wrote: > My initial goal is to finally install Trac. This is the second day > I've been trying to make this possible but I can't find, for the life > of me, how to do this. OK, here is the story: > > My system is a VPS with CentOS 5. > > I found out that I have two versio

Re: getting values from a text file (newby)

2009-02-01 Thread Steve Holden
r wrote: > Try the csv module > > py> import csv > py> reader = csv.reader(open(csvfile, "rb")) > py> for row in reader: > print row > > > ['1', 'house', '2,5 '] > ['2', 'table', '6,7 '] > ['3', 'chair', '-4,5 '] And then, to conert the last field to numbers? ... regards Steve -- Steve

Re: getting values from a text file (newby)

2009-02-01 Thread r
Try the csv module py> import csv py> reader = csv.reader(open(csvfile, "rb")) py> for row in reader: print row ['1', 'house', '2,5 '] ['2', 'table', '6,7 '] ['3', 'chair', '-4,5 '] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python time measure question (timeit)

2009-02-01 Thread vedrandekovic
On 1 velj, 17:42, Steve Holden wrote: > vedrandeko...@yahoo.com wrote: > > Hello, > > > When I run following code with os.popen  (for this time measure I'm > > using python module timeit): > > > for i in range(50): > >     print i > > > I get this result:  0.00246958761519 > > > But when I run sam

Re: is python Object oriented??

2009-02-01 Thread Steve Holden
Stephen Hansen wrote: > [...] > don't play with anyone else's > privates. > A good rule in life as well as programming. > The *idea* of encapsulation is good in many cases, it is quite often a > solid design point and admirable goal. The *implementation* of enforced > data encapsulation brings no

  1   2   >