Building a dictionary from a tuple of variable length

2007-03-05 Thread bg_ie
Hi, I have the following tuple - t = ("one","two") And I can build a dictionary from it as follows - d = dict(zip(t,(False,False))) But what if my tuple was - t = ("one","two","three") then I'd have to use - d = dict(zip(t,(False,False,False))) Therefore, how do I build the tuple of Falses

Re: Project organization and import

2007-03-05 Thread [EMAIL PROTECTED]
On 5 mar, 01:21, "Martin Unsal" <[EMAIL PROTECTED]> wrote: > I'm using Python for what is becoming a sizeable project and I'm > already running into problems organizing code and importing packages. > I feel like the Python package system, in particular the isomorphism > between filesystem and names

Getting external IP address

2007-03-05 Thread Steven D'Aprano
I have a PC behind a firewall, and I'm trying to programmatically determine the IP address visible from outside the firewall. If I do this: >>> import socket >>> socket.gethostbyname(socket.gethostname()) '127.0.0.1' >>> socket.gethostbyname_ex(socket.gethostname()) ('localhost.localdomain', ['lo

Re: How use XML parsing tools on this one specific URL?

2007-03-05 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > >Chris> http://moneycentral.msn.com/companyreport?Symbol=BBBY > >Chris> I can't validate it and xml.minidom.dom.parseString won't work on >Chris> it. > >Chris> If this was just some teenager's web site I'd move on. Is there >Chris> any hope avoiding r

Re: Building a dictionary from a tuple of variable length

2007-03-05 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, bg_ie wrote: > Therefore, how do I build the tuple of Falses to reflect the length of > my t tuple? In [1]: dict.fromkeys(('one', 'two', 'three'), False) Out[1]: {'three': False, 'two': False, 'one': False} Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org

Re: Building a dictionary from a tuple of variable length

2007-03-05 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I have the following tuple - > > t = ("one","two") > > And I can build a dictionary from it as follows - > > d = dict(zip(t,(False,False))) > > But what if my tuple was - > > t = ("one","two","three") > > then I'd have to use - > > d = dict(zip(t,(False,False,Fals

Re: list-like behaviour of etree.Element

2007-03-05 Thread Fredrik Lundh
Raymond Hettinger wrote: > On Mar 4, 12:48 pm, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: >> The etree.Element (or ElementTree.Element) supports a number of >> list-like methods: append, insert, remove. Any special reason why it >> doesn't support pop and extend (and maybe count)? > > Those meth

Re: Getting external IP address

2007-03-05 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > from httplib import HTTPConnection from xml.dom.ext.reader.Sax import FromXmlStream conn = HTTPConnection('xml.showmyip.com') conn.request('GET', '/') doc = FromXmlStream(conn.getresponse()) print doc.getElementsByTagName(

clientcookie/clientform and checking to see if a website accepted my login details

2007-03-05 Thread socialanxiety
alright, i'm coding a program that will log me into yahoo.com (so far), now, the problem i have is that once i've submitted by login & password, the program doesn't know whether yahoo.com accepted it. " response = ClientCookie.urlopen(form.click()) " now, when i get an error, the contents of 'resp

How to create pid.lock via python?

2007-03-05 Thread Marco
Hello, I write a program control a device via RS232, I hope to add some code to let the program canNOT be used by other people when one people using. Can you tell me how to create pid.lock file in python? Thank you!! -- LinuX Power -- http://mail.python.org/mailman/listinfo/python-list

Mod python - mysql lock

2007-03-05 Thread Roopesh
Hi, In my mod_python project I am using mysql as the database. There is table card in which unique cards are stored. When a user request comes he has to get a unique card. In this situation I want to use LOCK with which I can prevent other users accessing the table. I tried excuting "LOCK" command

Howto pass exceptions between threads

2007-03-05 Thread Alexander Eisenhuth
Hallo Alltogether, I've searched in this mailing list, but it seems to me that there is no general approach to pass exceptions from one thread to another. I think most application do a unique way of handling "unhandled exceptions", at least they (should) try to log them. The following discussi

Re: list-like behaviour of etree.Element

2007-03-05 Thread Daniel Nogradi
> >> The etree.Element (or ElementTree.Element) supports a number of > >> list-like methods: append, insert, remove. Any special reason why it > >> doesn't support pop and extend (and maybe count)? > > > > Those methods would not be hard to add. Perhaps, submit a feature > > request to Fredrik Lun

Re: MS SQL Database connection

2007-03-05 Thread Tim Golden
Hitesh wrote: > Hi currently I am using DNS and ODBC to connect to MS SQL database. > Is there any other non-dns way to connect? If I want to run my script > from different server I first have to create the DNS in win2k3. Here are several ways to connect to an MSSQL database w/o having to create

Re: Mod python - mysql lock

2007-03-05 Thread Jan Danielsson
Roopesh wrote: > In my mod_python project I am using mysql as the database. There is > table card in which unique cards are stored. When a user request comes > he has to get a unique card. In this situation I want to use LOCK with > which I can prevent other users accessing the table. I tried excut

Re: How to Read Bytes from a file

2007-03-05 Thread Piet van Oostrum
> "Bart Ogryczak" <[EMAIL PROTECTED]> (BO) wrote: >BO> Any system with 8-bit bytes, which would mean any system made after >BO> 1965. I'm not aware of any Python implementation for UNIVAC, so I >BO> wouldn't worry ;-) 1965? I worked with non-8-byte machines (CDC) until the beginning of the 80

Re: Python Source Code Beautifier

2007-03-05 Thread Alan Franzoni
Il Sat, 03 Mar 2007 17:34:35 +1300, greg ha scritto: > This was all discussed at *very* great length many > years ago, and the addition of in-place operators > to the language was held up for a long time until > the present compromise was devised. You might not > like it, but it's here to stay. S

Re: How to Read Bytes from a file

2007-03-05 Thread Bart Ogryczak
On Mar 5, 10:51 am, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > > "Bart Ogryczak" <[EMAIL PROTECTED]> (BO) wrote: > >BO> Any system with 8-bit bytes, which would mean any system made after > >BO> 1965. I'm not aware of any Python implementation for UNIVAC, so I > >BO> wouldn't worry ;-) > > 1

Dictionary of Dictionaries

2007-03-05 Thread bg_ie
Hi, I have the following - messagesReceived = dict.fromkeys(("one","two"), {}) messagesReceived['one']['123'] = 1 messagesReceived['two']['121'] = 2 messagesReceived['two']['124'] = 4 This gives: {'two': {'121': 2, '123': 1, '124': 4}, 'one': {'121': 2, '123': 1

Re: How use XML parsing tools on this one specific URL?

2007-03-05 Thread Paul Boddie
On 4 Mar, 20:21, Nikita the Spider <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > > > I can't validate it and xml.minidom.dom.parseString won't work on it. [...] > Valid XHTML is scarcer than hen's teeth. It probably doesn't need to be valid: being well-formed would be sufficient

Re: Dictionary of Dictionaries

2007-03-05 Thread Amit Khemka
On 5 Mar 2007 02:22:24 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following - > > messagesReceived = dict.fromkeys(("one","two"), {}) This will create a dictionary "messagesReceived", with all the keys referring to *same instance* of the (empty) dictionary. ( try: m

Re: Dictionary of Dictionaries

2007-03-05 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, bg_ie wrote: > What am I doing wrong? `dict.fromkeys()` stores the given object for all keys, so you end up with the *same* dictionary for 'one' and 'two'. In [18]: a = dict.fromkeys(("one","two"), {}) In [19]: a Out[19]: {'two': {}, 'one': {}} In [20]: a['one']['x'] =

Re: Python Source Code Beautifier

2007-03-05 Thread Paul Boddie
On 2 Mar, 14:45, Alan Franzoni <[EMAIL PROTECTED]> wrote: > > I mean... I don't like that. I'm not really a Python expert, I found this > behaviour is documented in the language reference itself: > > http://docs.python.org/ref/augassign.html > > But... I don't know, still think it's confusing and n

Re: Dictionary of Dictionaries

2007-03-05 Thread bg_ie
On 5 Mar, 11:45, "Amit Khemka" <[EMAIL PROTECTED]> wrote: > On 5 Mar 2007 02:22:24 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have the following - > > > messagesReceived = dict.fromkeys(("one","two"), {}) > > This will create a dictionary "messagesReceived", with all the

Return type of operator on inherited class

2007-03-05 Thread looping
Hi, my question is on this example: class MyStr(str): def hello(self): print 'Hello !' s1 = MyStr('My string') s2 = MyStr('My second string') s1.hello() s2.hello() s = s1 + s2 s.hello() >>> Hello ! Hello ! Traceback (most recent call last): File "", line 204, in run_nodebug Fi

Re: Getting external IP address

2007-03-05 Thread Paul Rubin
Duncan Booth <[EMAIL PROTECTED]> writes: > If you try connecting to 'www.showmyip.com' and requesting '/xml/' it > should work. If the firewall is really obnoxious, it can bounce consecutive queries around between multiple originating IP addresses. That is uncommon but it's been done from time t

Re: Return type of operator on inherited class

2007-03-05 Thread Diez B. Roggisch
looping wrote: > Hi, > my question is on this example: > > class MyStr(str): > def hello(self): > print 'Hello !' > > s1 = MyStr('My string') > s2 = MyStr('My second string') > > s1.hello() > s2.hello() > > s = s1 + s2 > > s.hello() > > Hello ! > Hello ! > Traceback (most re

Re: list-like behaviour of etree.Element

2007-03-05 Thread John Machin
On Mar 5, 8:00 pm, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > > extend() will be in the next release: > >http://effbot.org/zone/elementtree-changes-13.htm > Hi Fredrik, "The library requires Python 2.2 or newer." -- Does this apply to cElementTree as well? Reason for asking: my xlrd packag

Re: Getting external IP address

2007-03-05 Thread Duncan Booth
Paul Rubin wrote: > Duncan Booth <[EMAIL PROTECTED]> writes: >> If you try connecting to 'www.showmyip.com' and requesting '/xml/' it >> should work. > > If the firewall is really obnoxious, it can bounce consecutive queries > around between multiple originating IP add

Re: Python stock market analysis tools?

2007-03-05 Thread Dag
On 4 Mar 2007 19:52:56 -0800, Mudcat <[EMAIL PROTECTED]> wrote: > I have done a bit of searching and can't seem to find a stock market > tool written in Python that is active. Anybody know of any? I'm trying > not to re-create the wheel here. Depends on what you mean by stock market tool. There's

Re: Building a dictionary from a tuple of variable length

2007-03-05 Thread Jussi Salmela
[EMAIL PROTECTED] kirjoitti: > Hi, > > I have the following tuple - > > t = ("one","two") > > And I can build a dictionary from it as follows - > > d = dict(zip(t,(False,False))) > > But what if my tuple was - > > t = ("one","two","three") > > then I'd have to use - > > d = dict(zip(t,(Fals

Re: Python GUI + OpenGL

2007-03-05 Thread Dag
On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Achim Domma wrote: > >> Hi, >> >> I'm developing a GUI app in Python/C++ to visualize numerical results. >> Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there >> are no windows binaries for Python

Re: Return type of operator on inherited class

2007-03-05 Thread James Stroud
looping wrote: > Hi, > my question is on this example: > > class MyStr(str): > def hello(self): > print 'Hello !' > > s1 = MyStr('My string') > s2 = MyStr('My second string') > > s1.hello() > s2.hello() > > s = s1 + s2 > > s.hello() > > Hello ! > Hello ! > Traceback (most recent c

CherryPy + Database questions

2007-03-05 Thread Brian Blais
Hello, I have more of a conceptual question about the way databases work, in a web framework, but I will be implementing things with CherryPy and SQLAlchemy. If you make a web form that adds rows to a database, and use sqlite as the engine, is there a danger of a race condition if several us

Re: CherryPy + Database questions

2007-03-05 Thread Diez B. Roggisch
Brian Blais wrote: > Hello, > > I have more of a conceptual question about the way databases work, in a > web > framework, but I will be implementing things with CherryPy and SQLAlchemy. > If you make a web form that adds rows to a database, and use sqlite as > the engine, is there a danger of a

Re: implementing SFTP using Python

2007-03-05 Thread kadarla kiran kumar
@Ben Finney I have downloaded paramiko-1.6 package, pcrypto 2.0.1 package platform: windows XP Now Iam trying to run the demo scripts available with paramiko package. I have tried using the same system for both cleint(demo_simple.py) and the server(demo_server.py) but it is faili

ANN: pyftpdlib 0.1 released

2007-03-05 Thread billiejoex
Hi all, I'm proud to announce the first beta release of pyftpdlib available at the following urls: home: http://billiejoex.altervista.org/pyftpdlib.html google code: http://code.google.com/p/pyftpdlib/ About = pyftpdlib is an high-level FTP server library based on asyncore/ asychat framework

ANN: pyftpdlib 0.1 released

2007-03-05 Thread billiejoex
Hi all, I'm proud to announce the first beta release of pyftpdlib available at the following urls: home: http://billiejoex.altervista.org/pyftpdlib.html google code: http://code.google.com/p/pyftpdlib/ About = pyftpdlib is an high-level FTP server library based on asyncore/ asychat framework

ANN: pyftpdlib 0.1 released

2007-03-05 Thread billiejoex
Hi all, I'm proud to announce the first beta release of pyftpdlib available at the following urls: home: http://billiejoex.altervista.org/pyftpdlib.html google code: http://code.google.com/p/pyftpdlib/ About = pyftpdlib is an high-level FTP server library based on asyncore/ asychat framework

Re: Python stock market analysis tools?

2007-03-05 Thread Beliavsky
On Mar 5, 12:41 am, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > On Mar 4, 7:52 pm, "Mudcat" <[EMAIL PROTECTED]> wrote: > > > I have done a bit of searching and can't seem to find a stock market > > tool written in Python that is active. Anybody know of any? I'm trying > > not to re-create the

Help Deciphering Code

2007-03-05 Thread Bryan Leber
Good Morning, I am learning python and I am having to make some changes on an existing python script. What happens is that one scripts creates an xml document that looks like this: http://www.fischerinternational.com> [EMAIL PROTECTED] Cell:(239)963-5267 Secu

Re: implementing SFTP using Python

2007-03-05 Thread Ben Finney
kadarla kiran kumar <[EMAIL PROTECTED]> writes: Please don't top-post; instead, place your reply directly beneath the quoted text you're responding to, and remove any quoted lines that aren't relevant to your response. > Now Iam trying to run the demo scripts available with paramiko package. Y

Re: ANN: pyftpdlib 0.1 released

2007-03-05 Thread Duncan Booth
"billiejoex" <[EMAIL PROTECTED]> wrote: > Hi all, > I'm proud to announce the first beta release of pyftpdlib available at > the following urls: Announcing it once will do. Three times with minor edits is a bit much. -- http://mail.python.org/mailman/listinfo/python-list

Can Epydoc exclude wxPython?

2007-03-05 Thread tom
I would like to use Epydoc (3.0beta1) to document my wxPython (2.6.10) application. The problem is that I can't seem to instruct Epydoc to not also generate partial documentation of wxPython, which makes too much verbiage for a user to wade through in order see the documentation of my program.

Re: ANN: pyftpdlib 0.1 released

2007-03-05 Thread billiejoex
On 5 Mar, 15:13, Duncan Booth <[EMAIL PROTECTED]> wrote: > "billiejoex" <[EMAIL PROTECTED]> wrote: > > Hi all, > > I'm proud to announce the first beta release of pyftpdlib available at > > the following urls: > > Announcing it once will do. Three times with minor edits is a bit much. I'm sorry. I

Re: Dictionary of Dictionaries

2007-03-05 Thread Bart Ogryczak
On Mar 5, 11:22 am, [EMAIL PROTECTED] wrote: > messagesReceived = dict.fromkeys(("one","two"), {}) This creates two references to just *one* instance of empty dictionary. I'd do it like: messagesReceived = dict([(key, {}) for key in ("one","two")]) -- http://mail.python.org/mailman/listinfo/p

Re: Descriptor/Decorator challenge

2007-03-05 Thread Arnaud Delobelle
On 5 Mar, 07:31, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > I had an idea but no time to think it through. > Perhaps the under-under name mangling trick > can be replaced (in Py3.0) with a suitably designed decorator. > Your challenge is to write the decorator. > Any trick in the book (metacl

Re: ANN: pyftpdlib 0.1 released

2007-03-05 Thread Duncan Booth
"billiejoex" <[EMAIL PROTECTED]> wrote: > I removed them by using google groups interface but maybe > with no success. You were probably successful in removing them from Google groups, but that is just one amongst many usenet servers. In general you cannot expect to delete messages from other s

Re: Dictionary of Dictionaries

2007-03-05 Thread Duncan Booth
"Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Mar 5, 11:22 am, [EMAIL PROTECTED] wrote: >> messagesReceived = dict.fromkeys(("one","two"), {}) > > This creates two references to just *one* instance of empty > dictionary. > I'd do it like: > messagesReceived = dict([(key, {}) for key in ("one","

Re: Why does SocketServer default allow_reuse_address = false?

2007-03-05 Thread Facundo Batista
Joshua J. Kugler wrote: > Considering that UNIX Network Programming, Vol 1 (by W. Richard Stevens) > recommends "_All_ TCP servers should specify [SO_REUSEADDR] to allow the > server to be restarted [if there are clients connected]," and that > self.allow_reuse_address = False makes restarting a s

Re: writing a file:newbie question

2007-03-05 Thread Facundo Batista
kavitha thankaian wrote: > say for example,,i have a file test.txt and the file has the list > > a,b,c,d, > > i would like to delete the trailing comma at the end,,, >>> "a,b,c,d,".rstrip(",") 'a,b,c,d' Regards, -- . Facundo . Blog: http://www.taniquetil.com.ar/plog/ PyAr: http

Re: how to convert an integer to a float?

2007-03-05 Thread Andrew Koenig
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, I have the following functions, but ' dx = abs(i2 - i1)/min(i2, > i1)' always return 0, can you please tell me how can i convert it from > an integer to float? I don't think that's what you really want to do. What you really want

Re: timeout in urllib.open()

2007-03-05 Thread Facundo Batista
Stefan Palme wrote: > is there a way to modify the time a call of > > urllib.open(...) > > waits for an answer from the other side? Have a tool I'm working on adding a socket_timeout parametero to urllib2.urlopen. Regards, -- . Facundo . Blog: http://www.taniquetil.com.ar/plog/ PyAr: http:

Re: threading a thread

2007-03-05 Thread Facundo Batista
tubby wrote: > I have a program written in Python that checks a class B network (65536 > hosts) for web servers. It does a simple TCP socket connect to port 80 > and times out after a certain periods of time. The program is threaded > and can do all of the hosts in about 15 minutes or so. I'd l

Re: Project organization and import

2007-03-05 Thread Martin Unsal
On Mar 5, 12:45 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Remember that you can put code in > the __init__.py of a package, and that this code can import sub- > packages/modules namespaces, making the package internal organisation > transparent to user code Sure, but that doesn't solve

Re: Python GUI + OpenGL

2007-03-05 Thread cptnwillard
You don't necessarily need an OpenGL wrapper like PyOpenGL. If you only use a handful of OpenGL functions, it would be relatively straight-forward to make your own, using ctypes. Here is what it would look like: from ctypes import cdll, windll, c_double, c_float, c_int GL_POINTS = 0x

Re: Project organization and import

2007-03-05 Thread Martin Unsal
Jorge, thanks for your response. I replied earlier but I think my response got lost. I'm trying again. On Mar 4, 5:20 pm, Jorge Godoy <[EMAIL PROTECTED]> wrote: > Why? RCS systems can merge changes. A RCS system is not a substitute for > design or programmers communication. Text merges are an e

Re: Python GUI + OpenGL

2007-03-05 Thread Diez B. Roggisch
Dag wrote: > On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <[EMAIL PROTECTED]> > wrote: >> Achim Domma wrote: >> >>> Hi, >>> >>> I'm developing a GUI app in Python/C++ to visualize numerical results. >>> Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there >>> are no windo

Re: MS SQL Database connection

2007-03-05 Thread Hitesh
On Mar 5, 4:44 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Hitesh wrote: > > Hi currently I am using DNS and ODBC to connect to MS SQL database. > > Is there any other non-dns way to connect? If I want to run my script > > from different server I first have to create the DNS in win2k3. > > Here a

worker thread catching exceptions and putting them in queue

2007-03-05 Thread Paul Sijben
All, in a worker thread setup that communicates via queues is it possible to catch exceptions raised by the worker executed, put them in an object and send them over the queue to another thread where the exception is raised in that scope? considering that an exception is an object I feel it ought

Re: worker thread catching exceptions and putting them in queue

2007-03-05 Thread Diez B. Roggisch
Paul Sijben wrote: > All, > > in a worker thread setup that communicates via queues is it possible to > catch exceptions raised by the worker executed, put them in an object > and send them over the queue to another thread where the exception is > raised in that scope? > > considering that an ex

Newbie question

2007-03-05 Thread Tommy Grav
Hi list, this is somewhat of a newbie question that has irritated me for a while. I have a file test.txt: 0.3434 0.5322 0.3345 1.3435 2.3345 5.3433 and this script lines = open("test.txt","r").readlines() for line in lines: (xin,yin,zin) = line.split() x = float(xin) y = floa

Re: worker thread catching exceptions and putting them in queue

2007-03-05 Thread Stargaming
Paul Sijben schrieb: > All, > > in a worker thread setup that communicates via queues is it possible to > catch exceptions raised by the worker executed, put them in an object > and send them over the queue to another thread where the exception is > raised in that scope? > > considering that an e

Re: Newbie question

2007-03-05 Thread Stargaming
Tommy Grav schrieb: > Hi list, > >this is somewhat of a newbie question that has irritated me for a > while. > I have a file test.txt: > > 0.3434 0.5322 0.3345 > 1.3435 2.3345 5.3433 > > and this script > lines = open("test.txt","r").readlines() > for line in lines: >(xin,yin,zin) =

Re: Project organization and import

2007-03-05 Thread Chris Mellon
On 5 Mar 2007 08:32:34 -0800, Martin Unsal <[EMAIL PROTECTED]> wrote: > Jorge, thanks for your response. I replied earlier but I think my > response got lost. I'm trying again. > > On Mar 4, 5:20 pm, Jorge Godoy <[EMAIL PROTECTED]> wrote: > > Why? RCS systems can merge changes. A RCS system is no

Re: Python GUI + OpenGL

2007-03-05 Thread Chris Mellon
On 3/5/07, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > Dag wrote: > > > On Fri, 02 Mar 2007 18:30:34 +0100, Diez B. Roggisch <[EMAIL PROTECTED]> > > wrote: > >> Achim Domma wrote: > >> > >>> Hi, > >>> > >>> I'm developing a GUI app in Python/C++ to visualize numerical results. > >>> Currently I'm

Re: How use XML parsing tools on this one specific URL?

2007-03-05 Thread Stefan Behnel
[EMAIL PROTECTED] schrieb: > I understand that the web is full of ill-formed XHTML web pages but > this is Microsoft: > > http://moneycentral.msn.com/companyreport?Symbol=BBBY > > I can't validate it and xml.minidom.dom.parseString won't work on it. Interestingly, no-one mentioned lxml so far:

Re: Python stock market analysis tools?

2007-03-05 Thread Mudcat
> What kind of tool do you want? Getting quotes is the easy part: > > import urllib > symbols = 'ibm jpm msft nok'.split() > quotes = urllib.urlopen( 'http://finance.yahoo.com/d/quotes.csv?s='+ > '+'.join(symbols) + '&f=l1&e=.csv').read().split() > print dict(zip(symbols, quotes)) > > Th

Re: Python stock market analysis tools?

2007-03-05 Thread Mudcat
On Mar 5, 7:55 am, "Beliavsky" <[EMAIL PROTECTED]> wrote: > Yes, and a discussion of investment approaches would be off-topic. > Unfortunately, newsgroups such as misc.invest.stocks are dominated by > spam -- the moderated newsgroup misc.invest.financial-plan is better. > > Some research says that

Re: Python object to xml biding

2007-03-05 Thread Stefan Behnel
raf wrote: > I'm looking for a python to XSD/xml biding library to easy handling > this very large protocol spec I need to tackle. I've searched google > quite extensibly and I haven't found anything that properly fits the > bill... I'm mostly interested at the xml -> python and python->xml > marsh

Re: Newbie question

2007-03-05 Thread Larry Bates
Tommy Grav wrote: > Hi list, > >this is somewhat of a newbie question that has irritated me for a while. > I have a file test.txt: > > 0.3434 0.5322 0.3345 > 1.3435 2.3345 5.3433 > > and this script > lines = open("test.txt","r").readlines() > for line in lines: >(xin,yin,zin) = line.s

Re: list-like behaviour of etree.Element

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 1:00 am, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: > Raymond Hettinger wrote: > > On Mar 4, 12:48 pm, "Daniel Nogradi" <[EMAIL PROTECTED]> wrote: > >> The etree.Element (or ElementTree.Element) supports a number of > >> list-like methods: append, insert, remove. Any special reason why it

Re: Newbie question

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 9:03 am, Stargaming <[EMAIL PROTECTED]> wrote: > Tommy Grav schrieb: > > For this case, there are list comprehensions (or map, but you shouldn't > use it any longer): I didn't see anything in the docs about this. Is map going away or is it considered un-Pythonic now? Josh -- http:/

Re: Mod python - mysql lock

2007-03-05 Thread John Nagle
If you use MySQL 5, you get atomic transactions. The old "LOCK" thing is becoming obsolete. Suggest getting a newer MySQL and a newer MySQL book. John Nagle Jan Danielsson wrote: > Roopesh wrote: > >>In my mod_python project I am using mysql as the database.

Re: Howto pass exceptions between threads

2007-03-05 Thread John Nagle
Alexander Eisenhuth wrote: > Hallo Alltogether, > > I've searched in this mailing list, but it seems to me that there is no > general approach to pass exceptions from one thread to another. Very few languages have that. Actually, it could be made to work for Python, but it would have to

Re: Help Deciphering Code

2007-03-05 Thread Terry Reedy
"Bryan Leber" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I am learning python and I am having to make some changes on an existing python script. What happens is that one scripts creates an xml document that looks like this: >> "IPM2.1/Identity/IdentityWebApp/Source/com/fisc/pri

Re: Project organization and import

2007-03-05 Thread Martin Unsal
On Mar 5, 9:15 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > That's actually the exact benefit of unit testing, but I don't feel > that you've actually made a case that this workflow is error prone. > You often have multiple developers working on the same parts of the > same module? Protecting y

New to Python

2007-03-05 Thread [EMAIL PROTECTED]
I am trying to get a program to add up input from the user to get to the number 100 using a loop. However, I am having some issues. Here is what I have so far. I know I am just trying to hard, but I am stuck. Thank you for any help. print "We need to count to 100" high_number = 100 total = 0

Re: FloatCanvas in a wxpython application.... layout problems

2007-03-05 Thread Chris
On Feb 21, 1:40 pm, "nelson -" <[EMAIL PROTECTED]> wrote: > Hi all, > i'm developing an application that uses Floatcanvas to diplay a > cartesian plane. how can i embed it into a "complex" layout? Your best bet is either the floatcanvas list: http://mail.mithis.com/cgi-bin/mailman/listinfo/float

Re: New to Python

2007-03-05 Thread Stargaming
[EMAIL PROTECTED] schrieb: > I am trying to get a program to add up input from the user to get to > the number 100 using a loop. However, I am having some issues. Here > is what I have so far. I know I am just trying to hard, but I am > stuck. Thank you for any help. > > print "We need to coun

Re: New to Python

2007-03-05 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I am trying to get a program to add up input from the user to get > to the number 100 using a loop. However, I am having some issues. Please, if you have a problem post the exact error symptoms. > Here is what I have so far. I know I am just trying to hard, but > I

Re: Descriptor/Decorator challenge

2007-03-05 Thread Arnaud Delobelle
On 5 Mar, 14:38, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > On 5 Mar, 07:31, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > > > I had an idea but no time to think it through. > > Perhaps the under-under name mangling trick > > can be replaced (in Py3.0) with a suitably designed decorator. >

Re: Project organization and import

2007-03-05 Thread Chris Mellon
On 5 Mar 2007 10:31:33 -0800, Martin Unsal <[EMAIL PROTECTED]> wrote: > On Mar 5, 9:15 am, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > That's actually the exact benefit of unit testing, but I don't feel > > that you've actually made a case that this workflow is error prone. > > You often have mul

Re: New to Python

2007-03-05 Thread Arnaud Delobelle
On Mar 5, 6:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am trying to get a program to add up input from the user to get to > the number 100 using a loop. However, I am having some issues. Here > is what I have so far. I know I am just trying to hard, but I am > stuck. Thank you fo

Re: New to Python

2007-03-05 Thread [EMAIL PROTECTED]
On Mar 5, 1:14 pm, "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote: > On Mar 5, 6:33 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > > > > I am trying to get a program to add up input from the user to get to > > the number 100 using a loop. However, I am having some issues. Here > > is wh

Re: Python 2.5, problems reading large ( > 4Gbyes) files on win2k

2007-03-05 Thread Bill Tydeman
On 3/4/07, Paul Duffy <[EMAIL PROTECTED]> wrote: Bill Tydeman wrote: > Just curious, but since the file size limitation on NTFS is 4 GB, have > you confirmed that it isn't some other part of the interaction that is > causing the problem? What FS is hosting the files? I don't think that is corr

Webserver balance load

2007-03-05 Thread Johny
Can anyone suggest a way how to balance load on Apache server where I have Python scripts running? For example I have 3 webservers( Apache servers) and I would like to sent user's request to one of the three server depending on a load on the server. Thank you . L. -- http://mail.python.org/mailma

Re: Webserver balance load

2007-03-05 Thread Jean-Paul Calderone
On 5 Mar 2007 11:47:15 -0800, Johny <[EMAIL PROTECTED]> wrote: >Can anyone suggest a way how to balance load on Apache server where I >have Python scripts running? >For example I have 3 webservers( Apache servers) and I would like to >sent user's request to one of the three server depending on a lo

Re: How to create pid.lock via python?

2007-03-05 Thread MrJean1
May this works for your case . /Jean Brouwers On Mar 5, 3:12 am, Marco <[EMAIL PROTECTED]> wrote: > Hello, > > I write a program control a device via RS232, I hope to add some code > to let the program canNOT be used by other peo

Using string as file

2007-03-05 Thread Florian Lindner
Hello, I have a function from a library thast expects a file object as argument. How can I manage to give the function a string resp. have the text it would have written to file object as a string? Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

Re: Using string as file

2007-03-05 Thread Arnaud Delobelle
On Mar 5, 8:13 pm, Florian Lindner <[EMAIL PROTECTED]> wrote: > Hello, > I have a function from a library thast expects a file object as argument. > How can I manage to give the function a string resp. have the text it would > have written to file object as a string? > > Thanks, > > Florian See h

Re: package_data question

2007-03-05 Thread Goldfish
On Mar 5, 1:56 am, "bytecolor" <[EMAIL PROTECTED]> wrote: > I have a simple package. I'm trying to add an examples subdirectory > with distutils. I'm using Python 2.4 on Linux. My file layout and > setup.py can be found here: > > http://www.deadbeefbabe.org/paste/3870 > > I've tried using data_file

Re: Building a dictionary from a tuple of variable length

2007-03-05 Thread Pierre Quentel
Hi, > Therefore, how do I build the tuple of Falses to reflect the length of my t > tuple? Yet another solution : d = dict(zip(t,[False]*len(t))) Pierre -- http://mail.python.org/mailman/listinfo/python-list

Re: Webserver balance load

2007-03-05 Thread Bruno Desthuilliers
Jean-Paul Calderone a écrit : > On 5 Mar 2007 11:47:15 -0800, Johny <[EMAIL PROTECTED]> wrote: > >> Can anyone suggest a way how to balance load on Apache server where I >> have Python scripts running? >> For example I have 3 webservers( Apache servers) and I would like to >> sent user's request t

Any way to determine test success from inside tearDown()?

2007-03-05 Thread Christopher Corbell
This question pertains to PyUnit, esp. unittest.TestCase subclasses. Does anyone know of a way from within the TestCase tearDown() method to determine whether the current test succeeded or not? What I'm after is a specialized clean-up approach for error/failure cases. This is somewhat related to

Re: New to Python

2007-03-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I am trying to get a program to add up input from the user to get to > the number 100 using a loop. However, I am having some issues. Here > is what I have so far. I know I am just trying to hard, but I am > stuck. Where ? May I suggest this reading ? http://www

ABC with Linux

2007-03-05 Thread Avi Anu
Im tryin to make ABC (a bitorrent client) work under linux. I installed everything, that is ABC, wxpython, glib and gtk, and now I get a python error, saying it can't find wxpython. Am I supposed to set an environmental variable too? A little learning is a dangerous thing, but we must take that

Is every number in a list in a range?

2007-03-05 Thread Steven W. Orr
I have a list ll of intergers. I want to see if each number in ll is within the range of 0..maxnum I can write it but I was wondering if there's a better way to do it? TIA -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Do

Re: Newbie question

2007-03-05 Thread Bruno Desthuilliers
Tommy Grav a écrit : > Hi list, > >this is somewhat of a newbie question that has irritated me for a > while. > I have a file test.txt: > > 0.3434 0.5322 0.3345 > 1.3435 2.3345 5.3433 > > and this script > lines = open("test.txt","r").readlines() > for line in lines: >(xin,yin,zin) =

Re: Newbie question

2007-03-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Mar 5, 9:03 am, Stargaming <[EMAIL PROTECTED]> wrote: > >>Tommy Grav schrieb: > > >>For this case, there are list comprehensions (or map, but you shouldn't >>use it any longer): > > > > I didn't see anything in the docs about this. Is map going away or is > i

  1   2   >