Re: how can i use lxml with win32com?

2009-10-24 Thread User
On 25 Oct 2009, at 07:45 , elca wrote: i want to make web scraper. if possible i really want to make it work together with beautifulsoup or lxml with PAMIE. Scraping information from webpages falls apart in two tasks: 1. Getting the HTML data 2. Extracting information from the HTML data

Re: how can i use lxml with win32com?

2009-10-24 Thread elca
Hello, im very sorry . first my source is come from website which consist of html mainly. and i want to make web scraper. i was found some script source in internet. following is script source which can beautifulsoup and PAMIE work together. but if i run this script source error was happened. At

Re: how can i use lxml with win32com?

2009-10-24 Thread Stefan Behnel
Hi, elca, 25.10.2009 02:35: > hello... > if anyone know..please help me ! > i really want to know...i was searched in google lot of time. > but can't found clear soultion. and also because of my lack of python > knowledge. > i want to use IE.navigate function with beautifulsoup or lxml.. > if anyo

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

2009-10-24 Thread Dieter Maurer
Terry Reedy writes on Fri, 23 Oct 2009 03:04:41 -0400: > Consider this: > > def blackhole(*args, **kwds): pass > > The fact that it accept args that it ignores could be considered > misleading or even a bug. Maybe, it could. But, it is by no means necessary. In mathematics, there is a set of i

Re: lambda forms within a loop

2009-10-24 Thread Lawrence D'Oliveiro
In message , Michal Ostrowski wrote: > def MakeLambdaBad(): > a = [] > for x in [1,2]: > a.append(lambda q: x + q) > return a Here's another form that should work: def MakeLambdaGood2() : a = [] for x in [1, 2] : a.append((lambda x : lambda q : x + q)

Re: lambda forms within a loop

2009-10-24 Thread Chris Rebert
On Sat, Oct 24, 2009 at 8:33 PM, Michal Ostrowski wrote: > The snippet of code below uses two functions to dynamically create > functions using lambda. > Both of these uses should produce the same result, but they don't. > def MakeLambdaGood(): > def DoLambda(x): > return lambda q: x + q >

lambda forms within a loop

2009-10-24 Thread Michal Ostrowski
The snippet of code below uses two functions to dynamically create functions using lambda. Both of these uses should produce the same result, but they don't. The expected output of this code is 11 12 11 12 However, what we get instead is 12 12 11 12 The problem is that the two functions return

quit button

2009-10-24 Thread linda.s
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(parent, bg=c, reli

Re: Python 3.1.1 bytes decode with replace bug

2009-10-24 Thread Benjamin Kaplan
On Sat, Oct 24, 2009 at 8:47 PM, 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

Re: PAMIE and beautifulsoup problem

2009-10-24 Thread elca
hello! im very sorry to late reply. follow script i was executed. from BeautifulSoup import BeautifulSoup from PAM30 import PAMIE url = 'http://www.cnn.com' ie = PAMIE(url) bs = BeautifulSoup(ie.pageText()) and i was got such like follow error in wingide. i can guess because of current version

Re: Python 3.1.1 bytes decode with replace bug

2009-10-24 Thread Joe
> 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 replace option so any characters that were

how can i use lxml with win32com?

2009-10-24 Thread elca
hello... if anyone know..please help me ! i really want to know...i was searched in google lot of time. but can't found clear soultion. and also because of my lack of python knowledge. i want to use IE.navigate function with beautifulsoup or lxml.. if anyone know about this or sample. please help

Re: IDLE python shell freezes after running show() of matplotlib

2009-10-24 Thread Scott David Daniels
Forrest Sheng Bao wrote: I am having a weird problem on IDLE. After I plot something using show () of matplotlib, the python shell prompt in IDLE just freezes that I cannot enter anything and there is no new ">>>" prompt show up. I tried ctrl - C and it didn't work. I have to restart IDLE to use

Problem with urllib2.urlopen() opening a local file

2009-10-24 Thread deja user
I want to use urlopen() to open either a http://... file or a local file File:C:/... I don't have problems opening and reading the file either way. But when I run the script on a server (ArcGIS server), the request won't complete if it was trying to open a local file. Even though I call close()

Re: Python 3.1.1 bytes decode with replace bug

2009-10-24 Thread Terry Reedy
Joe wrote: Thanks for your response. Please provide more information The Python 3.1.1 documentation has the following example: Where? I could not find them http://docs.python.org/3.1/howto/unicode.html#unicode-howto Scroll down the page about half way to the "The String Type" section. Th

slightly OT - newbie Objective-C resources for experienced Python users

2009-10-24 Thread J Peyret
I'm starting to look at the iPhone SDK and I'd like to know of resources on the Net that approach that language with a Pythonic mindset. Mind you, I want to code Objective-C, not pine about Python not being on the iPhone either. The kind of elegant simple code that a good Python coder who also kn

Re: Python 3.1.1 bytes decode with replace bug

2009-10-24 Thread Joe
Thanks for your response. > Please provide more information > > > The Python 3.1.1 documentation has the following example: > > Where? I could not find them http://docs.python.org/3.1/howto/unicode.html#unicode-howto Scroll down the page about half way to the "The String Type" section. The exa

IDLE python shell freezes after running show() of matplotlib

2009-10-24 Thread Forrest Sheng Bao
I am having a weird problem on IDLE. After I plot something using show () of matplotlib, the python shell prompt in IDLE just freezes that I cannot enter anything and there is no new ">>>" prompt show up. I tried ctrl - C and it didn't work. I have to restart IDLE to use it again. My system is Ubu

Re: PySerial

2009-10-24 Thread John Nagle
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 Serial(2) is known as COM3 in Windows, is it ok? Do you have a machine with a C

Re: Python 3.1.1 bytes decode with replace bug

2009-10-24 Thread Benjamin Kaplan
On Sat, Oct 24, 2009 at 1:09 PM, Joe wrote: > The Python 3.1.1 documentation has the following example: > b'\x80abc'.decode("utf-8", "strict") > Traceback (most recent call last): >  File "", line 1, in ? > UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: >              

Re: Python 3.1.1 bytes decode with replace bug

2009-10-24 Thread Terry Reedy
Joe wrote: Please provide more information The Python 3.1.1 documentation has the following example: Where? I could not find them b'\x80abc'.decode("utf-8", "strict") Traceback (most recent call last): File "", line 1, in ? UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in posit

Re: How to set up web service by python?

2009-10-24 Thread Edward A. Falk
In article <7kh22qf38i28...@mid.uni-berlin.de>, Diez B. Roggisch wrote: > >As you don't show us the code, I can only guess - but experience tells >me that you try & bind your service to a priviledged (<=1024) port, >which *nix only allows with root-privileges. Concur. You need root privileges

Re: Error building Python 2.6.3 and 2.6.4rc2

2009-10-24 Thread Michael Ströder
Christian Heimes wrote: > Michael Ströder wrote: >> - snip - >> /usr/src/Python-2.6.4rc2> make >> 'import site' failed; use -v for traceback >> Traceback (most recent call last): >> File "./setup.py", line 15, in >> from distutils.comma

Re: How to set up web service by python?

2009-10-24 Thread Diez B. Roggisch
Peng Yu schrieb: I'm following the instruction on http://fragments.turtlemeat.com/pythonwebserver.php to set web service. But I get the following error message when I run the script on my mac machine. I'm wondering why I see the permission denied error message. $python webserver.py Traceback (mo

How to set up web service by python?

2009-10-24 Thread Peng Yu
I'm following the instruction on http://fragments.turtlemeat.com/pythonwebserver.php to set web service. But I get the following error message when I run the script on my mac machine. I'm wondering why I see the permission denied error message. $python webserver.py Traceback (most recent call last

Re: Error building Python 2.6.3 and 2.6.4rc2

2009-10-24 Thread Christian Heimes
Michael Ströder wrote: > - snip - > /usr/src/Python-2.6.4rc2> make > 'import site' failed; use -v for traceback > Traceback (most recent call last): > File "./setup.py", line 15, in > from distutils.command.build_ext import build_ext >

Error building Python 2.6.3 and 2.6.4rc2

2009-10-24 Thread Michael Ströder
HI! I'm on a openSUSE system where Python 2.6 is installed from RPMs. I'm trying to build Python from source separately. This used to work in former versions but fails now (see build traceback below). Anyone having a clue what's going on here? Is there a possible work-around? A possible conflict

ANN: Jump 0.9.0 released!

2009-10-24 Thread Olli Wang
I am proud to announce that Jump 0.9.0 is released! You can find the Jump project at http://gitorious.org/jump, and its documentation at http://gitorious.org/jump/pages/Home. This version is the Jump's first release. The goal of Jump is to make a distribution for Jython application in a really si

Python 3.1.1 bytes decode with replace bug

2009-10-24 Thread Joe
The Python 3.1.1 documentation has the following example: >>> b'\x80abc'.decode("utf-8", "strict") Traceback (most recent call last): File "", line 1, in ? UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0: unexpected code byte >>> b'\x80abc'.decode("utf-8

Re: sequential multiple processes

2009-10-24 Thread Wolodja Wentland
On Sun, Oct 25, 2009 at 00:41 +0900, Hyunchul Kim wrote: >  How to run multiple processes with sequential input of a thousand > of data >  in a script run? > >  I have a python script and 1,000 independent

Re: sequential multiple processes

2009-10-24 Thread Gary Herron
Hyunchul Kim wrote: Hi, all How to run multiple processes with sequential input of a thousand of data in a script run? I have a python script and 1,000 independent input data for it. Previously, I divided input data into/ n/ groups and ran a same python script /n/ times to use /n/ processor

sequential multiple processes

2009-10-24 Thread Hyunchul Kim
Hi, all How to run multiple processes with sequential input of a thousand of data in a script run? I have a python script and 1,000 independent input data for it. Previously, I divided input data into* n* groups and ran a same python script *n* times to use *n* processors. It's inconvenient. Ho

Re: repr(complex) in Py3.1

2009-10-24 Thread Stefan Behnel
Mark Dickinson, 24.10.2009 16:44: > On Oct 24, 3:26 pm, Stefan Behnel wrote: >> in Python 3.1.1, I get this: >> >> Python 3.1.1 (r311:74480, Oct 22 2009, 19:34:26) >> [GCC 4.3.2] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> -(2j) >> (-0-2j) >>

Re: repr(complex) in Py3.1

2009-10-24 Thread Martin v. Löwis
> I know at least that the float repr() was modified in Py3.1, but is the > above behaviour intentional? It certainly breaks doctests, and I don't see > a good reason for that. I don't know whether it was intentional, but it looks right to me. 2j is the complex number +0.0+2.0j (right?). Then, -(2

Re: repr(complex) in Py3.1

2009-10-24 Thread Mark Dickinson
On Oct 24, 3:26 pm, Stefan Behnel wrote: > Hi, > > in Python 3.1.1, I get this: > >   Python 3.1.1 (r311:74480, Oct 22 2009, 19:34:26) >   [GCC 4.3.2] on linux2 >   Type "help", "copyright", "credits" or "license" for more information. >   >>> 2j >   2j >   >>> -2j >   -2j >   >>> -0-2j >   -2j >

repr(complex) in Py3.1

2009-10-24 Thread Stefan Behnel
Hi, in Python 3.1.1, I get this: Python 3.1.1 (r311:74480, Oct 22 2009, 19:34:26) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 2j 2j >>> -2j -2j >>> -0-2j -2j >>> (-0-2j) -2j >>> -(2j) (-0-2j) The last line differs fro

Re: multiprocessing deadlock

2009-10-24 Thread Brian Quinlan
On 24 Oct 2009, at 21:37, larudwer wrote: "Brian Quinlan" schrieb im Newsbeitrag news:mailman.1895.1256264717.2807.python-l...@python.org... Any ideas why this is happening? Cheers, Brian IMHO your code is buggy. You run in an typical race condition. consider following part in your code

[ANN] python-daemon 1.5.2

2009-10-24 Thread Ben Finney
Howdy all, I'm pleased to announce the release of version 1.5.2 of ‘python-daemon’. What is python-daemon = The ‘python-daemon’ library is the reference implementation of PEP 3143 http://www.python.org/dev/peps/pep-3143/>, “Standard daemon process library”. The source distri

Re: PySerial

2009-10-24 Thread Ronn Ross
Yes, with the serial to usb adapter is located on COM3. I have been able to use puTTY to get into the port and shoot commands at the device, but when I try to use python I get 'You don't have permissions". On Sat, Oct 24, 2009 at 12:50 AM, Gabriel Genellina wrote: > En Fri, 23 Oct 2009 20:56:21 -

Re: unicode and dbf files

2009-10-24 Thread John Machin
On Oct 24, 4:14 am, Ethan Furman wrote: > John Machin wrote: > > On Oct 23, 3:03 pm, Ethan Furman wrote: > > >>John Machin wrote: > > >>>On Oct 23, 7:28 am, Ethan Furman wrote: > > Greetings, all! > > I would like to add unicode support to my dbf project.  The dbf header > has a one-

Re: A new way to configure Python logging

2009-10-24 Thread Wolodja Wentland
On Sat, Oct 24, 2009 at 07:54 +, Vinay Sajip wrote: > Wolodja Wentland cl.uni-heidelberg.de> writes: [snip] > > foo > > |__bar > > |__baz > > |__newt > > |___witch > > > > I set every loggers log level to DEBUG and use the respective logger in > You only need set f

Re: multiprocessing deadlock

2009-10-24 Thread larudwer
"Brian Quinlan" schrieb im Newsbeitrag news:mailman.1895.1256264717.2807.python-l...@python.org... > > Any ideas why this is happening? > > Cheers, > Brian IMHO your code is buggy. You run in an typical race condition. consider following part in your code: > def _make_some_processes(q): >

Socket logic problem

2009-10-24 Thread John O'Hagan
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 such a way that instances designated as "leaders" send their dictio

Re: which "dictionary with attribute-style access"?

2009-10-24 Thread Andreas Balogh
baloan wrote: On Oct 22, 6:34 am, "Gabriel Genellina" wrote: class AttrDict(dict): """A dict whose items can also be accessed as member variables.""" def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) self.__dict__ = self def copy(self):

Re: multiprocessing deadlock

2009-10-24 Thread Brian Quinlan
On 24 Oct 2009, at 19:49, Gabriel Genellina wrote: En Sat, 24 Oct 2009 02:48:38 -0300, Brian Quinlan escribió: On 24 Oct 2009, at 14:10, Gabriel Genellina wrote: En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan > escribió: I don't like a few things in the code: I'm actually not looking f

Re: multiprocessing deadlock

2009-10-24 Thread Gabriel Genellina
En Sat, 24 Oct 2009 02:48:38 -0300, Brian Quinlan escribió: On 24 Oct 2009, at 14:10, Gabriel Genellina wrote: En Thu, 22 Oct 2009 23:18:32 -0300, Brian Quinlan escribió: I don't like a few things in the code: I'm actually not looking for workarounds. I want to know if this is a multip

Re: Frameworks

2009-10-24 Thread Emmanuel Surleau
> Emmanuel Surleau a écrit : > > It still manages to retain flexibility, but you're basically stuck > > with Django's ORM > > You're by no way "stuck" with Django's ORM - you are perfectly free > not to use it. But then you'll obviously loose quite a lot of useful > feat

Re: A new way to configure Python logging

2009-10-24 Thread Vinay Sajip
Wolodja Wentland cl.uni-heidelberg.de> writes: > First and foremost: A big *THANK YOU* for creating and maintaining the > logging module. I use it in every single piece of software I create and > am very pleased with it. I'm glad you like it. Thanks for taking the time to write this detailed pos

Re: multiprocessing deadlock

2009-10-24 Thread Ishwor Gurung
Hi Brian, I think there could be a slight problem (if I've understood your code). > import multiprocessing > import queue > > def _process_worker(q): >    while True: do you really want to run it indefinitely here? >        try: >            something = q.get(block=True, timeout=0.1) >        exc