Re: import a user created python file as module

2006-07-30 Thread Rob Wolfe
> How and what should I do to import file1.py into file1-dir1.py ? Please > give me some references to the tutorial topic which I can study as > well. And some reference: http://docs.python.org/tut/node8.html Regards, Rob -- http://mail.python.org/mailman/listinfo/python-list

Re: Html character entity conversion

2006-07-30 Thread Claudio Grondi
John Machin wrote: > Claudio Grondi wrote: > >>[EMAIL PROTECTED] wrote: >> >>>Claudio Grondi wrote: >>> >>> [EMAIL PROTECTED] wrote: >Here is my script: > >from mechanize import * >from BeautifulSoup import * >import StringIO >b = Browser() >f =

Re: import a user created python file as module

2006-07-30 Thread Amit Khemka
On 30 Jul 2006 23:07:07 -0700, Phoe6 <[EMAIL PROTECTED]> wrote: > Hi, > I have the following directory structure in my project. > Base: > file1.py > file2.py > Directory1: >file1-dir1.py > > I am able to import file1 into file2.py > What I nee

Re: Nested function scope problem (- variable definition branch)

2006-07-30 Thread H J van Rooyen
"Gerhard Fiedler" <[EMAIL PROTECTED]> wrote: 8<- | I'm not sure where you're trying to go. I think that most people (and even | Bruno, who argued this issue most strongly) call Python variables | "variables" every now and then, or maybe even usually. But it was hel

Re: BCD List to HEX List

2006-07-30 Thread Paul Rubin
Philippe Martin <[EMAIL PROTECTED]> writes: > > Why are you avoiding naming the chip and its compiler? > > I must disagree on that one: There are many threads on this site where > people just have fun talking algorithm. I'm not an algo. expert and I know > there are many here. This is just like t

import a user created python file as module

2006-07-30 Thread Phoe6
Hi, I have the following directory structure in my project. Base: file1.py file2.py Directory1: file1-dir1.py I am able to import file1 into file2.py What I need to do is, import file1 in the file file1-dir1.py. I did not create the entire dir

Re: How do you implement this Python idiom in C++

2006-07-30 Thread alainpoint
Pierre Barbier de Reuille wrote: > [EMAIL PROTECTED] wrote: > > Pierre Barbier de Reuille wrote: > [...] > > > > I thank you for your response. The equivalent of your solution is > > posted hereunder: > > class cA(object): > > count=0 > > def __init__(self): > > sel

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > > Yes I had arm in mind (for some reason) while it is the Smc8831 > (http://www.google.com/url?sa=U&start=1&q=http://www.epsondevice.com/www/PDFS/epdoc_ic.nsf/5388db40b5eee4f949256a9c001d589f/944b73008b0bad33492570a00015d6ba/%24FILE/S5U1C88000C_2Ev3.pdf&e=9797) That appea

Re: python and JMS

2006-07-30 Thread Ravi Teja
Alan Kennedy wrote: > [tksri2000] > > I am looking to use python to talk to JMS. Can some please point me to > > such resources if this is possible. > > PyHJB is the python-to-JMS gateway. ... via HJB, the HTTP JMS bridge. > http://hjb.python-hosting.com/ > > HJB (HTTP JMS Bridge) > http://hjb.ber

Re: non-blocking PIPE read on Windows

2006-07-30 Thread placid
Dennis Lee Bieber wrote: > On 30 Jul 2006 16:22:34 -0700, "placid" <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > > > > > ;) Tsk Tsk > > Have you ever seen a Tempest VT-100? Lead shielding on the monitor > FACE... Turn the brightness all the way up and it still loo

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > >> 3. How does the device manage to compute the 8-decimal-digit number > >> that is your input?? > > What device manager ? think about it before being rude > No device manager [noun] was mentioned. You may have inferred rudeness where astonishment was being implied.

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
John Machin wrote: > Philippe Martin wrote: >> John Machin wrote: >> >> > >> > Philippe Martin wrote: >> >> Philippe Martin wrote: >> >> >> >> > Hi, >> >> > >> >> > I'm looking for an algo that would convert a list such as: >> >> > >> >> > I'm using python to prototype the algo: this will move to

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Philippe Martin wrote: > Grant Edwards wrote: > >> On 2006-07-31, John Machin <[EMAIL PROTECTED]> wrote: >> but if you wish ==> on one device, the processor in an 8-bit arm and the X-compiler is made by epson >>> >>> 1. You still haven't *NAMED* the CPU and the compiler!

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Grant Edwards wrote: > On 2006-07-31, John Machin <[EMAIL PROTECTED]> wrote: > >>> but if you >>> wish ==> >>> >>> on one device, the processor in an 8-bit arm and the X-compiler is made >>> by epson >> >> 1. You still haven't *NAMED* the CPU and the compiler!! > > He obviously doesn't want to h

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Dennis Lee Bieber wrote: > On Sun, 30 Jul 2006 17:07:57 -0500, Philippe Martin > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Paul Rubin wrote: >> >> > >> > If you prefer, You can do it all in one line: >> > >> >vlist = [int(d, 16) for d in ('%X' % int(''.join(map(

Re: BCD List to HEX List

2006-07-30 Thread Grant Edwards
On 2006-07-31, John Machin <[EMAIL PROTECTED]> wrote: >> but if you >> wish ==> >> >> on one device, the processor in an 8-bit arm and the X-compiler is made by >> epson > > 1. You still haven't *NAMED* the CPU and the compiler!! He obviously doesn't want to have to kill all of us. > 2. Do you m

Re: BCD List to HEX List

2006-07-30 Thread Grant Edwards
On 2006-07-30, John Machin <[EMAIL PROTECTED]> wrote: >> Yes, I came here for the "algorithm" question, not the code >> result. > > This is comp.lang.python, not comp.algorithms > > Why are you avoiding naming the chip and its compiler? It's top secret. If he told us, he'd have to kill us. --

Re: replacing single line of text

2006-07-30 Thread saad82
Simon & Tim, very valuable responses. Thank you much! Simon Forman wrote: > [EMAIL PROTECTED] wrote: > > I want to be able to replace a single line in a large text file > > (several hundred MB). Using the cookbook's method (below) works but I > > think the replace fxn chokes on such a large chunk

Re: Html character entity conversion

2006-07-30 Thread John Machin
Claudio Grondi wrote: > [EMAIL PROTECTED] wrote: > > Claudio Grondi wrote: > > > >>[EMAIL PROTECTED] wrote: > >> > >>>Here is my script: > >>> > >>>from mechanize import * > >>>from BeautifulSoup import * > >>>import StringIO > >>>b = Browser() > >>>f = b.open("http://www.translate.ru/text.asp?lang

re: how to stop python

2006-07-30 Thread Dan
bruce bedouglas at earthlink.net posted: > perl has the concept of "die". does python have anything > similar. how can a python app be stopped? I see this sort of statement a lot in Perl: open(FH, "myfile.txt") or die ("Could not open file"); I've no idea why you're asking for the Python

Re: Windows vs. Linux

2006-07-30 Thread BartlebyScrivener
Windows XP is fine. I am learning Python on Windows first with an eye toward moving to Linux. If you like, get the ActivePython distribution, which comes with the Win32 extensions. If you start liking Python, consider adding the IPython shell. There are commandline tweaks you can do to make the X

Re: Small problem with print and comma

2006-07-30 Thread Dustan
Dennis Lee Bieber wrote: > > for i in range(0,len(param)): > > print a[i], > > for it in param: > print it, That's one way. However, if you need the position (this is for future reference; you don't need the position number here): for i in range(len(param)+1): prin

pass parameters in SPYCE

2006-07-30 Thread kepioo
Hi all, I started to use the so good spyce server. I manage to do all the basics, however, I still block on one problem : How can I pass parameters to a spy page : example I have an index page : link1 link2 link3 link4 I want all theses html links to point to process.spy with the value of the

Re: Windows vs. Linux

2006-07-30 Thread James Stroud
[EMAIL PROTECTED] wrote: > Okay, once-upon-a-time I tried to start programming by learning C. At > the time I was younger and didn't really understand all that C had to > offer. I eventually moved over to Microsoft's Visual Basic. It was > nice to be able to design a visual application with no e

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > John Machin wrote: > > > > > Philippe Martin wrote: > >> John Machin wrote: > >> > >> > Have you considered asking on a newsgroup where your problem might > >> > actually be on-topic, like: > >> > comp.lang.c > >> > >> Yes, I came here for the "algorithm" question, not

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > John Machin wrote: > > > > > Philippe Martin wrote: > >> Philippe Martin wrote: > >> > >> > Hi, > >> > > >> > I'm looking for an algo that would convert a list such as: > >> > > >> > I'm using python to prototype the algo: this will move to C in an > >> > embedded system wh

Re: Windows vs. Linux

2006-07-30 Thread OMouse
Python should port nicely between Windows and Linux so there should be no need to dual-boot. [EMAIL PROTECTED] wrote: > Okay, once-upon-a-time I tried to start programming by learning C. At > the time I was younger and didn't really understand all that C had to > offer. I eventually moved over t

Re: Windows vs. Linux

2006-07-30 Thread William Witteman
On Sun, Jul 30, 2006 at 04:21:34PM -0700, [EMAIL PROTECTED] wrote: >offer. I eventually moved over to Microsoft's Visual Basic. It was I'm very sorry. >Long story short, I want to get back into programming, and Python looks >like a good choice for me to start with, and maybe become advanced >

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
John Machin wrote: > > Philippe Martin wrote: >> John Machin wrote: >> >> > Have you considered asking on a newsgroup where your problem might >> > actually be on-topic, like: >> > comp.lang.c >> >> Yes, I came here for the "algorithm" question, not the code result. >> > > This is comp.lang.

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
John Machin wrote: > > Philippe Martin wrote: >> Philippe Martin wrote: >> >> > Hi, >> > >> > I'm looking for an algo that would convert a list such as: >> > >> > I'm using python to prototype the algo: this will move to C in an >> > embedded system where an int has 16 bits - I do not wish to use

Re: Windows vs. Linux

2006-07-30 Thread Damjan
> Right now I run Windows as my main operating system. On my old > laptop I ran Ubuntu, and liked it very much; however, my new laptop has > a Broadcom wireless card, and it's not very Linux friendly. of topic: that Broadcom wireless card has a driver included in the latest kernel 2.6.17, and pro

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > John Machin wrote: > > > Have you considered asking on a newsgroup where your problem might > > actually be on-topic, like: > > comp.lang.c > > Yes, I came here for the "algorithm" question, not the code result. > This is comp.lang.python, not comp.algorithms Why are

Re: Windows vs. Linux

2006-07-30 Thread Aahz
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: > >Long story short, I want to get back into programming, and Python looks >like a good choice for me to start with, and maybe become advanced >with. Right now I run Windows as my main operating system. On my old >laptop I ran Ubuntu, an

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > Philippe Martin wrote: > > > Hi, > > > > I'm looking for an algo that would convert a list such as: > > > > I'm using python to prototype the algo: this will move to C in an embedded > > system where an int has 16 bits - I do not wish to use any python library. > > > > l1

Re: non-blocking PIPE read on Windows

2006-07-30 Thread placid
Dennis Lee Bieber wrote: > On 27 Jul 2006 22:26:25 -0700, "placid" <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > > > > > readline() blocks until the newline character is read, but when i use > > read(X) where X is a number of bytes then it doesnt block(expected > > functiona

Windows vs. Linux

2006-07-30 Thread noahmd
Okay, once-upon-a-time I tried to start programming by learning C. At the time I was younger and didn't really understand all that C had to offer. I eventually moved over to Microsoft's Visual Basic. It was nice to be able to design a visual application with no effort (too bad I didn't really le

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
John Machin wrote: > Have you considered asking on a newsgroup where your problem might > actually be on-topic, like: > comp.lang.c Yes, I came here for the "algorithm" question, not the code result. Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list

Re: Small problem with print and comma

2006-07-30 Thread Tim Chase
> I have a small problem with my function: printList. I use print with a > ',' . Somehow the last digit of the last number isn't printed. I wonder > why. Posting actual code might help...the code you sent has a horrible mix of tabs and spaces. You've also got some craziness in your "creating r

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > John Machin wrote: > > > Philippe Martin wrote: > > > >> > >> Thanks John, I do not have a long available on the device: stuck with 16 > >> bits. > >> > > > > What does "available on the device" mean? Having a "long" is a property > > of a C complier, not a device. What is

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Philippe Martin wrote: > Hi, > > I'm looking for an algo that would convert a list such as: > > I'm using python to prototype the algo: this will move to C in an embedded > system where an int has 16 bits - I do not wish to use any python library. > > l1 = [1,2,3,4,6,7,8] #represents the decima

Re: BCD List to HEX List

2006-07-30 Thread Paul Rubin
Philippe Martin <[EMAIL PROTECTED]> writes: > Thanks John, I do not have a long available on the device: stuck with 16 > bits. Oh, I think I understand now, why you were asking about algorithms. You really did want something whose intermediate results all fit in 16 bits. Even if your C compiler

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
John Machin wrote: > Philippe Martin wrote: > >> >> Thanks John, I do not have a long available on the device: stuck with 16 >> bits. >> > > What does "available on the device" mean? Having a "long" is a property > of a C complier, not a device. What is the CPU in the device? What is > the C com

Re: Html character entity conversion

2006-07-30 Thread Claudio Grondi
[EMAIL PROTECTED] wrote: > Claudio Grondi wrote: > >>[EMAIL PROTECTED] wrote: >> >>>Here is my script: >>> >>>from mechanize import * >>>from BeautifulSoup import * >>>import StringIO >>>b = Browser() >>>f = b.open("http://www.translate.ru/text.asp?lang=ru";) >>>b.select_form(nr=0) >>>b["source"]

Re: Small problem with print and comma

2006-07-30 Thread faulkner
why don't you iterate over the list instead of indices? for elem in L: print elem, you don't need the 0 when you call range: range(0, n) == range(n) the last element of a range is n-1: range(n)[-1] == n-1 you don't need while to iterate backwards. the third argument to range is step. range(n-1, -1

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > > Thanks John, I do not have a long available on the device: stuck with 16 > bits. > What does "available on the device" mean? Having a "long" is a property of a C complier, not a device. What is the CPU in the device? What is the C compiler you are using? N.B. Last time

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Paul Rubin wrote: > Philippe Martin <[EMAIL PROTECTED]> writes: >> I'm just using Python to prototype, so I cannot use any of these great >> features of the language. > > I think when writing a prototype, you should use whatever features you > want, except maybe at the upper levels of program org

Re: BCD List to HEX List

2006-07-30 Thread Paul Rubin
Philippe Martin <[EMAIL PROTECTED]> writes: > I'm just using Python to prototype, so I cannot use any of these great > features of the language. I think when writing a prototype, you should use whatever features you want, except maybe at the upper levels of program organization. The idea of proto

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Dennis Lee Bieber wrote: > On Sun, 30 Jul 2006 16:39:47 -0500, Philippe Martin > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> >> My apologies, I clearly made a mistake with my calculator, yes the >> resulting array I would need is [0xb,0xc,0x6,0x1,0x4,0xe] >> > Take note

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
John Machin wrote: > Philippe Martin wrote: >> John Machin wrote: >> >> > Philippe Martin wrote: >> >> Hi, >> >> >> >> I'm looking for an algo that would convert a list such as: >> > >> > Such as what? >> > >> >> >> >> I'm using python to prototype the algo: this will move to C in an >> >> embedde

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > John Machin wrote: > > > Philippe Martin wrote: > >> Hi, > >> > >> I'm looking for an algo that would convert a list such as: > > > > Such as what? > > > >> > >> I'm using python to prototype the algo: this will move to C in an > >> embedded system where an int has 16 bits

Small problem with print and comma

2006-07-30 Thread [EMAIL PROTECTED]
Hi, I have a small problem with my function: printList. I use print with a ',' . Somehow the last digit of the last number isn't printed. I wonder why. import random def createRandomList(param): length = param a = [] creating random list""" for i in range(0,length):

ftplib errors/exceptions

2006-07-30 Thread Matthew Little
I'm new to Python and I am writing a simple FTP client.  I am having trouble handling errors like connection refused, invalid username or password, and the like.  I can use a try exception block like thistry:  ftp=FTP('some_server')   ftp.login()  # more linesexcept:  print "An error has occured.\n

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Paul Rubin wrote: > Philippe Martin <[EMAIL PROTECTED]> writes: >> I'm using python to prototype the algo: this will move to C in an >> embedded system where an int has 16 bits - I do not wish to use any >> python library. >> >> l1 = [1,2,3,4,6,7,8] #represents the decimal number 12345678 > > Th

Re: BCD List to HEX List

2006-07-30 Thread Paul Rubin
Philippe Martin <[EMAIL PROTECTED]> writes: > I'm using python to prototype the algo: this will move to C in an embedded > system where an int has 16 bits - I do not wish to use any python library. > > l1 = [1,2,3,4,6,7,8] #represents the decimal number 12345678 This is untested, but should give

Execution timeout

2006-07-30 Thread lorenzo . viscanti
X-No-Archive: yes Hi, I'm using feedparser to parse some xml feeds. As others reported (http://sourceforge.net/tracker/index.php?func=detail&aid=1519461&group_id=112328&atid=661937 ) the library halts while parsing some feeds. To overcome this issue I was thinking about creating some kind of wrap

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
John Machin wrote: > Philippe Martin wrote: >> Hi, >> >> I'm looking for an algo that would convert a list such as: > > Such as what? > >> >> I'm using python to prototype the algo: this will move to C in an >> embedded system where an int has 16 bits - I do not wish to use any >> python library

Re: BCD List to HEX List

2006-07-30 Thread John Machin
Philippe Martin wrote: > Hi, > > I'm looking for an algo that would convert a list such as: Such as what? > > I'm using python to prototype the algo: this will move to C in an embedded > system where an int has 16 bits - I do not wish to use any python library. > > l1 = [1,2,3,4,6,7,8] #represent

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Philippe Martin wrote: > >> Marc 'BlackJack' Rintsch wrote: >> >>> And now please describe you problem a little better. ;-) >> >> I'll try. >> >> first of all python is not going to be used for my purpose (sigh) >> >> I have device A

Re: BCD List to HEX List

2006-07-30 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Philippe Martin wrote: > Marc 'BlackJack' Rintsch wrote: > >> And now please describe you problem a little better. ;-) > > I'll try. > > first of all python is not going to be used for my purpose (sigh) > > I have device A which holds a binary coded decimal array [N1,N

Re: Smaple of recursive directory walker

2006-07-30 Thread Traveler
Thank you very much that is what i was looking for. On 30 Jul 2006 13:18:51 -0700, "Ant" <[EMAIL PROTECTED]> wrote: > >Traveler wrote: >> yes this is great i will work from that but how can i use say a list >> to pass 10 words? >> >> mylist = ['word1','word2','word3','word4'] >... >> >for root,

Re: BCD List to HEX List

2006-07-30 Thread Philippe Martin
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Philippe Martin wrote: > >> I'm looking for an algo that would convert a list such as: >> >> I'm using python to prototype the algo: this will move to C in an >> embedded system where an int has 16 bits - I do not wish to use any >> pytho

Re: BCD List to HEX List

2006-07-30 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Philippe Martin wrote: > I'm looking for an algo that would convert a list such as: > > I'm using python to prototype the algo: this will move to C in an embedded > system where an int has 16 bits - I do not wish to use any python library. > > l1 = [1,2,3,4,6,7,8] #repres

Re: Html character entity conversion

2006-07-30 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Here is my script: > > from mechanize import * > from BeautifulSoup import * > import StringIO > b = Browser() > f = b.open("http://www.translate.ru/text.asp?lang=ru";) > b.select_form(nr=0) > b["source"] = "hello python" > html = b.submit().get_

Re: how to make python socket server work with the app.MainLoop() in wxpython?

2006-07-30 Thread Philippe Martin
Grant Edwards wrote: > On 2006-07-30, Philippe Martin <[EMAIL PROTECTED]> wrote: > >> If you get rid of app.MaiLoop(), you basically get rid of all GUI events. >> You need to have you server in a separate thread. > > Isn't there any way to use wxWidgets socket callbacks in wxPython? > > -- > Gr

BCD List to HEX List

2006-07-30 Thread Philippe Martin
Hi, I'm looking for an algo that would convert a list such as: I'm using python to prototype the algo: this will move to C in an embedded system where an int has 16 bits - I do not wish to use any python library. l1 = [1,2,3,4,6,7,8] #represents the decimal number 12345678 l2 = func (l1) # l2 =

Mouse LED Control in Python

2006-07-30 Thread semagraw
I found this link that describes the byte arrays to control the IM/Email Leds on my Logitech MX610 mouse: http://www.kdedevelopers.org/node/2029 The link to the tarball is dead so I can't look at that. Is there anyway to do what the link says in Python? If you follow the link above, it talks abo

Re: Smaple of recursive directory walker

2006-07-30 Thread Ant
Traveler wrote: > yes this is great i will work from that but how can i use say a list > to pass 10 words? > > mylist = ['word1','word2','word3','word4'] ... > >for root, dirs, files in os.walk('~/mydir'): > >for file in [f for f in files if f.endswith(".txt")]: > >fh = open(file) > >

Re: Nested function scope problem

2006-07-30 Thread Gerhard Fiedler
On 2006-07-30 12:45:50, Antoon Pardon wrote: >> [...] we'd have to use a common definition of "variable". This is a term >> so widely used that I'm not sure there is a useful single definition of >> it; do you know one? > > A name in a scope to which is attached some value/object. Now whether > t

Re: How do you implement this Python idiom in C++

2006-07-30 Thread Pierre Barbier de Reuille
[EMAIL PROTECTED] wrote: > Pierre Barbier de Reuille wrote: [...] > > I thank you for your response. The equivalent of your solution is > posted hereunder: > class cA(object): > count=0 > def __init__(self): > self.__class__.count +=1 > @classmethod >

Re: Html character entity conversion

2006-07-30 Thread [EMAIL PROTECTED]
danielx wrote: > [EMAIL PROTECTED] wrote: > > Here is my script: > > > > from mechanize import * > > from BeautifulSoup import * > > import StringIO > > b = Browser() > > f = b.open("http://www.translate.ru/text.asp?lang=ru";) > > b.select_form(nr=0) > > b["source"] = "hello python" > > html = b.su

Re: Html character entity conversion

2006-07-30 Thread [EMAIL PROTECTED]
Claudio Grondi wrote: > [EMAIL PROTECTED] wrote: > > Here is my script: > > > > from mechanize import * > > from BeautifulSoup import * > > import StringIO > > b = Browser() > > f = b.open("http://www.translate.ru/text.asp?lang=ru";) > > b.select_form(nr=0) > > b["source"] = "hello python" > > htm

Re: Fastest Way To Loop Through Every Pixel

2006-07-30 Thread Chaos
Paul McGuire wrote: > "Paul McGuire" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > "Chaos" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > > > > > > myCol = (0.3 * image.GetRed(thisX, thisY)) + (0.59 * > > > image.GetGreen(thisX, thisY)) + (0.11 * image.

Re: How do you implement this Python idiom in C++

2006-07-30 Thread alainpoint
Pierre Barbier de Reuille wrote: > [EMAIL PROTECTED] wrote: > > Rob Williscroft wrote: > > > >> If this is more than idle curiosity I strongly suggest you post > >> a version of the python code you need to translate to C++. > > > > For the moment this is just healthy curiosity but i will still pos

Re: how to make python socket server work with the app.MainLoop() in wxpython?

2006-07-30 Thread bryanjugglercryptographer
Philippe Martin wrote: > Philippe Martin wrote: > > You need to have you server in a separate thread. > PS: > > http://wiki.wxpython.org/index.cgi/LongRunningTasks And here's an important bit from the wxWindows doc: For communication between secondary threads and the main thread, you may us

Re: class variables

2006-07-30 Thread faulkner
python != java. when you say "self.v = ...", you mask the class attribute with an instance attribute. say "C1.v = ...". Colin J. Williams wrote: > Andre Meyer wrote: > > Hi all > > > > I am trying to understand the magic of Python's class variables and > > tried the following code (see below). > >

Re: Nested function scope problem

2006-07-30 Thread Antoon Pardon
On 2006-07-30, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-30 09:54:14, Antoon Pardon wrote: > >> Aren't you looking too much at implementation details now? > > Possibly, but at this point I'm still trying to understand how Python does > these things, and what the useful abstraction lev

Re: Html character entity conversion

2006-07-30 Thread danielx
[EMAIL PROTECTED] wrote: > Here is my script: > > from mechanize import * > from BeautifulSoup import * > import StringIO > b = Browser() > f = b.open("http://www.translate.ru/text.asp?lang=ru";) > b.select_form(nr=0) > b["source"] = "hello python" > html = b.submit().get_data() > soup = BeautifulS

Re: Html character entity conversion

2006-07-30 Thread Claudio Grondi
[EMAIL PROTECTED] wrote: > Here is my script: > > from mechanize import * > from BeautifulSoup import * > import StringIO > b = Browser() > f = b.open("http://www.translate.ru/text.asp?lang=ru";) > b.select_form(nr=0) > b["source"] = "hello python" > html = b.submit().get_data() > soup = Beautiful

Re: how to make python socket server work with the app.MainLoop() in wxpython?

2006-07-30 Thread zxo102
Philippe, Thanks a lot. I got the idea. Let me try it. Ouyang Philippe Martin 写道: > Philippe Martin wrote: > > > zxo102 wrote: > > > >> Hi everyone, > >> I am using a python socket server to collect data from a socket > >> client and then control a image location ( wxpython) with the data,

Re: how to make python socket server work with the app.MainLoop() in wxpython?

2006-07-30 Thread Grant Edwards
On 2006-07-30, Philippe Martin <[EMAIL PROTECTED]> wrote: > If you get rid of app.MaiLoop(), you basically get rid of all GUI events. > You need to have you server in a separate thread. Isn't there any way to use wxWidgets socket callbacks in wxPython? -- Grant Edwards grante

Re: metaclass : parse all class once before doing anything else ?

2006-07-30 Thread gene tani
Paddy wrote: > Laurent Rahuel wrote: > > > > Laurent. > > I, like Diez am unsure of why you would need what you have asked for, > but maybe this will help. > > You can keep track of all instances of a class by this kind of thing: > > >>> class C1(object): > ... inst = [] > ... def __init__(se

Re: how to make python socket server work with the app.MainLoop() in wxpython?

2006-07-30 Thread Philippe Martin
Philippe Martin wrote: > zxo102 wrote: > >> Hi everyone, >> I am using a python socket server to collect data from a socket >> client and then control a image location ( wxpython) with the data, >> i.e. moving the image around in the wxpython frame. >>But the "app.MainLoop()" in wxpython

Re: how to make python socket server work with the app.MainLoop() in wxpython?

2006-07-30 Thread Philippe Martin
zxo102 wrote: > Hi everyone, > I am using a python socket server to collect data from a socket > client and then control a image location ( wxpython) with the data, > i.e. moving the image around in the wxpython frame. >But the "app.MainLoop()" in wxpython looks like conflicting with > th

how to make python socket server work with the app.MainLoop() in wxpython?

2006-07-30 Thread zxo102
Hi everyone, I am using a python socket server to collect data from a socket client and then control a image location ( wxpython) with the data, i.e. moving the image around in the wxpython frame. But the "app.MainLoop()" in wxpython looks like conflicting with the "while 1:" in socket serv

Re: Nested function scope problem

2006-07-30 Thread Gerhard Fiedler
On 2006-07-30 09:54:14, Antoon Pardon wrote: > Aren't you looking too much at implementation details now? Possibly, but at this point I'm still trying to understand how Python does these things, and what the useful abstraction level is for me. I also still have very little experience how I'll put

Html character entity conversion

2006-07-30 Thread [EMAIL PROTECTED]
Here is my script: from mechanize import * from BeautifulSoup import * import StringIO b = Browser() f = b.open("http://www.translate.ru/text.asp?lang=ru";) b.select_form(nr=0) b["source"] = "hello python" html = b.submit().get_data() soup = BeautifulSoup(html) print soup.find("span", id = "r_tex

Re: Nested function scope problem

2006-07-30 Thread Antoon Pardon
On 2006-07-29, Gerhard Fiedler <[EMAIL PROTECTED]> wrote: > On 2006-07-29 13:47:37, Antoon Pardon wrote: > >> I think the important thing to remember is that the assignment in Python >> is a alias maker and not a copy maker. In languages like C, Fortran, >> pascal, the assignment makes a copy from

Re: class variables

2006-07-30 Thread Colin J. Williams
Andre Meyer wrote: > Hi all > > I am trying to understand the magic of Python's class variables and > tried the following code (see below). > > Just out of curiosity, I tried to define a property that provides access > to a seemingly instancae variable which is in fact a class variable. All >

Re: python and JMS

2006-07-30 Thread Alan Kennedy
[tksri2000] > I am looking to use python to talk to JMS. Can some please point me to > such resources if this is possible. PyHJB is the python-to-JMS gateway. ... via HJB, the HTTP JMS bridge. http://hjb.python-hosting.com/ HJB (HTTP JMS Bridge) http://hjb.berlios.de/ HTH, -- alan kennedy -

Re: Newbie..Needs Help

2006-07-30 Thread Anthra Norell
Graham, Would it help to use another web site? Not as long as the program works on this site. If it doesn't it may help to change sites, but a new reader would have to be crafted. Towards this my code may look intimidating. It isn't really a good example for a demo, because it looks scary. As I

Re: install python on cdrom

2006-07-30 Thread Martin v. Löwis
Fabian Braennstroem schrieb: > I look for an easy way to use the newest scipy, pyvtk, matplotlib, > f2py, numpy, paraview/vtk,... on a entreprise redhat machine > without administration rights. > My first thought was to install the whole new python system > on a cdrom/dvd and mounting it, when I ne

Re: Looking for a regular expression for this...

2006-07-30 Thread Anthra Norell
- Original Message - From: <[EMAIL PROTECTED]> To: Sent: Friday, July 28, 2006 10:30 PM Subject: Looking for a regular expression for this... > Hi, > My string is a multi line string that contains "filename > \n" and "host \n" entries among other things. > > For example: s

Re: How to force a thread to stop

2006-07-30 Thread H J van Rooyen
"Damjan" <[EMAIL PROTECTED]> wrote: | > | A common recovery mechanism in embedded systems is a watchdog timer, | > | which is a hardware device that must be poked by the software every | > | so often (e.g. by writing to some register). If too long an interval | > | goes by without a poke, the WD

Re: write()

2006-07-30 Thread Andy Salnikov
"manuhack" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I copied the lines > > f=open('/tmp/workfile', 'w') > print f > f.close() > > from Python 2.4 Documentation 7.2. But it said IOerror No such file or > directory" '/tmp/workfile' > > Is it something about the os? I'm using P

Re: python and JMS

2006-07-30 Thread Ravi Teja
> I am looking to use python to talk to JMS. Can some please point me to > such resources if this is possible. JPype http://jpype.sourceforge.net/ Jython http://www.jython.org/ -- http://mail.python.org/mailman/listinfo/python-list