Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-25 Thread Carl Banks
On Oct 25, 9:04 pm, rh0dium wrote: > On Oct 22, 9:05 pm, Carl Banks wrote: > > This should suffice for you: > > > class Borg(object): > >     __shared_state = {} > >     def __init__(self, noSend=False,reportLevel=30, > >                  reportMethods="BaseReport", > >                  contacts=

RE: Python GUI

2009-10-25 Thread Dylan Palmboom
PyQt is what we use at work and it is excellent and easy to learn too! I definitely recommend it. -Original Message- From: Philip Semanchuk [mailto:phi...@semanchuk.com] Sent: 26 October 2009 03:42 AM To: Python-list (General) Subject: Re: Python GUI On Oct 25, 2009, at 8:39 PM, Ronn

Re: How to modify local variables from internal functions?

2009-10-25 Thread Steven D'Aprano
On Sat, 24 Oct 2009 00:19:12 +, kj wrote: > I like Python a lot, and in fact I'm doing most of my scripting in > Python these days, but one thing that I absolutely *DETEST* > about Python is that it does allow an internal function to modify > variables in the enclosing local scope. Yo

Re: How to modify local variables from internal functions?

2009-10-25 Thread Steven D'Aprano
On Sat, 24 Oct 2009 00:19:12 +, kj wrote: > I like Python a lot, and in fact I'm doing most of my scripting in > Python these days, but one thing that I absolutely *DETEST* > about Python is that it does allow an internal function to modify > variables in the enclosing local scope. Yo

Re: Python 3.1.1 bytes decode with replace bug

2009-10-25 Thread Mark Tolonen
"Dave Angel" wrote in message news:4ae43150.9010...@ieee.org... Joe wrote: For the reason BK explained, the important difference is that I ran in the IDLE shell, which handles screen printing of unicode better ;-) Something still does not seem right here to me. In the example above the by

Re: python web service or Apache?

2009-10-25 Thread Simon Forman
On Sun, Oct 25, 2009 at 4:47 PM, Peng Yu wrote: > Although, python can be used to provide web service. The following > webpage also mentioned, "Apache the best and most widely used web > server on the Internet today, check it out. If you want to run your > own web server this is the one to get, yo

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-25 Thread rh0dium
Carl, First off - Thanks your post was exactly the kind of informative example driven learnings that help — Thanks!! On Oct 22, 9:05 pm, Carl Banks wrote: > > Before we get into object semantics, I'm not sure why you'd need to > override __new__ for Borg pattern, unless they're working around

Re: Python GUI

2009-10-25 Thread Grant Edwards
On 2009-10-26, Philip Semanchuk wrote: > > On Oct 25, 2009, at 8:39 PM, Ronn Ross wrote: > >> I need to create a gui for python. I'm looking for something that is >> easy to >> learn and cross platform. Any suggestions? If you have any good >> tutorials >> please send along. Thanks in advance.

Re: Python GUI

2009-10-25 Thread geremy condra
On Sun, Oct 25, 2009 at 10:03 PM, Ronn Ross wrote: > Philip, > > PySide looks nice and you are right it is still very young. I'm still going > to give it a try. Thanks for your help. > > On Sun, Oct 25, 2009 at 9:41 PM, Philip Semanchuk > wrote: >> >> On Oct 25, 2009, at 8:39 PM, Ronn Ross wrote:

Re: Python GUI

2009-10-25 Thread Ronn Ross
Philip, PySide looks nice and you are right it is still very young. I'm still going to give it a try. Thanks for your help. On Sun, Oct 25, 2009 at 9:41 PM, Philip Semanchuk wrote: > > On Oct 25, 2009, at 8:39 PM, Ronn Ross wrote: > > I need to create a gui for python. I'm looking for something

Re: Python GUI

2009-10-25 Thread Philip Semanchuk
On Oct 25, 2009, at 8:39 PM, Ronn Ross wrote: I need to create a gui for python. I'm looking for something that is easy to learn and cross platform. Any suggestions? If you have any good tutorials please send along. Thanks in advance. wxPython (which wraps wxWidgets) is popular and IMO re

Re: Web development with Python 3.1

2009-10-25 Thread Brendon Wickham
> > Anyway, for simple web programming, frameworks are not worth the > hassle. Just use the cgi module. > > I can vouch for what Paul says. I started in Python 3 years ago, and I did so with a web application (still working on it!). I'm using the cgi approach, and it certainly teaches you the conc

Re: Web development with Python 3.1

2009-10-25 Thread exarkun
On 25 Oct, 11:52 pm, a...@baselinedata.co.uk wrote: I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting "don't - start with 2.6"), but as far as I can see, none of the popular python-to-web fr

Re: Web development with Python 3.1

2009-10-25 Thread Paul Rubin
Alan Harris-Reid writes: > I am very much new to Python, and one of my first projects is a simple > data-based website. I am starting with Python 3.1 (I can hear many of > you shouting "don't - start with 2.6"), but as far as I can see, none > of the popular python-to-web frameworks (Django, Cherr

Python GUI

2009-10-25 Thread Ronn Ross
I need to create a gui for python. I'm looking for something that is easy to learn and cross platform. Any suggestions? If you have any good tutorials please send along. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Web development with Python 3.1

2009-10-25 Thread Alan Harris-Reid
I am very much new to Python, and one of my first projects is a simple data-based website. I am starting with Python 3.1 (I can hear many of you shouting "don't - start with 2.6"), but as far as I can see, none of the popular python-to-web frameworks (Django, CherryPy, web.py, etc.) are Python

Re: Is __mul__ sufficient for operator '*'?

2009-10-25 Thread Mick Krippendorf
Muhammad Alkarouri schrieb: > I was having a go at a simple implementation of Maybe in Python when I > stumbled on a case where x.__mul__(y) is defined while x*y is not. > > class Maybe(object): > def __init__(self, obj): > self.o = obj > def __repr__(self): > return 'Maybe

python web service or Apache?

2009-10-25 Thread Peng Yu
Although, python can be used to provide web service. The following webpage also mentioned, "Apache the best and most widely used web server on the Internet today, check it out. If you want to run your own web server this is the one to get, you can get binaries for both Windows and Unix. You can dow

Re: lambda forms within a loop

2009-10-25 Thread Paul Rubin
Michal Ostrowski writes: > def MakeLambdaBad(): > a = [] > for x in [1,2]: > a.append(lambda q: x + q) > return a The problem here is that x is a free variable in the lambdas that you put in a. When you actually evaluate those lambdas, they use whatever the value of x happens to be a

Re: lambda forms within a loop

2009-10-25 Thread Scott David Daniels
Michal Ostrowski wrote: ... [a,b] = MakeLambda() print a(10) print b(10) Here is yet another way to solve the problem: import functools def AddPair(x, q): return x + q a, b = [functools.partial(AddPair, x) for x in [1, 2]] print a(10) print b(10) Or even, since the

virtualenv under Win7: easy_install fails in virtual environments

2009-10-25 Thread Guillermo
Hi, I've installed setuptools for my default python installation and it works perfectly without even asking for admin credentials to install packages. After that I've installed virtualenv. If I do: >>> virtualenv x ... a new virtual environment is created, but whenever I try to run easy_instal

Extracting text using Beautifulsoup

2009-10-25 Thread TC
Greetings all. Working with data from 'http://www.finviz.com/quote.ashx?t=SRS', I was able to get the info using re, however I thought using Beautifulsoup a more elegant approach. Having a bit of a problem though... Trying to extract text: SMA20 -1.77% SMA50 -9.73% utilizing attribute bod

OT Virtual Server Host

2009-10-25 Thread Victor Subervi
Hi; Completely OT, but my back's up against the wall. I'm convinced that the reason my codes keep breaking--and even stable installations of s/w from SourceForge such as SimpleMail--on the hosts I've been using is because their hardware should have conservatively been trashed 5 years ago. It's simp

Re: Listing variables

2009-10-25 Thread vsoler
On Oct 25, 5:07 pm, Tim Chase wrote: > >> t...@rubbish:~/tmp$ rm test.py test.pyc > >> t...@rubbish:~/tmp$ python2.5 > >>  >>> import test > >>  >>> dir(test) > >> ['__builtins__', '__doc__', '__file__', '__name__', '__path__'] > >>  >>> test.__file__ > >> '/usr/lib/python2.5/test/__init__.pyc' >

Python-URL! - weekly Python news and links (Oct 25)

2009-10-25 Thread Gabriel Genellina
QOTW: "It was intended to be understood, not copied." - Dave Angel comments on a characteristic of didactic examples http://groups.google.com/group/comp.lang.python/msg/61e2d60d08f1c630 Altering the default character encoding (sys.setdefaultencoding) is never a good idea:

Python-URL! - weekly Python news and links (Oct 25)

2009-10-25 Thread Cameron Laird
QOTW: "It was intended to be understood, not copied." - Dave Angel comments on a characteristic of didactic examples http://groups.google.com/group/comp.lang.python/msg/61e2d60d08f1c630 Altering the default character encoding (sys.setdefaultencoding) is never a good idea: ^://gr

Solving System of Linear Equation (SLE) - FuncDesigner example

2009-10-25 Thread dmitrey
Hi all, I would like to introduce a couple examples of easy & convenient modelling and solving System of Linear Equation (SLE) by FuncDesigner (a python-written tool, BSD license). It doesn't require to construct matrices A and b (Ax = b) by user, they are created automatically. See here for detail

Re: Listing variables

2009-10-25 Thread Tim Chase
t...@rubbish:~/tmp$ rm test.py test.pyc t...@rubbish:~/tmp$ python2.5 >>> import test >>> dir(test) ['__builtins__', '__doc__', '__file__', '__name__', '__path__'] >>> test.__file__ '/usr/lib/python2.5/test/__init__.pyc' because there's apparently a module named "test" in the standard distribu

Re: PySerial

2009-10-25 Thread Ronn Ross
On Sat, Oct 24, 2009 at 4:53 PM, John Nagle wrote: > Gabriel Genellina wrote: > >> En Fri, 23 Oct 2009 20:56:21 -0300, Ronn Ross >> escribió: >> >> >> I have tried setting the baud rate with no success. Also I'm using port >>> #2 >>> because I"m using a usb to serial cable. >>> >> >> Note that

Re: quit button

2009-10-25 Thread Grant Edwards
On 2009-10-25, linda.s wrote: > When I click "quit" button, why the following code has problem? It works fine for me (running Gentoo Linux on IA32). -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: quit button

2009-10-25 Thread John Posner
linda.s wrote: When I click "quit" button, why the following code has problem? from Tkinter import * colors = ['red', 'green', 'yellow', 'orange', 'blue', 'navy'] def gridbox(parent): r = 0 for c in colors: l = Label(parent, text=c, relief=RIDGE, width=25) e = Entry(pa

Re: Listing variables

2009-10-25 Thread vsoler
On Oct 25, 1:32 pm, Tim Chase wrote: > > If I just input dir(test) I don't get "a" in my list. > > import test > dir(test) > > ['__builtins__', '__doc__', '__file__', '__name__', '__package__', > > '__path__'] > > > I am using python 2.6 > > > Am I doing anything wrong? > > Are you impor

Re: how can i use lxml with win32com?

2009-10-25 Thread Irmen de Jong
Michiel Overtoom wrote: elca wrote: im sorry ,also im not familiar with newsgroup. It's not a newsgroup, but a mailing list. And if you're new to a certain community you're not familiar with, it's best to lurk a few days to see how it is used. Pot. Kettle. Black. comp.lang.python really i

Re: how can i use lxml with win32com?

2009-10-25 Thread Michiel Overtoom
elca wrote: http://news.search.naver.com/search.naver?sm=tab_hty&where=news&query=korea+times&x=0&y=0 that is korea portal site and i was search keyword using 'korea times' and i want to scrap resulted to text name with 'blogscrap_save.txt' Aha, now we're getting somewhere. Getting and parsin

Re: A new way to configure Python logging

2009-10-25 Thread Vinay Sajip
Wolodja Wentland cl.uni-heidelberg.de> writes: > > You are right, unless handlers (and filters, formatters etc.) are given > > names which can be used to refer to them across multiple configuration > > calls. > > This is something I am thinking about and will probably update PEP 391 > > with my

Re: how can i use lxml with win32com?

2009-10-25 Thread Michiel Overtoom
elca wrote: im sorry ,also im not familiar with newsgroup. It's not a newsgroup, but a mailing list. And if you're new to a certain community you're not familiar with, it's best to lurk a few days to see how it is used. so this position is bottom-posting position? It is, but you should

Re: python3 Unicode is slow

2009-10-25 Thread John Machin
On Oct 25, 11:12 pm, Dale Gerdemann wrote: > I've written simple code in 2.6 and 3.0 to read every charcter of a > set of files and print out some information for each of these > characters. I tested each program on a large Cyrillic/Latin text. The > result was that the 2.6 version was about 5x fa

Re: Listing variables

2009-10-25 Thread Tim Chase
If I just input dir(test) I don't get "a" in my list. import test dir(test) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__'] I am using python 2.6 Am I doing anything wrong? Are you importing the module you think you are? t...@rubbish:~/tmp$ echo "a=42" > tes

Re: A new way to configure Python logging

2009-10-25 Thread Wolodja Wentland
On Sun, Oct 25, 2009 at 10:48 +, Vinay Sajip wrote: > Wolodja Wentland cl.uni-heidelberg.de> writes: [ HTMLHandler, multiple configuration files ] OK! I agree that these parts are hard to standardise and do not really belong in the *logging* module. Maybe a kind soul implements a "configura

Re: Listing variables

2009-10-25 Thread vsoler
On Oct 25, 12:01 pm, Tim Chase wrote: > > Say that a have: > > > # file test.py > > a=7 > > > At the prompt: > > import test > > dir() > > > I would like to see the variables created in the test namespace. > > However, variable "a" does not appear in the list, only "test". Since > > I know that va

python3 Unicode is slow

2009-10-25 Thread Dale Gerdemann
I've written simple code in 2.6 and 3.0 to read every charcter of a set of files and print out some information for each of these characters. I tested each program on a large Cyrillic/Latin text. The result was that the 2.6 version was about 5x faster. Here are the two programs: #!/usr/bin/env pyt

Ctypes and Structures

2009-10-25 Thread Martijn Arts
I'm working with ctypes on a bridge (?) from WiiUse; a new and improved PyWiiUse, but I'm having a problem: When connecting to the wiimotes with the init function it gives me back an array with pointers. Every pointer points to a WiiMote structure, this all goes well. Now when trying to poll the w

Re: Listing variables

2009-10-25 Thread Dave Angel
vsoler wrote: Say that a have: # file test.py a=7 At the prompt: import test dir() I would like to see the variables created in the test namespace. However, variable "a" does not appear in the list, only "test". Since I know that var "a" is reachable from the prompt by means of test.a, how ca

Re: how can i use lxml with win32com?

2009-10-25 Thread elca
paul kölle wrote: > > elca schrieb: >> Hi, >> thanks a lot. >> studying alone is tough thing :) >> how can i improve my skill... > 1. Stop top-posting. > 2. Read documentation > 3. Use the interactive prompt > > cheers > Paul > >> >> >> paul kölle wrote: >>> elca schrieb: Hello, >>>

Re: Listing variables

2009-10-25 Thread Ben Finney
vsoler writes: > At the prompt: > import test > dir() > > I would like to see the variables created in the test namespace. > However, variable "a" does not appear in the list, only "test". Since > I know that var "a" is reachable from the prompt by means of test.a, > how can I list this sort of v

Re: Python 3.1.1 bytes decode with replace bug

2009-10-25 Thread Dave Angel
Joe wrote: For the reason BK explained, the important difference is that I ran in the IDLE shell, which handles screen printing of unicode better ;-) Something still does not seem right here to me. In the example above the bytes were decoded to 'UTF-8' with the *nope* you're decoding

Re: Listing variables

2009-10-25 Thread Tim Chase
Say that a have: # file test.py a=7 At the prompt: import test dir() I would like to see the variables created in the test namespace. However, variable "a" does not appear in the list, only "test". Since I know that var "a" is reachable from the prompt by means of test.a, how can I list this s

Re: how can i use lxml with win32com?

2009-10-25 Thread paul
elca schrieb: Hi, thanks a lot. studying alone is tough thing :) how can i improve my skill... 1. Stop top-posting. 2. Read documentation 3. Use the interactive prompt cheers Paul paul kölle wrote: elca schrieb: Hello, Hi, following is script source which can beautifulsoup and PAMIE

Re: A new way to configure Python logging

2009-10-25 Thread Vinay Sajip
Wolodja Wentland cl.uni-heidelberg.de> writes: > Could a HTMLHandler be added to the standard set? Preferably one that > leaves the choice of the template engine to the user. I haven't done this precisely because users' requirements will be very different for such a handler. For the same reason,

Listing variables

2009-10-25 Thread vsoler
Say that a have: # file test.py a=7 At the prompt: import test dir() I would like to see the variables created in the test namespace. However, variable "a" does not appear in the list, only "test". Since I know that var "a" is reachable from the prompt by means of test.a, how can I list this so

Re: how can i use lxml with win32com?

2009-10-25 Thread elca
Hi, thanks a lot. studying alone is tough thing :) how can i improve my skill... paul kölle wrote: > > elca schrieb: >> Hello, > Hi, > >> following is script source which can beautifulsoup and PAMIE work >> together. >> but if i run this script source error was happened. >> >> AttributeErro

Re: how can i use lxml with win32com?

2009-10-25 Thread paul
elca schrieb: Hello, Hi, following is script source which can beautifulsoup and PAMIE work together. but if i run this script source error was happened. AttributeError: PAMIE instance has no attribute 'pageText' File "C:\test12.py", line 7, in bs = BeautifulSoup(ie.pageText()) You could

Re: lambda forms within a loop

2009-10-25 Thread Duncan Booth
Michal Ostrowski wrote: > def MakeLambdaBad(): > a = [] > for x in [1,2]: > a.append(lambda q: x + q) > return a Two things to remember when using lambda: 1. You can always replace lambda with one line function returning the same result. The only difference is that you have to give

Re: how can i use lxml with win32com?

2009-10-25 Thread elca
Hello, actually what i want is, if you run my script you can reach this page 'http://news.search.naver.com/search.naver?sm=tab_hty&where=news&query=korea+times&x=0&y=0' that is korea portal site and i was search keyword using 'korea times' and i want to scrap resulted to text name with 'blogscra

Re: Socket logic problem

2009-10-25 Thread Gabriel Genellina
En Sat, 24 Oct 2009 06:40:08 -0300, John O'Hagan escribió: I have several instances of the same generator function running simultaneously, some within the same process, others in separate processes. I want them to be able to share data (the dictionaries passed to them as arguments), in suc

Re: how can i use lxml with win32com?

2009-10-25 Thread Michiel Overtoom
elca wrote: actually what i want to parse website is some different language site. A different website? What website? What text? Please show your actual use case, instead of smokescreens. so i was quote some common english website for easy understand. :) And, did you learn somethin

Re: how can i use lxml with win32com?

2009-10-25 Thread elca
Hello, thanks for your reply. actually what i want to parse website is some different language site. so i was quote some common english website for easy understand. :) by the way, is it possible to use with PAMIE and beautifulsoup work together? Thanks a lot motoom wrote: > > elca wrote: >

Re: how can i use lxml with win32com?

2009-10-25 Thread Stefan Behnel
elca, 25.10.2009 08:46: > im very sorry my english. It's fairly common in this news-group that people do not have a good level of English, so that's perfectly ok. But you should try to provide more information in your posts. Be explicit about what you tried and what failed (and how!), and provide

Re: how can i use lxml with win32com?

2009-10-25 Thread Michiel Overtoom
elca wrote: yes i want to extract this text 'CNN Shop' and linked page 'http://www.turnerstoreonline.com'. Well then. First, we'll get the page using urrlib2: doc=urllib2.urlopen("http://www.cnn.com";) Then we'll feed it into the HTML parser: soup=BeautifulSoup(doc) Next, we'll loo

Re: how can i use lxml with win32com?

2009-10-25 Thread elca
hello, im very sorry my english. yes i want to extract this text 'CNN Shop' and linked page 'http://www.turnerstoreonline.com'. thanks a lot! motoom wrote: > > > On 25 Oct 2009, at 08:33 , elca wrote: > >> www.cnn.com in main website page. >> for example ,if you see www.cnn.com's html source

Re: how can i use lxml with win32com?

2009-10-25 Thread User
On 25 Oct 2009, at 08:33 , elca wrote: www.cnn.com in main website page. for example ,if you see www.cnn.com's html source, maybe you can find such like line of html source. http://www.turnerstoreonline.com/ CNN Shop and for example if i want to extract 'CNN Shop' text in html source. So,

Re: how can i use lxml with win32com?

2009-10-25 Thread elca
hello, www.cnn.com in main website page. for example ,if you see www.cnn.com's html source, maybe you can find such like line of html source. http://www.turnerstoreonline.com/ CNN Shop and for example if i want to extract 'CNN Shop' text in html source. and i want to add such like function ,wit

Re: how can i use lxml with win32com?

2009-10-25 Thread User
On 25 Oct 2009, at 08:06 , elca wrote: because of javascript im trying to insist use PAMIE. I see, your problem is not with lxml or BeautifulSoup, but getting the raw data in the first place. i want to extract some text in CNN website with 'CNN Shop' 'Site map' in bottom of CNN website

Re: how can i use lxml with win32com?

2009-10-25 Thread elca
Hello, yes there is some reason why i nave to insist internet explorere interface. because of javascript im trying to insist use PAMIE. i was tried some other solution urlopen or mechanize and so on. but it hard to use javascript. can you show me some sample for me ? :) such like if i want to extr