What is "@" used for ?

2008-06-29 Thread gops
Hi.

I am noob in python. while reading some source code I came across ,
this funny thing called @ in some function ,

def administrator(method):
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
user = users.get_current_user()
if not user:
if self.request.method == "GET":
 
self.redirect(users.create_login_url(self.request.uri))
return
raise web.HTTPError(403)
elif not users.is_current_user_admin():
raise web.HTTPError(403)
else:
return method(self, *args, **kwargs)
return wrapper

now what is that "@" used for ? I tried to google , but it just omits
the "@" and not at all useful for me(funny!! :D)

It will be enough if you can just tell me some link where i can look
for it..

Thank you in advance. :D

--
http://mail.python.org/mailman/listinfo/python-list


Re: C++ or Python

2008-06-29 Thread Sebastian "lunar" Wiesner
Dan Stromberg <[EMAIL PROTECTED]>:

> things like passing a method as a function parameter is a no-brainer
> (requires extra syntax in java because of the cautious type system - not
> sure about C++). 

C++ has function pointers and functors, therefore this is not really an
issue with C++.

-- 
Freedom is always the freedom of dissenters.
  (Rosa Luxemburg)
--
http://mail.python.org/mailman/listinfo/python-list


Re: HTML Parsing

2008-06-29 Thread Sebastian "lunar" Wiesner
Stefan Behnel <[EMAIL PROTECTED]>:

> [EMAIL PROTECTED] wrote:
>> I am trying to build my own web crawler for an experiement and I don't
>> know how to access HTTP protocol with python.
>>
>> Also, Are there any Opensource Parsing engine for HTML documents
>> available in Python too? That would be great.
> 
> Try lxml.html. It parses broken HTML, supports HTTP, is much faster than
> BeautifulSoup and threadable, all of which should be helpful for your
> crawler.

You should mention its powerful features like XPATH and CSS selection
support and its easy API here, too ;)

-- 
Freedom is always the freedom of dissenters.
  (Rosa Luxemburg)
--
http://mail.python.org/mailman/listinfo/python-list


Re: help debugging noob code - converting binary data to images...

2008-06-29 Thread Lie
On Jun 29, 11:18 am, [EMAIL PROTECTED] wrote:
> Ok I'm a Python noob, been doing OK so far, working on a data
> conversion program and want to create some character image files from
> an 8-bit ROM file.
>
> Creating the image I've got down, I open the file and use TK to draw
> the images... but
>
> 1)  It does not seem to end (running in IDLE), I have to kill the
> process to retry it seems tkinter does not close(?)
>
> 2) Once I added the Image module open won't open my binary file
> (complains its not an image file, which is isnt.)  I am sure I need to
> prefix open with something but I can't seem to find an example of how
> to word it,
>
> Below is the code (if it is lousy its because I've mainly been
> borrowing by examples as I go...) Any suggestions are gretly
> appreciated.
>
> #!/usr/local/bin/python
>
> from Tkinter import *
> from string import *
> from Image import *

DON'T DO THAT...

You're importing everything to the current namespace and this corrupts
the current namespace, specifically the 'open' function inside
Image.open would shadow the built-in 'open' function.

use:
import Tkinter
import string
import Image

There are use cases where doing 'from blah import *' is useful, such
as importing constants, but in general try to avoid importing
everything to current namespace.

> root = Tk()
> root.title('Canvas')

If you used 'import Tkinter', you'd have to change that code to:
root = Tkinter.Tk()

> #open commodore Cset rom
> cset  = open("chargen","r")

Because you shadowed the built-in 'open' with the 'from Image import
*', this would call Image.open instead of the built-in open.

> canvas = Canvas(width=16, height=16, bg='white')

If you used 'import Tkinter', you'd have to change that code to:
canvas = Tkinter.Canvas(...)

> canvas.pack(expand=YES, fill=BOTH)
>
> # character size factor
> size = 2
>
> # read all 512 characters from ROM
> for cchar in range(0, 511, 1):

You can use this instead:
for cchar in range(511):

but beware, this creates range with length 511 (so do the original
range), which means you're lacking on space for the last char.
You probably wanted this instead:
for cchar in range(512):

But again, python can loop directly over string/list/file, etc, so
this might be best:
for char in cset.read():

>     #draw line
>     while charline < 8:
>         position = 0
>         x = cset.read(1)
>         ch = ord(x)
>         # draw pixels
>         while position < 8:
>             if ch & ( 2 ** position ):
>                 xp = 1+(7-position)*size
>                 yp = 1+charline*size
>                 canvas.create_rectangle(xp,yp,xp+size,yp+size,
> fill='black', width=0)
>             position += 1

Since you're planning to use Image module (from PIL/Python Imaging
Library) why not use functions from Image instead to create the image.
The format of the file you're using seems to be RAW format (i.e.
simple uncompressed bitmap, without any kinds of header). That means
Image.fromstring() should work.

>         charline += 1
>     #save character image
>     outfile = "/home/mydir/work/char"+zfill(cchar,3)+".png"
>     canvas.save(outfile,"png")
>     #clear canvas for next char...
>     canvas.create_rectangle(1,1,size*8,size*8, fill='white', width=0)
> root.mainloop()

--
http://mail.python.org/mailman/listinfo/python-list


Re: help debugging noob code - converting binary data to images...

2008-06-29 Thread Lie
On Jun 29, 4:47 pm, Lie <[EMAIL PROTECTED]> wrote:
> On Jun 29, 11:18 am, [EMAIL PROTECTED] wrote:
>
>
>
> > Ok I'm a Python noob, been doing OK so far, working on a data
> > conversion program and want to create some character image files from
> > an 8-bit ROM file.
>
> > Creating the image I've got down, I open the file and use TK to draw
> > the images... but
>
> > 1)  It does not seem to end (running in IDLE), I have to kill the
> > process to retry it seems tkinter does not close(?)
>
> > 2) Once I added the Image module open won't open my binary file
> > (complains its not an image file, which is isnt.)  I am sure I need to
> > prefix open with something but I can't seem to find an example of how
> > to word it,
>
> > Below is the code (if it is lousy its because I've mainly been
> > borrowing by examples as I go...) Any suggestions are gretly
> > appreciated.
>
> > #!/usr/local/bin/python
>
> > from Tkinter import *
> > from string import *
> > from Image import *
>
> DON'T DO THAT...
>
> You're importing everything to the current namespace and this corrupts
> the current namespace, specifically the 'open' function inside
> Image.open would shadow the built-in 'open' function.
>
> use:
> import Tkinter
> import string
> import Image
>
> There are use cases where doing 'from blah import *' is useful, such
> as importing constants, but in general try to avoid importing
> everything to current namespace.
>
> > root = Tk()
> > root.title('Canvas')
>
> If you used 'import Tkinter', you'd have to change that code to:
> root = Tkinter.Tk()
>
> > #open commodore Cset rom
> > cset  = open("chargen","r")
>
> Because you shadowed the built-in 'open' with the 'from Image import
> *', this would call Image.open instead of the built-in open.
>
> > canvas = Canvas(width=16, height=16, bg='white')
>
> If you used 'import Tkinter', you'd have to change that code to:
> canvas = Tkinter.Canvas(...)
>
> > canvas.pack(expand=YES, fill=BOTH)
>
> > # character size factor
> > size = 2
>
> > # read all 512 characters from ROM
> > for cchar in range(0, 511, 1):
>
> You can use this instead:
> for cchar in range(511):
>
> but beware, this creates range with length 511 (so do the original
> range), which means you're lacking on space for the last char.
> You probably wanted this instead:
> for cchar in range(512):
>
> But again, python can loop directly over string/list/file, etc, so
> this might be best:
> for char in cset.read():
>
> >     #draw line
> >     while charline < 8:
> >         position = 0
> >         x = cset.read(1)
> >         ch = ord(x)
> >         # draw pixels
> >         while position < 8:
> >             if ch & ( 2 ** position ):
> >                 xp = 1+(7-position)*size
> >                 yp = 1+charline*size
> >                 canvas.create_rectangle(xp,yp,xp+size,yp+size,
> > fill='black', width=0)
> >             position += 1
>
> Since you're planning to use Image module (from PIL/Python Imaging
> Library) why not use functions from Image instead to create the image.
> The format of the file you're using seems to be RAW format (i.e.
> simple uncompressed bitmap, without any kinds of header). That means
> Image.fromstring() should work.
>
> >         charline += 1
> >     #save character image
> >     outfile = "/home/mydir/work/char"+zfill(cchar,3)+".png"
> >     canvas.save(outfile,"png")
> >     #clear canvas for next char...
> >     canvas.create_rectangle(1,1,size*8,size*8, fill='white', width=0)
> > root.mainloop()
>
>

btw, PIL Handbook is a good tutorial/reference for Python Imaging
Library: http://www.pythonware.com/library/pil/handbook/index.htm
for info on raw mode: http://www.pythonware.com/library/pil/handbook/decoder.htm
--
http://mail.python.org/mailman/listinfo/python-list


Re: What is "@" used for ?

2008-06-29 Thread Lie
On Jun 29, 3:39 pm, gops <[EMAIL PROTECTED]> wrote:
> Hi.
>
> I am noob in python. while reading some source code I came across ,
> this funny thing called @ in some function ,
>
> def administrator(method):
>     @functools.wraps(method)
>     def wrapper(self, *args, **kwargs):
>         user = users.get_current_user()
>         if not user:
>             if self.request.method == "GET":
>
> self.redirect(users.create_login_url(self.request.uri))
>                 return
>             raise web.HTTPError(403)
>         elif not users.is_current_user_admin():
>             raise web.HTTPError(403)
>         else:
>             return method(self, *args, **kwargs)
>     return wrapper
>
> now what is that "@" used for ? I tried to google , but it just omits
> the "@" and not at all useful for me(funny!! :D)
>
> It will be enough if you can just tell me some link where i can look
> for it..
>
> Thank you in advance. :D

@ is decorator. It's a syntax sugar, see this example:
class A(object):
@decorate
def blah(self):
print 'blah'

is the same as:
class A(object):
def blah(self):
print 'blah'
blah = decorate(blah)

Now you know the name, I guess google will help you find the rest of
the explanation.
--
http://mail.python.org/mailman/listinfo/python-list


problem with internationalized headers in email package

2008-06-29 Thread Manlio Perillo
Hi.

From RFC 2047:
+ An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'.
+ An 'encoded-word' MUST NOT appear within a 'quoted-string'.
+ An 'encoded-word' MUST NOT be used in a Received header field.
+ An 'encoded-word' MUST NOT be used in parameter of a MIME
  Content-Type or Content-Disposition field, or in any structured
  field body except within a 'comment' or 'phrase'.


However (Python 2.5.2):

>>> h = Header(u'Andrè <[EMAIL PROTECTED]>')
>>> h.encode()
'=?utf-8?b?QW5kcsOoIDxhbmRyZUBsb2NhbGhvc3Q+?='


I'm not sure if this can be considered a bug, but surely this is an 
invalid header.



Thanks  Manlio Perillo
--
http://mail.python.org/mailman/listinfo/python-list

tkinter, loading image error, TclError: couldn't recognize data in image file "C:/users/me/desktop/images/blob4.jpg"

2008-06-29 Thread defn noob
from Tkinter import *
import os

master = Tk()
w = Canvas(master, width=800, height=600)

print os.path.exists('C:/me/saftarn/desktop/images/blob4.jpg')

im = PhotoImage(file = 'C:/users/saftarn/desktop/images/blob4.jpg')
#im = file = 'C:/users/me/desktop/images/blob4.jpg'
pic = w.create_image(0, 0, image = im, anchor = NW)

#image = open('C:/users/saftarn/desktop/images/blob.png')

colors = []
for x in range(1, 800):
for y in range(1, 600):
pic = w.find_closest(x, y)[0]
obj = objects[pic]
colors.append(obj.get(int(x), int(y)))

print colors



>>>
True

Traceback (most recent call last):
  File "C:/Python25/Progs/ImageVideoSearch/imId.py", line 9, in

im = PhotoImage(file = 'C:/users/me/desktop/images/blob4.jpg')
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 3270, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 3226, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
TclError: couldn't recognize data in image file "C:/users/me/desktop/
images/blob4.jpg"
>>>



it has worked before opening and displaying a file like this, anything
to do with python 2.52, upgraded from 2.5.1
--
http://mail.python.org/mailman/listinfo/python-list


Re: pixel colour on screen

2008-06-29 Thread Irmen de Jong


Dennis Lee Bieber wrote:

On Sat, 28 Jun 2008 11:47:46 -0700 (PDT), [EMAIL PROTECTED]
declaimed the following in comp.lang.python:


Could anyone help me, I'm a python noob and need some help. im trying
to find some code that will, given a screen co-ordinate, will give me
the colour of that pixel in RGB. i have found a lot about getting the
pixel colour from a picture file with a given co-ordinate, but is it
possible to do it from the whole screen output regardless what
application the selected pixel is in?


Such capability differs with OS and GUI libraries. If one is lucky,
the GUI library will accept any screen coordinate -- but it is just as
likely that the OS could limit a program to only coordinates within its
own window.


Maybe the easiest way is to create a screenshot of the whole screen
(that should be doable from within a program, although this differs for every OS and GUI 
lib as well) and then get the pixel value from that.


--irmen
--
http://mail.python.org/mailman/listinfo/python-list


Classical nurses site

2008-06-29 Thread jinole
Recommended for everyone to an Asian pornographic website,There are
many beauty photos and

movies.URL: http://www.loioi.com
If you need more sites, then contact me. e-mail: [EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


windows installers and license agreement

2008-06-29 Thread Darren Dale
Is it possible to create a windows installer using distutils that
includes a
prompt for the user to agree to the terms of the license?

Thanks,
Darren
--
http://mail.python.org/mailman/listinfo/python-list


Re: pxssh submit su commands = very very slow

2008-06-29 Thread gert
On Jun 29, 4:45 am, Dan Stromberg <[EMAIL PROTECTED]> wrote:
> On Sat, 28 Jun 2008 19:08:59 -0700, gert wrote:
> > this does the same except 100 times faster ?
>
> > I don't understand the logic about the prompt, its not the same as the
> > output from the bash shell ?
>
> > [EMAIL PROTECTED]:~# cat ssh2.py
> > import pexpect
> > import sys
>
> > child = pexpect.spawn("ssh [EMAIL PROTECTED]") #child.logfile = sys.stdout
>
> > i = child.expect(['assword:', r'yes/no'],timeout=120) if i==0:
> >     child.sendline('123')
> > elif i==1:
> >     child.sendline('yes')
> >     child.expect('assword:', timeout=120) child.sendline('123')
> > child.expect('[EMAIL PROTECTED]: ~') print child.before
>
> > child.sendline('ls -l')
> > child.expect('[EMAIL PROTECTED]:')
> > print child.before
>
> > child.sendline('su')
> > child.expect('assword:')
> > child.sendline('123')
> > child.expect('[EMAIL PROTECTED]: /srv/www/gert') print child.before
>
> > child.sendline('ls -l')
> > child.expect('[EMAIL PROTECTED]:')
> > print child.before
>
> You could try changing the prompt (pxssh appears to have a way of doing
> that), but I prefer to set up passwordless, passphraseless ssh and do
> each command separately.  For the rootly portions, you might look into
> passwordless sudo if you go that route.
>
> Here's something about setting up passwordless, passphraseless ssh:
>
> http://stromberg.dnsalias.org/~strombrg/ssh-keys.html

My boss does not allow me to cp a key on the phone server. I only have
a email with some commands and passwords.
--
http://mail.python.org/mailman/listinfo/python-list


Re: complex numbers should respect the "I" representation

2008-06-29 Thread Grant Edwards
On 2008-06-29, Roy Smith <[EMAIL PROTECTED]> wrote:

>> I think complex numbers should respect the "i" or "I"
>> representation, instead of "j". No reason being cute and using
>> a different character instead of the traditional
>> representation?
>
> Ask any electrical engineer what j means.

And ask them what "I" means.

-- 
Grant Edwards   grante Yow!  HUGH BEAUMONT died
  at   in 1982!!
   visi.com
--
http://mail.python.org/mailman/listinfo/python-list


Unnormalizing normalized path in Windows

2008-06-29 Thread Julien
Hi,

In Windows, when a path has been normalized with os.path.normpath, you
get something like this:

C:/temp/my_dir/bla.txt   # With forward slashes instead or backward
slashes.

Is it possible to revert that?

>>> magic_function('C:/temp/my_dir/bla.txt')
'C:\temp\my_dir\bla.txt'

I wonder if there's a standard function to do that...

Thanks a lot!

Julien
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is recursion so slow?

2008-06-29 Thread Dan Upton
On Sun, Jun 29, 2008 at 1:27 AM, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
>
> slix wrote:
>>
>> Recursion is awesome for writing some functions, like searching trees
>> etc but wow how can it be THAT much slower for computing fibonacci-
>> numbers?
>
> The comparison below has nothing to do with recursion versus iteration.  (It
> is a common myth.) You (as have others) are comparing an exponential,
> O(1.6**n), algorithm with a linear, O(n), algorithm.
>

FWIW, though, it's entirely possible for a recursive algorithm with
the same asymptotic runtime to be wall-clock slower, just because of
all the extra work involved in setting up and tearing down stack
frames and executing call/return instructions.  (If the function is
tail-recursive you can get around this, though I don't know exactly
how CPython is implemented and whether it optimizes that case.)
--
http://mail.python.org/mailman/listinfo/python-list


Re: windows installers and license agreement

2008-06-29 Thread Nick Dumas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Darren Dale wrote:
> Is it possible to create a windows installer using distutils that
> includes a
> prompt for the user to agree to the terms of the license?
> 
> Thanks,
> Darren
Yeah. In your setup.py script, have it pop up a console window with the
license agreement and a prompt to agree to it.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhnlf4ACgkQLMI5fndAv9jMlwCfYFhmIhmACO0ihuAZmXEwbvJu
mT0AnRWaD/GI8rS628wXsEM9NKwDbFZ/
=mIZp
-END PGP SIGNATURE-
--
http://mail.python.org/mailman/listinfo/python-list


Re: Testing for Null?

2008-06-29 Thread Chris
On Jun 29, 3:12 am, c0mrade <[EMAIL PROTECTED]> wrote:
> Try something like this...
>
> list = ['lkdfjsldk', None, '', '0', 'slfkjsdlfj', 'lsdgjdlfg', False, True]
> for n, it in enumerate(list):
>     if not it: print 'Error on this definition'
>     else: print '%d. %s' % (n+1, it)
>
> Results:
> 1. lkdfjsldk
> Error on this definition
> Error on this definition
> 4. 0
> 5. slfkjsdlfj
> 6. lsdgjdlfg
> Error on this definition
> 8. True
>
>
>
> Alexnb wrote:
>
> > I am having a problem with a list value that is empty. I have a list of
> > definitions called mainList. the 5th value in the list doesn't have
> > anything
> > in it. In this case, the values are definitions; also, in this case just
> > the
> > word cheese is defined. Here is my output to the console:
>
> > 5.   a sprawling,weedy plant having small lavender or white flowers and
> > round, flat, segmented fruits thought to resemble little wheels of cheese.
> > 6.
> > 7.  an ingot or billet made into a convex, circular form by blows at the
> > ends.
>
> > I've made it so where the numbers, the period, and two spaces follow that,
> > then the definition. However, as you can see in 6, there is nothing. Here
> > is
> > the code to print all this:
>
> > n=0
>
> > for x in mainList:
> >     if mainList[n] == "":
> >         print "Error on this definition"
> >     else:
> >         print str(n+1)+".  "+str(mainList[n])
> >     n=n+1
>
> > Now the two "" is where I need to figure out if it is empty. What is up
> > right now doesn't work; or at least doesn't give the desired result. So I
> > need to know how to write the if statement to make it work. This should be
> > simple, but I just don't know how to do it, never had this problem before.
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> View this message in 
> context:http://www.nabble.com/Testing-for-Null--tp18175738p18176481.html
> Sent from the Python - python-list mailing list archive at Nabble.com.

myList = ['lkdfjsldk', None, '', '0', 'slfkjsdlfj', 'lsdgjdlfg',
False, True]
['%s\t%s'%((i+1),element) if element else '%s\tError on this
definition'%(i+1) for i,element in enumerate(myList)]
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is recursion so slow?

2008-06-29 Thread Jean-Paul Calderone

On Sun, 29 Jun 2008 10:03:46 -0400, Dan Upton <[EMAIL PROTECTED]> wrote:

On Sun, Jun 29, 2008 at 1:27 AM, Terry Reedy <[EMAIL PROTECTED]> wrote:



slix wrote:


Recursion is awesome for writing some functions, like searching trees
etc but wow how can it be THAT much slower for computing fibonacci-
numbers?


The comparison below has nothing to do with recursion versus iteration.  (It
is a common myth.) You (as have others) are comparing an exponential,
O(1.6**n), algorithm with a linear, O(n), algorithm.



FWIW, though, it's entirely possible for a recursive algorithm with
the same asymptotic runtime to be wall-clock slower, just because of
all the extra work involved in setting up and tearing down stack
frames and executing call/return instructions.  (If the function is
tail-recursive you can get around this, though I don't know exactly
how CPython is implemented and whether it optimizes that case.)


CPython doesn't do tail call elimination.  And indeed, function calls
in Python have a much higher fixed overhead than iteration.

Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list


Re: Unnormalizing normalized path in Windows

2008-06-29 Thread Duncan Booth
Julien <[EMAIL PROTECTED]> wrote:

> In Windows, when a path has been normalized with os.path.normpath, you
> get something like this:
> 
> C:/temp/my_dir/bla.txt   # With forward slashes instead or backward
> slashes.
> 
> Is it possible to revert that?
> 
 magic_function('C:/temp/my_dir/bla.txt')
> 'C:\temp\my_dir\bla.txt'
> 
> I wonder if there's a standard function to do that...

Yes, it's called os.path.normpath. Did you actually try it before posting?

>>> print os.path.normpath('C:/temp/my_dir/bla.txt')
C:\temp\my_dir\bla.txt
--
http://mail.python.org/mailman/listinfo/python-list


Re: py2exe, PyQT, QtWebKit and jpeg problem

2008-06-29 Thread yang . zengguang
On 6月20日, 下午11时04分, Carbonimax <[EMAIL PROTECTED]> wrote:
> hello
>
> I have a problem with py2exe and QtWebKit :
> I make a program with a QtWebKit view.
> If I launch the .py directly, all images (jpg, png) are displayed but
> if I compile it with py2exe I have only png images. No jpg !
> No error message, nothing.
>
> Have you a solution ? Thank you.


I have the same problem with you. I find a way to fix it:
1. Copy Qt plugins to the  directory: $YOUR_DIST_PATH/PyQt4/plugins;
2. Copy qt.conf to youar dist directory;
3. Edit qt.conf, change Prefix to $YOUR_DIST_PATH/PyQt4

Orit
--
http://mail.python.org/mailman/listinfo/python-list

Re: help debugging noob code - converting binary data to images...

2008-06-29 Thread larry
Wonderful, thank you!  Will try them out this evening.

The image module syntax looks more like what I was expecting than
TKinter.  All the online drawing examples I found yesterday used
TKinter; image was only shown to manipulate pre-made images.

Larry
--
http://mail.python.org/mailman/listinfo/python-list


gelato - nvidia and python

2008-06-29 Thread [EMAIL PROTECTED]
Did somebody worked with gelato from nvidia and python?
I have some C cod from books nvidia .
This is :
"
GelatoAPI *r = GelatoAPI::CreateRenderer();
r->Camera ("main");
... API calls through r ...
r->Render ("main");
delete r;   // Finished with this renderer
"
the code for python i create is only this :
"
python
Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gelato
>>> from gelato import *
>>> r=gelato.CreateRenderer
>>> print r

>>> dir(r)
['__call__', '__class__', '__cmp__', '__delattr__', '__doc__',
'__getattribute__', '__hash__', '__init__', '__module__', '__name__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__',
'__setattr__', '__str__']
"
And I blocked here...
Thank you .
--
http://mail.python.org/mailman/listinfo/python-list


Re: gelato - nvidia and python

2008-06-29 Thread Benjamin Kaplan
On Sun, Jun 29, 2008 at 11:34 AM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

> Did somebody worked with gelato from nvidia and python?
> I have some C cod from books nvidia .
> This is :
> "
> GelatoAPI *r = GelatoAPI::CreateRenderer();
> r->Camera ("main");
> ... API calls through r ...
> r->Render ("main");
> delete r;   // Finished with this renderer
> "
> the code for python i create is only this :
> "
> python
> Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
> [GCC 4.2.4 (Debian 4.2.4-1)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import gelato
> >>> from gelato import *
> >>> r=gelato.CreateRenderer
> >>> print r
> 
> >>> dir(r)
> ['__call__', '__class__', '__cmp__', '__delattr__', '__doc__',
> '__getattribute__', '__hash__', '__init__', '__module__', '__name__',
> '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__',
> '__setattr__', '__str__']
> "
> And I blocked here...
> Thank you .
> --


You are looking at the function CreateRenderer, not the Renderer object. Try
doing this:

>>> import gelato
>>> r = gelato.CreateRenderer*()*
>>> dir(r)

>
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list

Re: Docutils rst2html.py gives Unknown Directive type "toctree"

2008-06-29 Thread Thijs Triemstra | Collab
Getting the same error in the apache logs here, no idea where it's
coming from:

[Sun Jun 29 18:25:50 2008] [error] :10: (ERROR/3) Unknown
directive type "toctree".
[Sun Jun 29 18:25:50 2008] [error]
[Sun Jun 29 18:25:50 2008] [error] .. toctree::
[Sun Jun 29 18:25:50 2008] [error]:maxdepth: 2
[Sun Jun 29 18:25:50 2008] [error]
[Sun Jun 29 18:25:50 2008] [error] :16: (ERROR/3) Unknown
interpreted text role "ref".
[Sun Jun 29 18:25:50 2008] [error] :17: (ERROR/3) Unknown
interpreted text role "ref".
[Sun Jun 29 18:25:50 2008] [error] :18: (ERROR/3) Unknown
interpreted text role "ref".



On Jun 19, 11:19 pm, "Calvin Cheng" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am attempting to convert a bunch of .txt files into html using the
> docutils package.
>
> It works for most of the txt files except for the index.txt file which
> gives 2 errors:
> (1)  Unknown Directive type "toctree"
> (2) (ERROR/3) Unknown interpreted text role "ref".
>
> Any idea how I can fix this?
>
> Would be glad if someone who is familiar with docutils could point me
> in the right direction.
>
> Thank you,
> Calvin
--
http://mail.python.org/mailman/listinfo/python-list


Re: using urllib2

2008-06-29 Thread Alexnb

No I figured it out. I guess I never knew that you aren't supposed to split a
url like "http://www.goo\
gle.com" But I did and it gave me all those errors. Anyway, I had a
question. On the original code you had this for loop:

for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
yield tabs.findAll('td')[-1].contents[-1].string

I hate to be a pain, but I was looking at the BeautifulSoup docs, and found
the findAll thing. But I want to know why you put "for tabs," also why you
need the "'table', {'class': 'luna-Ent'}):" Like why the curly braces and
whatnot?


Jeff McNeil-2 wrote:
> 
> On Jun 27, 10:26 pm, Alexnb <[EMAIL PROTECTED]> wrote:
>> Okay, so I copied your code(and just so you know I am on a mac right now
>> and
>> i am using pydev in eclipse), and I got these errors, any idea what is
>> up?
>>
>> Traceback (most recent call last):
>>   File
>> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
>> line 14, in 
>>     print list(get_defs("cheese"))
>>   File
>> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
>> line 9, in get_defs
>>     dictionary.reference.com/search?q=%s' % term))
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py",
>> line 82, in urlopen
>>     return opener.open(url)
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py",
>> line 190, in open
>>     return getattr(self, name)(url)
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py",
>> line 325, in open_http
>>     h.endheaders()
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py",
>> line 856, in endheaders
>>     self._send_output()
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py",
>> line 728, in _send_output
>>     self.send(msg)
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py",
>> line 695, in send
>>     self.connect()
>>   File
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py",
>> line 663, in connect
>>     socket.SOCK_STREAM):
>> IOError: [Errno socket error] (8, 'nodename nor servname provided, or not
>> known')
>>
>> Sorry if it is hard to read.
>>
>>
>>
>> Jeff McNeil-2 wrote:
>>
>> > Well, what about pulling that data out using Beautiful soup? If you
>> > know the table name and whatnot, try something like this:
>>
>> > #!/usr/bin/python
>>
>> > import urllib
>> > from BeautifulSoup import BeautifulSoup
>>
>> > def get_defs(term):
>> >     soup = BeautifulSoup(urllib.urlopen('http://
>> > dictionary.reference.com/search?q=%s' % term))
>>
>> >     for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>> >         yield tabs.findAll('td')[-1].contents[-1].string
>>
>> > print list(get_defs("frog"))
>>
>> > [EMAIL PROTECTED]:~$ python test.py
>> > [u'any tailless, stout-bodied amphibian of the order Anura, including
>> > the smooth, moist-skinned frog species that live in a damp or
>> > semiaquatic habitat and the warty, drier-skinned toad species that are
>> > mostly terrestrial as adults. ', u' ', u' ', u'a French person or a
>> > person of French descent. ', u'a small holder made of heavy material,
>> > placed in a bowl or vase to hold flower stems in position. ', u'a
>> > recessed panel on one of the larger faces of a brick or the like. ',
>> > u' ', u'to hunt and catch frogs. ', u'French or Frenchlike. ', u'an
>> > ornamental fastening for the front of a coat, consisting of a button
>> > and a loop through which it passes. ', u'a sheath suspended from a
>> > belt and supporting a scabbard. ', u'a device at the intersection of
>> > two tracks to permit the wheels and flanges on one track to cross or
>> > branch from the other. ', u'a triangular mass of elastic, horny
>> > substance in the middle of the sole of the foot of a horse or related
>> > animal. ']
>>
>> > HTH,
>>
>> > Jeff
>>
>> > On Jun 27, 7:28 pm, Alexnb <[EMAIL PROTECTED]> wrote:
>> >> I have read that multiple times. It is hard to understand but it did
>> help
>> >> a
>> >> little. But I found a bit of a work-around for now which is not what I
>> >> ultimately want. However, even when I can get to the page I want lets
>> >> say,
>> >> "Http://dictionary.reference.com/browse/cheese", I look on firebug,
>> and
>> >> extension and see the definition in javascript,
>>
>> >> 
>> >> 
>> >> 
>> >> 1.
>> >> the curd of milk separated from the whey and prepared
>> in
>> >> many ways as a food. 
>>
>> >> Jeff McNeil-2 wrote:
>>
>> >> > the problem being that if I use code like this to get the html of
>> that
> 
>> >> > page in python:
>>
>> >> > response = urllib2.urlopen("the webiste")
>> >> > html = response.read()
>> >> > print html
>>
>> >> > then, I get a bunch of stuff, but it doesn't show me the code with
>> the
>> >> > table that the definition is in. So I am asking how do I access this
>> >

Re: using urllib2

2008-06-29 Thread Jeff McNeil
On Jun 29, 12:50 pm, Alexnb <[EMAIL PROTECTED]> wrote:
> No I figured it out. I guess I never knew that you aren't supposed to split a
> url like "http://www.goo\
> gle.com" But I did and it gave me all those errors. Anyway, I had a
> question. On the original code you had this for loop:
>
> for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>         yield tabs.findAll('td')[-1].contents[-1].string
>
> I hate to be a pain, but I was looking at the BeautifulSoup docs, and found
> the findAll thing. But I want to know why you put "for tabs," also why you
> need the "'table', {'class': 'luna-Ent'}):" Like why the curly braces and
> whatnot?
>
> Jeff McNeil-2 wrote:
>
> > On Jun 27, 10:26 pm, Alexnb <[EMAIL PROTECTED]> wrote:
> >> Okay, so I copied your code(and just so you know I am on a mac right now
> >> and
> >> i am using pydev in eclipse), and I got these errors, any idea what is
> >> up?
>
> >> Traceback (most recent call last):
> >>   File
> >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
> >> line 14, in 
> >>     print list(get_defs("cheese"))
> >>   File
> >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
> >> line 9, in get_defs
> >>     dictionary.reference.com/search?q=%s' % term))
> >>   File
> >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
> >>  lib.py",
> >> line 82, in urlopen
> >>     return opener.open(url)
> >>   File
> >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
> >>  lib.py",
> >> line 190, in open
> >>     return getattr(self, name)(url)
> >>   File
> >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
> >>  lib.py",
> >> line 325, in open_http
> >>     h.endheaders()
> >>   File
> >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
> >>  plib.py",
> >> line 856, in endheaders
> >>     self._send_output()
> >>   File
> >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
> >>  plib.py",
> >> line 728, in _send_output
> >>     self.send(msg)
> >>   File
> >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
> >>  plib.py",
> >> line 695, in send
> >>     self.connect()
> >>   File
> >> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
> >>  plib.py",
> >> line 663, in connect
> >>     socket.SOCK_STREAM):
> >> IOError: [Errno socket error] (8, 'nodename nor servname provided, or not
> >> known')
>
> >> Sorry if it is hard to read.
>
> >> Jeff McNeil-2 wrote:
>
> >> > Well, what about pulling that data out using Beautiful soup? If you
> >> > know the table name and whatnot, try something like this:
>
> >> > #!/usr/bin/python
>
> >> > import urllib
> >> > from BeautifulSoup import BeautifulSoup
>
> >> > def get_defs(term):
> >> >     soup = BeautifulSoup(urllib.urlopen('http://
> >> > dictionary.reference.com/search?q=%s' % term))
>
> >> >     for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
> >> >         yield tabs.findAll('td')[-1].contents[-1].string
>
> >> > print list(get_defs("frog"))
>
> >> > [EMAIL PROTECTED]:~$ python test.py
> >> > [u'any tailless, stout-bodied amphibian of the order Anura, including
> >> > the smooth, moist-skinned frog species that live in a damp or
> >> > semiaquatic habitat and the warty, drier-skinned toad species that are
> >> > mostly terrestrial as adults. ', u' ', u' ', u'a French person or a
> >> > person of French descent. ', u'a small holder made of heavy material,
> >> > placed in a bowl or vase to hold flower stems in position. ', u'a
> >> > recessed panel on one of the larger faces of a brick or the like. ',
> >> > u' ', u'to hunt and catch frogs. ', u'French or Frenchlike. ', u'an
> >> > ornamental fastening for the front of a coat, consisting of a button
> >> > and a loop through which it passes. ', u'a sheath suspended from a
> >> > belt and supporting a scabbard. ', u'a device at the intersection of
> >> > two tracks to permit the wheels and flanges on one track to cross or
> >> > branch from the other. ', u'a triangular mass of elastic, horny
> >> > substance in the middle of the sole of the foot of a horse or related
> >> > animal. ']
>
> >> > HTH,
>
> >> > Jeff
>
> >> > On Jun 27, 7:28 pm, Alexnb <[EMAIL PROTECTED]> wrote:
> >> >> I have read that multiple times. It is hard to understand but it did
> >> help
> >> >> a
> >> >> little. But I found a bit of a work-around for now which is not what I
> >> >> ultimately want. However, even when I can get to the page I want lets
> >> >> say,
> >> >> "Http://dictionary.reference.com/browse/cheese", I look on firebug,
> >> and
> >> >> extension and see the definition in javascript,
>
> >> >> 
> >> >> 
> >> >> 
> >> >> 1.
> >> >> the curd of milk separated from the whey and prepared
> >> in
> >> >> many ways as a food. 
>
> >> >> Jeff McNeil-2 wrote:
>
> >> >> > the problem being that if I use code like this to get the html of
> >> that
>
> >>

Re: Beginner's Python development questions

2008-06-29 Thread Lie
On Jun 29, 12:46 am, "Łukasz Dąbek" <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I'm newcomer to Python development and I have some questions (I didn't
> found answers for these):
>     1. Some bugs at bugs.python.org are assigned but it didn't changed
> for many months (example:http://bugs.python.org/issue1692335). Is
> that bugs closed (maybe somebody forgot to close it on website?), work
> in progress or other?

Because python is an free, open source software, there is no guarantee
when a bug would be fixed, the only thing close to a guarantee is if
you send a patch.

>     2. Is Python 2.5 still developed?

The development front for Python is 2.6 trunk and py3k trunk, I don't
know if 2.5.x is still being developed though 2.6 betas and 3.0's
betas are being released.

>     3. Is this good mailing list for such questions?

To some extent, yes, this mailing list is best for meeting with people
who develops with python not develops python itself. Another list you
might be interested is the python-dev mailing list, which is
specifically for development of python itself.

> Sorry for my English - it isn't my native language :)
>
> Greetings, Łukasz.

--
http://mail.python.org/mailman/listinfo/python-list


Re: complex numbers should respect the "I" representation

2008-06-29 Thread Lie
On Jun 29, 8:39 pm, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2008-06-29, Roy Smith <[EMAIL PROTECTED]> wrote:
>
> >> I think complex numbers should respect the "i" or "I"
> >> representation, instead of "j". No reason being cute and using
> >> a different character instead of the traditional
> >> representation?
>
> > Ask any electrical engineer what j means.
>
> And ask them what "I" means.

Ask an English-speaking man what "I" means, and I'm sure they'll
answer "I is not U".

A select few might understand what "i" means, while another select few
might understand what "j" means, but all of us understand what "I"
means.
--
http://mail.python.org/mailman/listinfo/python-list


Re: C++ or Python

2008-06-29 Thread Dan Stromberg
On Sun, 29 Jun 2008 11:20:45 +0200, Sebastian \"lunar\" Wiesner wrote:

> Dan Stromberg <[EMAIL PROTECTED]>:
> 
>> things like passing a method as a function parameter is a no-brainer
>> (requires extra syntax in java because of the cautious type system -
>> not sure about C++).
> 
> C++ has function pointers and functors, therefore this is not really an
> issue with C++.

Based on http://en.wikipedia.org/wiki/
Function_object#Functors_in_C_and_C.2B.2B it looks like there's no 
special syntax in the language core, but programs needing to pass an 
object as though it were a function (for example) do need to add some 
extra lines of code for each object needing such treatment.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is recursion so slow?

2008-06-29 Thread Terry Reedy



Dan Upton wrote:

On Sun, Jun 29, 2008 at 1:27 AM, Terry Reedy <[EMAIL PROTECTED]> wrote:


slix wrote:

Recursion is awesome for writing some functions, like searching trees
etc but wow how can it be THAT much slower for computing fibonacci-
numbers?

The comparison below has nothing to do with recursion versus iteration.  (It
is a common myth.) You (as have others) are comparing an exponential,
O(1.6**n), algorithm with a linear, O(n), algorithm.



FWIW, though, it's entirely possible for a recursive algorithm with
the same asymptotic runtime to be wall-clock slower, just because of
all the extra work involved in setting up and tearing down stack
frames and executing call/return instructions.


Which is exactly why I continued with "In Python, an algorithm written 
with iteration is faster than the same algorithm written with recursion 
because of the cost of function calls.  But the difference should be a 
multiplicative factor that is nearly constant for different n.  (I plan 
to do experiments to pin this down better.)  Consequently, algorithms 
that can easily be written iteratively, especially using for loops, 
usually are in Python programs."


People should read posts to the end before replying, in case it actually 
says what one thinks it should, but just in a different order than one 
expected.


If each call does only a small amount of work, as with fib(), I would 
guess that time difference might be a factor of 2.  As I said, I might 
do some measurement sometime in order to get a better handle on when 
rewriting recursion as iteration is worthwhile.


tjr

--
http://mail.python.org/mailman/listinfo/python-list


Re: Why is recursion so slow?

2008-06-29 Thread Dan Upton
On Sun, Jun 29, 2008 at 2:35 PM, Terry Reedy <[EMAIL PROTECTED]> wrote:
>
> People should read posts to the end before replying, in case it actually
> says what one thinks it should, but just in a different order than one
> expected.

Well, pardon me.
--
http://mail.python.org/mailman/listinfo/python-list


Re: using urllib2

2008-06-29 Thread Alexnb

Okay, so i've hit a new snag and can't seem to figure out what is wrong. What
is happening is the first 4 definitions of the word "simple" don't show up.
The html is basicly the same, with the exception of noun turning into adj.
Ill paste the html of the word cheese, and then the one for simple, and the
code I am using to do the work. 

line of html for the 2nd def of cheese:

2.a definite mass of this substance, often in the shape of a
wheel or cylinder. 

line of html for the 2nd def of simple:

2.not elaborate or artificial; plain: a simple style. 


code:

import urllib
from BeautifulSoup import BeautifulSoup


def get_defs(term):
soup =
BeautifulSoup(urllib.urlopen('http://dictionary.reference.com/search?q=%s' %
term))

for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
yield tabs.findAll('td')[-1].contents[-1].string

word = raw_input("What word would you like to define: ")

mainList = list(get_defs(word))

n=0 
q = 1

for x in mainList:
print str(q)+".  "+str(mainList[n])
q=q+1
n=n+1

Now, I don't think it is the italics because one of the definitions that
worked had them in it in the same format. Any Ideas??!


Jeff McNeil-2 wrote:
> 
> On Jun 29, 12:50 pm, Alexnb <[EMAIL PROTECTED]> wrote:
>> No I figured it out. I guess I never knew that you aren't supposed to
>> split a
>> url like "http://www.goo\
>> gle.com" But I did and it gave me all those errors. Anyway, I had a
>> question. On the original code you had this for loop:
>>
>> for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>>         yield tabs.findAll('td')[-1].contents[-1].string
>>
>> I hate to be a pain, but I was looking at the BeautifulSoup docs, and
>> found
>> the findAll thing. But I want to know why you put "for tabs," also why
>> you
>> need the "'table', {'class': 'luna-Ent'}):" Like why the curly braces and
>> whatnot?
>>
>> Jeff McNeil-2 wrote:
>>
>> > On Jun 27, 10:26 pm, Alexnb <[EMAIL PROTECTED]> wrote:
>> >> Okay, so I copied your code(and just so you know I am on a mac right
>> now
>> >> and
>> >> i am using pydev in eclipse), and I got these errors, any idea what is
>> >> up?
>>
>> >> Traceback (most recent call last):
>> >>   File
>> >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
>> >> line 14, in 
>> >>     print list(get_defs("cheese"))
>> >>   File
>> >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
>> >> line 9, in get_defs
>> >>     dictionary.reference.com/search?q=%s' % term))
>> >>   File
>> >>
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
>> lib.py",
>> >> line 82, in urlopen
>> >>     return opener.open(url)
>> >>   File
>> >>
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
>> lib.py",
>> >> line 190, in open
>> >>     return getattr(self, name)(url)
>> >>   File
>> >>
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
>> lib.py",
>> >> line 325, in open_http
>> >>     h.endheaders()
>> >>   File
>> >>
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>> plib.py",
>> >> line 856, in endheaders
>> >>     self._send_output()
>> >>   File
>> >>
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>> plib.py",
>> >> line 728, in _send_output
>> >>     self.send(msg)
>> >>   File
>> >>
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>> plib.py",
>> >> line 695, in send
>> >>     self.connect()
>> >>   File
>> >>
>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>> plib.py",
>> >> line 663, in connect
>> >>     socket.SOCK_STREAM):
>> >> IOError: [Errno socket error] (8, 'nodename nor servname provided, or
>> not
>> >> known')
>>
>> >> Sorry if it is hard to read.
>>
>> >> Jeff McNeil-2 wrote:
>>
>> >> > Well, what about pulling that data out using Beautiful soup? If you
>> >> > know the table name and whatnot, try something like this:
>>
>> >> > #!/usr/bin/python
>>
>> >> > import urllib
>> >> > from BeautifulSoup import BeautifulSoup
>>
>> >> > def get_defs(term):
>> >> >     soup = BeautifulSoup(urllib.urlopen('http://
>> >> > dictionary.reference.com/search?q=%s' % term))
>>
>> >> >     for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>> >> >         yield tabs.findAll('td')[-1].contents[-1].string
>>
>> >> > print list(get_defs("frog"))
>>
>> >> > [EMAIL PROTECTED]:~$ python test.py
>> >> > [u'any tailless, stout-bodied amphibian of the order Anura,
>> including
>> >> > the smooth, moist-skinned frog species that live in a damp or
>> >> > semiaquatic habitat and the warty, drier-skinned toad species that
>> are
>> >> > mostly terrestrial as adults. ', u' ', u' ', u'a French person or a
>> >> > person of French descent. ', u'a small holder made of heavy
>> material,
>> >> > placed in a bowl or vase to hold flower stems in position. ', u'a
>> >> > recessed panel on one of the larger faces of a brick or the lik

Re: tkinter, loading image error, TclError: couldn't recognize data in image file "C:/users/me/desktop/images/blob4.jpg"

2008-06-29 Thread Terry Reedy



defn noob wrote:

from Tkinter import *
import os

master = Tk()
w = Canvas(master, width=800, height=600)

print os.path.exists('C:/me/saftarn/desktop/images/blob4.jpg')

im = PhotoImage(file = 'C:/users/saftarn/desktop/images/blob4.jpg')
#im = file = 'C:/users/me/desktop/images/blob4.jpg'
pic = w.create_image(0, 0, image = im, anchor = NW)

#image = open('C:/users/saftarn/desktop/images/blob.png')

colors = []
for x in range(1, 800):
for y in range(1, 600):
pic = w.find_closest(x, y)[0]
obj = objects[pic]
colors.append(obj.get(int(x), int(y)))

print colors



True

Traceback (most recent call last):
  File "C:/Python25/Progs/ImageVideoSearch/imId.py", line 9, in

im = PhotoImage(file = 'C:/users/me/desktop/images/blob4.jpg')
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 3270, in __init__
Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 3226, in __init__
self.tk.call(('image', 'create', imgtype, name,) + options)
TclError: couldn't recognize data in image file "C:/users/me/desktop/
images/blob4.jpg"



it has worked before opening and displaying a file like this, anything
to do with python 2.52, upgraded from 2.5.1


Did it work with that exact file?  Have you tried other files that did 
work with 2.5.1?  The error comes from tcl/tk, not Python.  I expect 
that the version of tcl/tk delivered with 2.5.2 is exactly the same as 
that delivered with 2.5.1, just to avoid such problems.


Note that even if one program displays a file it may still be slightly 
corrupt and properly fail to display with another.  If you have an image 
editor, you might try opening and saving (different name) without changing.


tjr

--
http://mail.python.org/mailman/listinfo/python-list


Re: using urllib2

2008-06-29 Thread Alexnb

Actually after looking at this, the code is preactically the same, except the
definitions. So what COULD be going wrong here?

Alexnb wrote:
> 
> Okay, so i've hit a new snag and can't seem to figure out what is wrong.
> What is happening is the first 4 definitions of the word "simple" don't
> show up. The html is basicly the same, with the exception of noun turning
> into adj. Ill paste the html of the word cheese, and then the one for
> simple, and the code I am using to do the work. 
> 
> line of html for the 2nd def of cheese:
> 
> 2. valign="top">a definite mass of this substance, often in the shape of a
> wheel or cylinder. 
> 
> line of html for the 2nd def of simple:
> 
> 2. valign="top">not elaborate or artificial; plain: a simple style. 
> 
> 
> code:
> 
> import urllib
> from BeautifulSoup import BeautifulSoup
> 
> 
> def get_defs(term):
> soup =
> BeautifulSoup(urllib.urlopen('http://dictionary.reference.com/search?q=%s'
> % term))
> 
> for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
> yield tabs.findAll('td')[-1].contents[-1].string
> 
> word = raw_input("What word would you like to define: ")
> 
> mainList = list(get_defs(word))
> 
> n=0 
> q = 1
> 
> for x in mainList:
> print str(q)+".  "+str(mainList[n])
> q=q+1
> n=n+1
> 
> Now, I don't think it is the italics because one of the definitions that
> worked had them in it in the same format. Any Ideas??!
> 
> 
> Jeff McNeil-2 wrote:
>> 
>> On Jun 29, 12:50 pm, Alexnb <[EMAIL PROTECTED]> wrote:
>>> No I figured it out. I guess I never knew that you aren't supposed to
>>> split a
>>> url like "http://www.goo\
>>> gle.com" But I did and it gave me all those errors. Anyway, I had a
>>> question. On the original code you had this for loop:
>>>
>>> for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>>>         yield tabs.findAll('td')[-1].contents[-1].string
>>>
>>> I hate to be a pain, but I was looking at the BeautifulSoup docs, and
>>> found
>>> the findAll thing. But I want to know why you put "for tabs," also why
>>> you
>>> need the "'table', {'class': 'luna-Ent'}):" Like why the curly braces
>>> and
>>> whatnot?
>>>
>>> Jeff McNeil-2 wrote:
>>>
>>> > On Jun 27, 10:26 pm, Alexnb <[EMAIL PROTECTED]> wrote:
>>> >> Okay, so I copied your code(and just so you know I am on a mac right
>>> now
>>> >> and
>>> >> i am using pydev in eclipse), and I got these errors, any idea what
>>> is
>>> >> up?
>>>
>>> >> Traceback (most recent call last):
>>> >>   File
>>> >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
>>> >> line 14, in 
>>> >>     print list(get_defs("cheese"))
>>> >>   File
>>> >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
>>> >> line 9, in get_defs
>>> >>     dictionary.reference.com/search?q=%s' % term))
>>> >>   File
>>> >>
>>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
>>> lib.py",
>>> >> line 82, in urlopen
>>> >>     return opener.open(url)
>>> >>   File
>>> >>
>>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
>>> lib.py",
>>> >> line 190, in open
>>> >>     return getattr(self, name)(url)
>>> >>   File
>>> >>
>>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
>>> lib.py",
>>> >> line 325, in open_http
>>> >>     h.endheaders()
>>> >>   File
>>> >>
>>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>>> plib.py",
>>> >> line 856, in endheaders
>>> >>     self._send_output()
>>> >>   File
>>> >>
>>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>>> plib.py",
>>> >> line 728, in _send_output
>>> >>     self.send(msg)
>>> >>   File
>>> >>
>>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>>> plib.py",
>>> >> line 695, in send
>>> >>     self.connect()
>>> >>   File
>>> >>
>>> "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/htt
>>> plib.py",
>>> >> line 663, in connect
>>> >>     socket.SOCK_STREAM):
>>> >> IOError: [Errno socket error] (8, 'nodename nor servname provided, or
>>> not
>>> >> known')
>>>
>>> >> Sorry if it is hard to read.
>>>
>>> >> Jeff McNeil-2 wrote:
>>>
>>> >> > Well, what about pulling that data out using Beautiful soup? If you
>>> >> > know the table name and whatnot, try something like this:
>>>
>>> >> > #!/usr/bin/python
>>>
>>> >> > import urllib
>>> >> > from BeautifulSoup import BeautifulSoup
>>>
>>> >> > def get_defs(term):
>>> >> >     soup = BeautifulSoup(urllib.urlopen('http://
>>> >> > dictionary.reference.com/search?q=%s' % term))
>>>
>>> >> >     for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>>> >> >         yield tabs.findAll('td')[-1].contents[-1].string
>>>
>>> >> > print list(get_defs("frog"))
>>>
>>> >> > [EMAIL PROTECTED]:~$ python test.py
>>> >> > [u'any tailless, stout-bodied amphibian of the order Anura,
>>> including
>>> >> > the smooth, moist-skinned frog species that live in a damp or
>>>

Function to import module to namespace

2008-06-29 Thread bvdp


Is it possible to do this from a function: import a module and append 
the defs in that module to an existing module/namesapce.


So, in my code I have something like:

# main code
import mods

def loadmore(n):
   import_module(n, mods)


# end of main

this will permit the addition of the the stuff in file 'n.py' to 'mods'.

Assuming that foo1() is defined in newmod, I should now be able to do 
something like mods.foo1().


Thanks.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Function to import module to namespace

2008-06-29 Thread Cédric Lucantis
Le Sunday 29 June 2008 21:08:36 bvdp, vous avez écrit :
> Is it possible to do this from a function: import a module and append
> the defs in that module to an existing module/namesapce.
>
> So, in my code I have something like:
>
> # main code
> import mods
>
> def loadmore(n):
> import_module(n, mods)
>
> 
> # end of main
>
> this will permit the addition of the the stuff in file 'n.py' to 'mods'.
>
> Assuming that foo1() is defined in newmod, I should now be able to do
> something like mods.foo1().
>

You can dynamically add objects to a module:

>>> import os
>>> os.foo = 'bar'
>>> os.foo
'bar'
>>> setattr(os, 'foo2', 'bar2')
>>> os.foo2
'bar2'

and for the loading part you can use the __import__ builtin or maybe execfile  
(see the 'built-in functions' chapter of the library reference for more about 
these).

-- 
Cédric Lucantis
--
http://mail.python.org/mailman/listinfo/python-list


Re: gelato - nvidia and python

2008-06-29 Thread name
On Jun 29, 5:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Did somebody worked with gelato from nvidia and python?
> I have some C cod from books nvidia .
> This is :
> "
> GelatoAPI *r = GelatoAPI::CreateRenderer();
> r->Camera ("main");
> ... API calls through r ...
> r->Render ("main");
> delete r;   // Finished with this renderer
> "
> the code for python i create is only this :
> "
> python
> Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
> [GCC 4.2.4 (Debian 4.2.4-1)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> 
> import gelato
> >>> from gelato import *
> >>> r=gelato.CreateRenderer
> >>> print r
>
> >>> dir(r)
>
> ['__call__', '__class__', '__cmp__', '__delattr__', '__doc__',
> '__getattribute__', '__hash__', '__init__', '__module__', '__name__',
> '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__',
> '__setattr__', '__str__']
> "
> And I blocked here...
> Thank you .

Maybe you should execute the CreateRenderer, like
r=gelato.CreateRenderer()
dir(r)

I don't have gelato but it might work..
--
http://mail.python.org/mailman/listinfo/python-list


Re: using urllib2

2008-06-29 Thread Alexnb

Okay, now I ran in it the shell, and this is what happened:

>>> for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
... tabs.findAll('td')[-1].contents[-1].string
... 
u' '
u' '
u' '
u' '
u' '
u'not complex or compound; single. '
u' '
u' '
u' '
u' '
u' '
u'inconsequential or rudimentary. '
u'unlearned; ignorant. '
u' '
u'unsophisticated; naive; credulous. '
u' '
u'not mixed. '
u' '
u'not mixed. '
u' '
u' '
u' '
u' '
u'). '
u' '
u'(of a lens) having two optical surfaces only. '
u'an ignorant, foolish, or gullible person. '
u'something simple, unmixed, or uncompounded. '
u'cords for controlling the warp threads in forming the shed on draw-looms.
'
u'a person of humble origins; commoner. '
u' '
>>> 

However, the definitions are there. I printed the actual soup and they were
there in the format they always were in. So what is the deal!?!

>>> soup.findAll('table', {'class': 'luna-Ent'})
[1.easy to understand, deal with, use, etc.: a simple matter;
simple tools.  

See there is the first one in the shell, I mean it is there, but the for
loop can't find it. I am wondering, because the above
soup.findAll('table'..etc. makes it a list. Do you think that has anything
to do with the problem?


Alexnb wrote:
> 
> Actually after looking at this, the code is preactically the same, except
> the definitions. So what COULD be going wrong here?
> 
> Also, I ran the program and decided to print the whole list of definitions
> straight off BeautifulSoup, and I got an interesting result:
> 
> What word would you like to define: simple
> [u' ', u' ', u' ', u' ', u' ', u'not complex or compound; single.
> 
> those are the first 5 definitions. and later on, it does the same thing.
> it only sees a space, any ideas?
> 
> Alexnb wrote:
>> 
>> Okay, so i've hit a new snag and can't seem to figure out what is wrong.
>> What is happening is the first 4 definitions of the word "simple" don't
>> show up. The html is basicly the same, with the exception of noun turning
>> into adj. Ill paste the html of the word cheese, and then the one for
>> simple, and the code I am using to do the work. 
>> 
>> line of html for the 2nd def of cheese:
>> 
>> 2.> valign="top">a definite mass of this substance, often in the shape of a
>> wheel or cylinder. 
>> 
>> line of html for the 2nd def of simple:
>> 
>> 2.> valign="top">not elaborate or artificial; plain: a simple style. 
>> 
>> 
>> code:
>> 
>> import urllib
>> from BeautifulSoup import BeautifulSoup
>> 
>> 
>> def get_defs(term):
>> soup =
>> BeautifulSoup(urllib.urlopen('http://dictionary.reference.com/search?q=%s'
>> % term))
>> 
>> for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>> yield tabs.findAll('td')[-1].contents[-1].string
>> 
>> word = raw_input("What word would you like to define: ")
>> 
>> mainList = list(get_defs(word))
>> 
>> n=0 
>> q = 1
>> 
>> for x in mainList:
>> print str(q)+".  "+str(mainList[n])
>> q=q+1
>> n=n+1
>> 
>> Now, I don't think it is the italics because one of the definitions that
>> worked had them in it in the same format. Any Ideas??!
>> 
>> 
>> Jeff McNeil-2 wrote:
>>> 
>>> On Jun 29, 12:50 pm, Alexnb <[EMAIL PROTECTED]> wrote:
 No I figured it out. I guess I never knew that you aren't supposed to
 split a
 url like "http://www.goo\
 gle.com" But I did and it gave me all those errors. Anyway, I had a
 question. On the original code you had this for loop:

 for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
         yield tabs.findAll('td')[-1].contents[-1].string

 I hate to be a pain, but I was looking at the BeautifulSoup docs, and
 found
 the findAll thing. But I want to know why you put "for tabs," also why
 you
 need the "'table', {'class': 'luna-Ent'}):" Like why the curly braces
 and
 whatnot?

 Jeff McNeil-2 wrote:

 > On Jun 27, 10:26 pm, Alexnb <[EMAIL PROTECTED]> wrote:
 >> Okay, so I copied your code(and just so you know I am on a mac right
 now
 >> and
 >> i am using pydev in eclipse), and I got these errors, any idea what
 is
 >> up?

 >> Traceback (most recent call last):
 >>   File
 >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
 >> line 14, in 
 >>     print list(get_defs("cheese"))
 >>   File
 >> "/Users/Alex/Documents/workspace/beautifulSoup/src/firstExample.py",
 >> line 9, in get_defs
 >>     dictionary.reference.com/search?q=%s' % term))
 >>   File
 >>
 "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
 lib.py",
 >> line 82, in urlopen
 >>     return opener.open(url)
 >>   File
 >>
 "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
 lib.py",
 >> line 190, in open
 >>     return getattr(self, name)(url)
 >>   File
 >>
 "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/url
 lib.

Re: Docutils rst2html.py gives Unknown Directive type "toctree"

2008-06-29 Thread Gerard Flanagan
On Jun 19, 11:19 pm, "Calvin Cheng" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am attempting to convert a bunch of .txt files into html using the
> docutils package.
>
> It works for most of the txt files except for the index.txt file which
> gives 2 errors:
> (1)  Unknown Directive type "toctree"
> (2) (ERROR/3) Unknown interpreted text role "ref".
>
> Any idea how I can fix this?
>
> Would be glad if someone who is familiar with docutils could point me
> in the right direction.


"toctree" is a directive specific to the sphinx documentation system:

http://sphinx.pocoo.org/concepts.html#the-toc-tree

You must have something like:

.. toctree::

in your file. docutils won't recognise this.

G.
--
http://mail.python.org/mailman/listinfo/python-list


UnboundLocalError problems

2008-06-29 Thread Mr SZ

Hi,

I am writing a small script that changes my pidgin status to away when I lock 
my screen.I'm using the DBUS API for pidgin and gnome-screensaver.Here's the 
code:

#!/usr/bin/env python

import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()

obj = bus.get_object("im.pidgin.purple.PurpleService", 
"/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")


STATUS_AVAILABLE = 2
STATUS_AWAY = 5

ORIG_TYPE = 0
ORIG_MSG = ""


def my_func2(IsEnabled):
if IsEnabled:
ORIG_TYPE,ORIG_MSG = get_current()
set_status(STATUS_AWAY,"I'm not at my desk")
else:
set_status(ORIG_TYPE,ORIG_MSG)

def set_status(kind, message):

status = purple.PurpleSavedstatusNew("", kind)

purple.PurpleSavedstatusSetMessage(status, message)
purple.PurpleSavedstatusActivate(status)


def get_current():
typ = purple.PurpleSavedstatusGetType(purple.PurpleSavedstatusGetCurrent())
current = purple.PurpleSavedstatusGetCurrent()
msg = purple.PurpleSavedstatusGetMessage(dbus.Int32(current))
return typ,msg

bus.add_signal_receiver(my_func2,
dbus_interface="org.gnome.ScreenSaver",
signal_name="SessionIdleChanged")


loop = gobject.MainLoop()
loop.run()


When I run it,it errors out at :

set_status(ORIG_TYPE,ORIG_MSG)

giving the error "UnboundLocalError: local variable 'ORIG_TYPE' referenced 
before assignment" .This happens 

 Aren't ORIG_TYPE and ORIG_MSG global variables? Where am I going 
wrong?Everything works fine if I set the arguments manually to the set_status 
function.

Regards,
SZ


  Get the name you always wanted with the new y7mail email address.
www.yahoo7.com.au/mail--
http://mail.python.org/mailman/listinfo/python-list

Re: gelato - nvidia and python

2008-06-29 Thread Paul Boddie
On 29 Jun, 17:34, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
>
> >>> dir(r)
>
> ['__call__', '__class__', '__cmp__', '__delattr__', '__doc__',
> '__getattribute__', '__hash__', '__init__', '__module__', '__name__',
> '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__',
> '__setattr__', '__str__']

What about asking for help on r?

  >>> help(r)

Beyond that, you'd want to look at any published API documentation or
even the source code for the module, which I'd imagine is C or C++ in
this case.

Paul
--
http://mail.python.org/mailman/listinfo/python-list


list extension ?

2008-06-29 Thread Stef Mientki

hello,

I basically need a list with a few extra attributes,
so I derived a new object from a list, and it works perfect.
But I wonder why the newly derived list component is much more flexible ?

# so here is the new list object
class tGrid_List ( list ) :
   def __init__ ( self, value = [] ) :
   list.__init__ ( self, value )

# and with this new list component, I can add new attributes on the fly

a = tGrid_list ( [ 2, 3 ] )
a.New_Attribute = 'some text'

# I'm not allowed to this with the standard list

a = [ 2, 3 ]
a.New_Attribute = 'some text' <== ERROR

Can someone explain this different behavior ?

thanks,
Stef Mientki
--
http://mail.python.org/mailman/listinfo/python-list


Re: list extension ?

2008-06-29 Thread Scott David Daniels

Stef Mientki wrote:
... (approximately, I PEP-8'ed it a bit) ...

class tGrid_List(list):
   def __init__(self, value=[]):
   list.__init__(self, value)
# and with this new list component, I can add new attributes on the fly
a = tGrid_list([2, 3])
a.New_Attribute = 'some text'

# I'm not allowed to this with the standard list
Can someone explain this different behavior ?


Yes, you did not add a __slots__ member, so the object will have a
__dict__ attribute.  The __slots__ stuff is a storage optimization
for frequently used data types (not worth it if you don't plan to
have more than several thousand at any one time).  Lists (for that
matter most Python builtin types) get used a lot, so they have that
built in.

You can observe that even on the most trivial extensions:

class AttributableInt(int): pass
class AttributeFreeInt(int): __slots__ = ()

--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list


Re: using urllib2

2008-06-29 Thread Jeff McNeil
I didn't spend a lot of time debugging that code -- I've been using
beautiful soup a lot at work lately and really pulled that out of
memory at about 2:00 AM a couple days ago.

In the 5 minute I spent on it, it appeared that the definitions were
setup like so:



Blah
Definition>



I was attempting to find all of the tables with that class assigned
(thus the dictionary passed to findAll) and then, using the -1, grab
the contents of the last 'td' defined within the definition table.
The second -1 was an index into all of the contents of the last TD,
attempting to pull the definition string -- I saw a few span tags in
there that don't really matter.

Grabbing definitions like this is troublesome.  If they change their
interface (i.e. HTML display), then you'll have to go back and change
what you're doing.   I was really just intending to give you a few
pointers -- not provide production quality code.

If you need definitions, another place you may want to look would be
google's JSON search API.  You may be able to search for
'define:word', and then you don't have to rely on the screen
scraping.

Thanks!

Jeff

On Jun 29, 4:04 pm, Alexnb <[EMAIL PROTECTED]> wrote:
> Okay, now I ran in it the shell, and this is what happened:
>
> >>> for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>
> ...     tabs.findAll('td')[-1].contents[-1].string
> ...
> u' '
> u' '
> u' '
> u' '
> u' '
> u'not complex or compound; single. '
> u' '
> u' '
> u' '
> u' '
> u' '
> u'inconsequential or rudimentary. '
> u'unlearned; ignorant. '
> u' '
> u'unsophisticated; naive; credulous. '
> u' '
> u'not mixed. '
> u' '
> u'not mixed. '
> u' '
> u' '
> u' '
> u' '
> u'). '
> u' '
> u'(of a lens) having two optical surfaces only. '
> u'an ignorant, foolish, or gullible person. '
> u'something simple, unmixed, or uncompounded. '
> u'cords for controlling the warp threads in forming the shed on draw-looms.
> '
> u'a person of humble origins; commoner. '
> u' '
>
>
>
> However, the definitions are there. I printed the actual soup and they were
> there in the format they always were in. So what is the deal!?!
>
> >>> soup.findAll('table', {'class': 'luna-Ent'})
>
> [1. valign="top">easy to understand, deal with, use, etc.: a simple matter;
> simple tools.  
>
> See there is the first one in the shell, I mean it is there, but the for
> loop can't find it. I am wondering, because the above
> soup.findAll('table'..etc. makes it a list. Do you think that has anything
> to do with the problem?
>
> Alexnb wrote:
>
> > Actually after looking at this, the code is preactically the same, except
> > the definitions. So what COULD be going wrong here?
>
> > Also, I ran the program and decided to print the whole list of definitions
> > straight off BeautifulSoup, and I got an interesting result:
>
> > What word would you like to define: simple
> > [u' ', u' ', u' ', u' ', u' ', u'not complex or compound; single.
>
> > those are the first 5 definitions. and later on, it does the same thing.
> > it only sees a space, any ideas?
>
> > Alexnb wrote:
>
> >> Okay, so i've hit a new snag and can't seem to figure out what is wrong.
> >> What is happening is the first 4 definitions of the word "simple" don't
> >> show up. The html is basicly the same, with the exception of noun turning
> >> into adj. Ill paste the html of the word cheese, and then the one for
> >> simple, and the code I am using to do the work.
>
> >> line of html for the 2nd def of cheese:
>
> >> 2. >> valign="top">a definite mass of this substance, often in the shape of a
> >> wheel or cylinder. 
>
> >> line of html for the 2nd def of simple:
>
> >> 2. >> valign="top">not elaborate or artificial; plain: a simple style.
> >> 
>
> >> code:
>
> >> import urllib
> >> from BeautifulSoup import BeautifulSoup
>
> >> def get_defs(term):
> >>     soup =
> >> BeautifulSoup(urllib.urlopen('http://dictionary.reference.com/search?q=%s'
> >> % term))
>
> >>     for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
> >>         yield tabs.findAll('td')[-1].contents[-1].string
>
> >> word = raw_input("What word would you like to define: ")
>
> >> mainList = list(get_defs(word))
>
> >> n=0
> >> q = 1
>
> >> for x in mainList:
> >>     print str(q)+".  "+str(mainList[n])
> >>     q=q+1
> >>     n=n+1
>
> >> Now, I don't think it is the italics because one of the definitions that
> >> worked had them in it in the same format. Any Ideas??!
>
> >> Jeff McNeil-2 wrote:
>
> >>> On Jun 29, 12:50 pm, Alexnb <[EMAIL PROTECTED]> wrote:
>  No I figured it out. I guess I never knew that you aren't supposed to
>  split a
>  url like "http://www.goo\
>  gle.com" But I did and it gave me all those errors. Anyway, I had a
>  question. On the original code you had this for loop:
>
>  for tabs in soup.findAll('table', {'class': 'luna-Ent'}):
>          yield tabs.findAll('td')[-1].contents[-1].string
>
>  I hate to be a pain, but I was looking at the BeautifulSoup docs, and
>  found

Re: Function to import module to namespace

2008-06-29 Thread Terry Reedy



bvdp wrote:


Is it possible to do this from a function: import a module and append 
the defs in that module to an existing module/namesapce.


So, in my code I have something like:

# main code
import mods

def loadmore(n):
   import_module(n, mods)


# end of main

this will permit the addition of the the stuff in file 'n.py' to 'mods'.

Assuming that foo1() is defined in newmod, I should now be able to do 
something like mods.foo1().


Do you mean something like this?
>>> import string
>>> dir(string)
['Formatter', 'Template', '_TemplateMetaclass', '__builtins__', 
'__doc__', '__file__', '__name__', '__package__', '_multimap', '_re', 
'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 'capwords', 
'digits', 'hexdigits', 'maketrans', 'octdigits', 'printable', 
'punctuation', 'whitespace']

>>> import math

>>> math.__dict__.update(string.__dict__)
>>> dir(math)
['Formatter', 'Template', '_TemplateMetaclass', '__builtins__', 
'__doc__', '__file__', '__name__', '__package__', '_multimap', '_re', 
'acos', 'acosh', 'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 
'asin', 'asinh', 'atan', 'atan2', 'atanh', 'capwords', 'ceil', 
'copysign', 'cos', 'cosh', 'degrees', 'digits', 'e', 'exp', 'fabs', 
'factorial', 'floor', 'fmod', 'frexp', 'hexdigits', 'hypot', 'isinf', 
'isnan', 'ldexp', 'log', 'log10', 'log1p', 'maketrans', 'modf', 
'octdigits', 'pi', 'pow', 'printable', 'punctuation', 'radians', 'sin', 
'sinh', 'sqrt', 'sum', 'tan', 'tanh', 'trunc', 'whitespace']


tjr

--
http://mail.python.org/mailman/listinfo/python-list


Re: UnboundLocalError problems

2008-06-29 Thread Terry Reedy



Mr SZ wrote:


Hi,

I am writing a small script that changes my pidgin status to away when I 
lock my screen.I'm using the DBUS API for pidgin and 
gnome-screensaver.Here's the code:


#!/usr/bin/env python

import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()

obj = bus.get_object("im.pidgin.purple.PurpleService", 
"/im/pidgin/purple/PurpleObject")

purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")


STATUS_AVAILABLE = 2
STATUS_AWAY = 5

ORIG_TYPE = 0
ORIG_MSG = ""


def my_func2(IsEnabled):


you need
  global ORIG_TYPE,ORIG_MSG


if IsEnabled:
ORIG_TYPE,ORIG_MSG = get_current() 


because this otherwise marks them as local.

[snip]


When I run it,it errors out at :

set_status(ORIG_TYPE,ORIG_MSG)   

giving the error "UnboundLocalError: local variable 'ORIG_TYPE' 
referenced before assignment" .This happens


In the future, copy and paste the full traceback, which often has 
additional useful information -- like the line # of the call -- which is 
not so obvious to someone who has not read the code.


 
Aren't ORIG_TYPE and ORIG_MSG global variables? Where am I going 
wrong?Everything works fine if I set the arguments manually to the 
set_status function.


*Any* assignment to a name, including with def, class, import, and 
augmented assignment, even if the statement is unreachable and cannot be 
executed, marks the name as local -- unless you specify it as global (or 
nonlocal in 3.0).


tjr

--
http://mail.python.org/mailman/listinfo/python-list


Re: Function to import module to namespace

2008-06-29 Thread bvdp

Terry Reedy wrote:



bvdp wrote:


Is it possible to do this from a function: import a module and append 
the defs in that module to an existing module/namesapce.


So, in my code I have something like:

# main code
import mods

def loadmore(n):
   import_module(n, mods)


# end of main

this will permit the addition of the the stuff in file 'n.py' to 'mods'.

Assuming that foo1() is defined in newmod, I should now be able to do 
something like mods.foo1().


Do you mean something like this?
 >>> import string
 >>> dir(string)
['Formatter', 'Template', '_TemplateMetaclass', '__builtins__', 
'__doc__', '__file__', '__name__', '__package__', '_multimap', '_re', 
'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 'capwords', 
'digits', 'hexdigits', 'maketrans', 'octdigits', 'printable', 
'punctuation', 'whitespace']

 >>> import math

 >>> math.__dict__.update(string.__dict__)
 >>> dir(math)
['Formatter', 'Template', '_TemplateMetaclass', '__builtins__', 
'__doc__', '__file__', '__name__', '__package__', '_multimap', '_re', 
'acos', 'acosh', 'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 
'asin', 'asinh', 'atan', 'atan2', 'atanh', 'capwords', 'ceil', 
'copysign', 'cos', 'cosh', 'degrees', 'digits', 'e', 'exp', 'fabs', 
'factorial', 'floor', 'fmod', 'frexp', 'hexdigits', 'hypot', 'isinf', 
'isnan', 'ldexp', 'log', 'log10', 'log1p', 'maketrans', 'modf', 
'octdigits', 'pi', 'pow', 'printable', 'punctuation', 'radians', 'sin', 
'sinh', 'sqrt', 'sum', 'tan', 'tanh', 'trunc', 'whitespace']


tjr



Yes, I think that's what I might need. I'll give it a go in my code and 
see if that does work.


Thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Function to import module to namespace

2008-06-29 Thread bvdp

Terry Reedy wrote:
>

  

>
> Do you mean something like this?

 

>  >>> math.__dict__.update(string.__dict__)
>  >>> dir(math)
> ['Formatter', 'Template', '_TemplateMetaclass', '__builtins__',

 

I think this is working First off, 2 module files:

funcs.py
def func1():
print "I'm func1 in funcs.py"

more.py
def func2():
print "I'm func2 in 'more.py'"

and my wonderful main program:

xx.py
import funcs
def addnewfuncs(p):
x = __import__(p)
funcs.__dict__.update(x.__dict__)
funcs.func1()
addnewfuncs('more')
funcs.func2()

The first problem I had was getting import to accept a variable. It 
doesn't seem to, so I used __import__(). Then, I had to remember to 
assign this to a variable ... and then it appears to work just fine.


Did I miss anything in this???

Thanks for the pointer!

Bob.
--
http://mail.python.org/mailman/listinfo/python-list


RE: Use of the "is" statement

2008-06-29 Thread Delaney, Timothy (Tim)
Maric Michaud wrote:

> Le Friday 27 June 2008 18:26:45 Christian Heimes, vous avez écrit :
>> Ask yourself if you are interested if f.tell() returns exactly the
>> same 0 object ("is") or a number that is equal to 0 ("==").
> 
> That said, "f.tell() == 0" and "f.tell() != 0" should be written
> "f.tell()" and "not f.tell()" in python.
> 
> if not f.tell() :
> print 'at the beginning of the file"

No, because semantically you're not using the result of f.tell() as a boolean 
value. tell() returns a *position*, and he is checking for a particular 
position.

If he'd instead been testing for f.tell() == 2, would you have advisd that he 
use "if f.tell()"?

Ignoring the triviality of the below code, would you suggest refactoring:

for i, v in enumerate(iterable):
if i == 0:
doSomethingSpecial()
else:
print i

as:

for i, v in enumerate(iterable):
if not i:
doSomethingSpecial()
else:
print -i

?

Tim Delaney
--
http://mail.python.org/mailman/listinfo/python-list


Re: Function to import module to namespace

2008-06-29 Thread John Machin
On Jun 30, 9:52 am, bvdp <[EMAIL PROTECTED]> wrote:
> Terry Reedy wrote:
>
>  >
>
>
>
>  >
>  > Do you mean something like this?
>
>   
>
>  >  >>> math.__dict__.update(string.__dict__)
>  >  >>> dir(math)
>  > ['Formatter', 'Template', '_TemplateMetaclass', '__builtins__',
>
>   
>
> I think this is working First off, 2 module files:
>
> funcs.py
> def func1():
>  print "I'm func1 in funcs.py"
>
> more.py
> def func2():
>  print "I'm func2 in 'more.py'"
>
> and my wonderful main program:
>
> xx.py
> import funcs
> def addnewfuncs(p):
>  x = __import__(p)
>  funcs.__dict__.update(x.__dict__)
> funcs.func1()
> addnewfuncs('more')
> funcs.func2()
>
> The first problem I had was getting import to accept a variable. It
> doesn't seem to, so I used __import__(). Then, I had to remember to
> assign this to a variable ... and then it appears to work just fine.
>
> Did I miss anything in this???

You are updating with *everything* in the 'more' module, not just the
functions. This includes such things as __name__, __doc__, __file__.
Could have interesting side-effects.

One quick silly question: why do you want to do this anyway?

Sorry, *two* quick silly questions: are the add-on modules under your
control, or do you want to be able to do this with arbitrary modules?
[If under your control, you could insist that such modules had an
__all__ attribute with appropriate contents]

A third: why do you want to import into an existing namespace? Now
that you know about __import__, why just not call the functions where
they are?

Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list


How to invoke the Python idle

2008-06-29 Thread Only-Trouble
Hi all
I am running openSUSE 10.3
I am learning python on my own, it seems like  the system has already
installed a python IDLE
The question is how to invoke it?


Thanks

Only-Trouble
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with internationalized headers in email package

2008-06-29 Thread Martin v. Löwis
> + An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'.
> + An 'encoded-word' MUST NOT appear within a 'quoted-string'.
> + An 'encoded-word' MUST NOT be used in a Received header field.
> + An 'encoded-word' MUST NOT be used in parameter of a MIME
>   Content-Type or Content-Disposition field, or in any structured
>   field body except within a 'comment' or 'phrase'.
> 
> 
> However (Python 2.5.2):
> 
 h = Header(u'Andrè <[EMAIL PROTECTED]>')
 h.encode()
> '=?utf-8?b?QW5kcsOoIDxhbmRyZUBsb2NhbGhvc3Q+?='
> 
> 
> I'm not sure if this can be considered a bug, but surely this is an 
> invalid header.

Which of the conditions do you consider validated? It seems to me that
this would make a completely correct Subject header, for example.

Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list

Re: Function to import module to namespace

2008-06-29 Thread bvdp

John Machin wrote:



Good questions. Short answer ... probably 'cause I've not thought the 
problem though completely :)


> You are updating with *everything* in the 'more' module, not just the
> functions. This includes such things as __name__, __doc__, __file__.
> Could have interesting side-effects.
>
> One quick silly question: why do you want to do this anyway?
>

I'm writing a "simple" macro expander. I've got some mainline code which 
reads an input file, parses out macros, and expands them. So, in my 
input file I might have something like:


 a fjas j kj sdklj sdkl jfsdkl [ link somewhere sometext ]

So, I need a function link() to evaluate and return "http://";

Instead of putting funcs like link() in my mainline I've stuck them in a 
module of their own. In the mainline I


   import funcs

and then when I need to expand I have the following code:

if not cmd in vars(funcs):
error("Unknown function/variable '%s'" % cmd)

if type(vars(funcs)[cmd]) == type(parse):
txt = eval("""funcs.%s("%s")""" % (cmd, arg))

else:   # not a func, just expand the variable
if arg:
error("Argument to variable '%s' not permitted." % cmd)
txt = str(eval("funcs.%s" % cmd ))

Of course, the question comes up ... what if a user (probably me) wants 
to add more functions? Easy enough to just edit funcs.py I suppose, but 
I thought it'd be nice to use more modules.


So, I suppose that rather than adding the 2ndary module stuff to the 
default 'funcs.py' I could just as well have a look and check for the 
needed function in all the modules I've imported.




Sorry, *two* quick silly questions: are the add-on modules under your
control, or do you want to be able to do this with arbitrary modules?
[If under your control, you could insist that such modules had an
__all__ attribute with appropriate contents]


Why would I want to do that ... and how?


A third: why do you want to import into an existing namespace? Now
that you know about __import__, why just not call the functions where
they are?


Yeah, that would probably be cleaner (safer).

Thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to invoke the Python idle

2008-06-29 Thread miya
On Jun 29, 10:01 pm, Only-Trouble <[EMAIL PROTECTED]> wrote:
> Hi all
> I am running openSUSE 10.3
> I am learning python on my own, it seems like  the system has already
> installed a python IDLE
> The question is how to invoke it?
>
> Thanks
>
> Only-Trouble

how about executing from the terminal

idle

--
Nicolás Miyasato (miya)
http://nmiyasato.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to invoke the Python idle

2008-06-29 Thread John Henderson
Only-Trouble wrote:

> Hi all
> I am running openSUSE 10.3
> I am learning python on my own, it seems like  the system has
> already installed a python IDLE
> The question is how to invoke it?

If it's anything like my Red Hat system, I had to find the
command first.  In my case, at:

/usr/lib/python2.2/site-packages/idle/idle

I copied that file to somewhere where it was available on my
$PATH variable.

John
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to invoke the Python idle

2008-06-29 Thread David

Alon Ben-Ari wrote:

Thank you

yes I have
This is what I got:
[EMAIL PROTECTED]:~> idle
bash: idle: command not found
[EMAIL PROTECTED]:~>

Any idea
?

Alon


On Sun, Jun 29, 2008 at 10:05 PM, David <[EMAIL PROTECTED] 
> wrote:


Only-Trouble wrote:

Hi all
I am running openSUSE 10.3
I am learning python on my own, it seems like  the system has
already
installed a python IDLE
The question is how to invoke it?


Thanks

Only-Trouble
--
http://mail.python.org/mailman/listinfo/python-list


 


Did you try to enter idle in a terminal?

-- 
Powered by Gentoo GNU/LINUX

http://www.linuxcrazy.com



Could be you need something like this;
http://rpmfind.net//linux/RPM/opensuse/updates/10.3/i586/python-idle-2.5.1-39.2.i586.html

--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com

--
http://mail.python.org/mailman/listinfo/python-list


Re: How do web templates separate content and logic?

2008-06-29 Thread Tim Roberts
John Salerno <[EMAIL PROTECTED]> wrote:
>
>No, I don't mean presentation logic at all. I mean something along the 
>lines of combining HTML (which is what I refer to as "content") and 
>Python (which is what I meant by "logic"). So for example, if you have 
>code like this (and this isn't necessarily proper code, I'm just making 
>this up, but you'll see what I mean):
>
>
>   Big Important Topic
> This is where I say something important about
>   
>   % for topic in topics:
>   ${topic}
>   
>
>
>Humph, I just made up that example to make the point that when you no 
>longer have pure HTML, but instead have programmatic logic (Python) 
>mixed in with the HTML, then you are mixing content and logic.

Technically, you are probably right, but a model like MVC is supposed to
enable better programming.  It's not intended to be straightjacket and
handcuffs.  If that snippet makes sense to you, then there's nothing wrong
with it.

What's the alternative?  The alternative is to have your Python code do
something like this:

topicList = []
for topic in topics:
topicList.append( topic )
topicList = ''.join( topicList )
and have your HTML page be:

  ${topicList}


but now I've put chocolate into my peanut butter by embedding  tags in
my Python code.

>So maybe my question was a little premature. Or could it just be that 
>this is a *good* way to mix HTML and Python, and there are other ways 
>which may be bad? (For example, connecting to a database, like 
>Sebastian's example. That definitely seems out of place in an HTML file.)

If it seems out of place to you, then you shouldn't do it.  In general, you
need to find a model that makes sense to you, and that allows you to write
readable, workable, maintainable code.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Employment] New TurboGears Job in Eugene, OR

2008-06-29 Thread Tim Roberts
[EMAIL PROTECTED] (Aahz) wrote:
>Paul McNett  <[EMAIL PROTECTED]> wrote:
>>
>>They want an expert for a maximum of $25 per hour? If they find someone, 
>>it'll be a pretty good bullshitter looking for experience.
>
>Note that it's an "academic year" position -- lots and lots of vacation
>time.  This would actually be a good job for e.g. a retired person who
>doesn't need lots of money.  Also note that Eugene is not exactly an
>area with a high cost of living.

I take it you're not from Oregon.  Eugene is the second largest city.
Prices are not quite up to the San Jose at its peak, but there are no
bargains left in any of the urban sections of the state.  It's certainly
far more expensive here than in the midwest or most of the south.

On the other hand, it's a university town, and one of the most
environmentally- and fitness-conscious cities in the country.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list


Re: frame grabber hardware

2008-06-29 Thread Tim Roberts
[EMAIL PROTECTED] wrote:
>
>can anybody recommend a simple USB or PCI framegrabber with video
>input that runs under xp and has a python driver available? I just
>want to get the image into a file, no special requirements.

There are a vast range of inexpensive web cams that will do this job.
Logitech makes a bunch.  Most of the cheap imported still cameras can also
do it.  The Disney still cams at Target (made by Digital Blue) would work.

Are you looking for something more industrial?
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list


Re: pixel colour on screen

2008-06-29 Thread Tim Roberts
[EMAIL PROTECTED] wrote:
>
>Could anyone help me, I'm a python noob and need some help. im trying
>to find some code that will, given a screen co-ordinate, will give me
>the colour of that pixel in RGB. i have found a lot about getting the
>pixel colour from a picture file with a given co-ordinate, but is it
>possible to do it from the whole screen output regardless what
>application the selected pixel is in?

Which operating system?  If you are on Windows, and you have pywin32
loaded. you can use the Windows APIs GetDC and GetPixel.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list


Re: help debugging noob code - converting binary data to images...

2008-06-29 Thread larry
success, had to fill in a few blanks with some more googling, here is
the finished script  (used all for loops this time, saved a few more
lines):

==

#!/usr/local/bin/python

import string
import Image, ImageDraw

size = 2

im = Image.new("1",[8*size,8*size],1)
draw = ImageDraw.Draw(im)

cset  = open("chargen","r")


for cchar in range(0, 512, 1):
for charline in range(0, 8, 1):
x = cset.read(1)
ch = ord(x)
for position in range(0, 8, 1):
if ch & ( 2 ** position ):
xp = (7-position)*size
yp = charline*size
draw.rectangle(((xp,yp),(xp+size-1,yp+size-1)),
fill=0 )
outfile = "/home/mydir/work/char"+string.zfill(cchar,3)+".png"
im.save(outfile,"png")
draw.rectangle(((0,0),(size*8,size*8)),fill=1)

im.show()

==

It does the variable sizes like I wanted and it now sure is fast.

If I wanted to display an image without saving how do I do that, on
the image module it does not pop up a canvas..  the im.show() on the
bottom does not seem to work.

Thanks again!
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do web templates separate content and logic?

2008-06-29 Thread Guillaume Bog
On Mon, Jun 30, 2008 at 11:27 AM, Tim Roberts <[EMAIL PROTECTED]> wrote:

> John Salerno <[EMAIL PROTECTED]> wrote:
> >
>
>
> If it seems out of place to you, then you shouldn't do it.  In general, you
> need to find a model that makes sense to you, and that allows you to write
> readable, workable, maintainable code.


Yes, and MVC is not the last word for it. I have seen enormous snake nests
of PHP code done in MVC, most of the problem coming from a strict
(mis)application of MVC model. On the opposite, I sometime write HTML code
straight inside the SQL's SELECT, which is pure heresy, and still get clean
code that works. For me MVC is like strict encapsulation, it is probably
useful when one guy touch the database, the other the HTML/CSS, and a third
glue things with a script, all of them knowing nearly nothing about the
rest. We don't work like this, so I don't know...



>
> --
> Tim Roberts, [EMAIL PROTECTED]
> Providenza & Boekelheide, Inc.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
http://mail.python.org/mailman/listinfo/python-list

List Performance

2008-06-29 Thread Ampedesign
If I happen to have a list that contains over 50,000 items, will the
size of the list severely impact the performance of appending to the
list?
--
http://mail.python.org/mailman/listinfo/python-list


Epi Leather Handbags - Louis Vuitton handbags

2008-06-29 Thread yxs008
Epi Leather Handbags - Louis Vuitton handbags

Luxury Gift : http://www.luxury-gift.org
Louis Vuitton handbags : 
http://www.luxury-gift.org/Handbags/Louis-Vuitton-handbags.html
Epi Leather Handbags : http://www.luxury-gift.org/Handbags/Epi_Leather_1.html

Epi Leather Handbags series contain the following items, each item is
the perfect marriage of function and design. Epi Leather Handbags are
finely copied, you don't need to worry about the quality. We believe
that no matter what you're looking for in a watch, our Epi Leather
Handbags will exceed your expectations.

Explore the World of Brand Watches & Handbags It is a well-known fact
that a watch you wear not just serves as a faithful time keeping
device,but is also associated with your social status.style and
evenframe of mind.If you intend tomake a wise choice as for purchasing
awatch just right for you,devote your attention to awide range of high
quality brand watches .

Epi Leather Handbags All Products :
Epi Leather Alma Myrtille M5214G,
Epi Alma New Red M5214E,
Epi Leather Jasmin Mandarin M5208H,
Epi Leather Jasmin New Red M5208E,
Epi Leather Segur Pouch Noir M58882,
Epi Leather Petit Noe Mandarin M5901H,
Epi LeatheS peedy 25 Myrtille M5903G,
Epi Leather Alma Mandarin M5214H,
Epi Leather Mandara PM Red M5893E,
Epi Leather Alma Black M52142,
Epi Leather Saint Jacques Poignees Longues Black,
Epi Leather Soufflot New Red M5222E,
Epi Leather Soufflot Mandarin M5222H,
Epi Leather SaintJacques Poignees Longues New Red,
Epi Leather Segur GM Rouge M5886E,
Epi Leather Segur Pouch Myrtille M5888G,
Epi Leather Mandara MM Red M5889E,
Epi Leather Mandara MM Mandarin M5889H,
Epi Leather Mandara PM Myrtille M5893G,
Epi Leather Mandara PM Mandarin M5893H,
Epi Leather Saint Jacques Poignees Longues Black,
Epi Leather Figari PM M52002,
Epi Leather Mandara MM Myrtille M5889G,
Epi Leather Mandara PM Black M58932,
Epi Leather Bowling Montaigne PM White M5932J,
Epi Leather Lussac M52282,
Epi Leather Mandara MM Black M58892,
Epi Leather Montaigne Bag Black M593272,
Epi Leather Bowling Montaigne PM Black M59322,
Epi Leather Petit Noe Black M59012,
Epi Leather Passy Black Epi Leather Passy Black,
Epi Leather Lockit Red M85388,
Epi Leather Bowling Montaigne GM Black M59312,
Epi Leather Speedy 25 Black M59032,
Epi Leather Mabillon M52232,
Epi Leather Petit Noe Red M5901E,
Epi Leather Passy Red M5926E,
Bowling Montaigne GM White M5931J,
Epi Leather Bowling Montaigne PM Red M5932E,
Epi Leather Speedy 25 Mandarin M5903H,
Epi Leather Riviera M48182,
Epi Leather Jasmin Black M52082,
Epi Leather Bucket PM Black M58992,
Epi Leather Montaigne Bag Red M59327,

Epi Leather Handbags WebSite Link :
  http://www.luxury-gift.org/Handbags/Epi_Leather_1.html
--
http://mail.python.org/mailman/listinfo/python-list


Chanel shoes - Best High Quality Chanel shoes www.luxury-gift.org

2008-06-29 Thread yxs008
Chanel shoes - Best High Quality Chanel shoes www.luxury-gift.org

Luxury Gift : http://www.luxury-gift.org
Chanel shoes : http://www.luxury-gift.org/Shoes/Chanel-shoes.html

Chanel shoes series contain the following items, each item is the
perfect marriage of function and design. Chanel shoes are finely
copied, you don't need to worry about the quality. We believe that no
matter what you're looking for in a watch, our Chanel shoes will
exceed your expectations.

Explore the World of Brand Watches & Handbags It is a well-known fact
that a watch you wear not just serves as a faithful time keeping
device,but is also associated with your social status.style and
evenframe of mind.If you intend tomake a wise choice as for purchasing
awatch just right for you,devote your attention to awide range of high
quality brand watches .

The Best Chanel shoes Series :
Chanel shoes All Products :
Chanel shoes RCS001,
Chanel shoes RCS002,
Chanel shoes RCS003,
Chanel shoes RCS004,
Chanel Boots CS001,
Chanel Boots CS002,
Chanel Boots CS003,
Chanel Boots CS004,
Chanel Shoes CS005,
Chanel Shoes CS006,
Chanel Shoes CS007,
Chanel Shoes CS008,
Chanel Shoes CS009,
chanel shoes RCS0711001,
chanel shoes RCS0711002,
chanel shoes RCS0711003,
chanel shoes RCS0711004,
chanel shoes RCS0711005,
chanel shoes RCS0711006,
chanel shoes RCS0711007,
chanel shoes RCS0711008,
chanel shoes RCS0711009,
chanel shoes RCS0711010,
chanel shoes RCS0711011,
chanel shoes RCS0711012,
chanel shoes RCS0711013,
chanel shoes RCS0711014,
chanel shoes RCS0711015,
chanel shoes RCS0711016,
chanel shoes RCS0711017,
chanel shoes RCS0711018,
chanel shoes RCS0711019,
Chanel Shoes CAS0802001,
Chanel Shoes CAS0802002,
Chanel Shoes CAS0802003,
Chanel Shoes CAS0802004,
Chanel Shoes CAS0802005,
Chanel Shoes CAS0802006,
Chanel Shoes CAS0802007,
Chanel Shoes CAS0802008,
Chanel Shoes CAS0802009,
Chanel Shoes CAS0802010,
Chanel Shoes CAS0802011,
Chanel Shoes CAS0802012,
Chanel Shoes CAS0802013,
Chanel Shoes CAS0802014,
chanel shoes CAS0803001,
chanel shoes CAS0803002,
chanel shoes CAS0803003,
chanel shoes CAS0803004,
chanel shoes CAS0803005,
chanel shoes CAS0803006,
chanel shoes CAS0803007,
chanel shoes CAS0803008,
chanel shoes CAS0803009,
chanel shoes CAS0803010,
chanel shoes CAS0803011,
chanel shoes CAS0803012,
chanel shoes CAS0803013,
chanel shoes CAS0803014,
chanel shoes CAS0803015,
Chanel shoes : http://www.luxury-gift.org/Shoes/Chanel-shoes.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: The Importance of Terminology's Quality

2008-06-29 Thread Robert Maas, http://tinyurl.com/uh3t
Why this response is so belated:
  
= 
> Date: Thu, 05 Jun 2008 11:37:48 +0100
> From: Jon Harrop <[EMAIL PROTECTED]>
> We all know that Java, Perl, Python and Lisp suck.

Well at least you're three-quarters correct there.
But Lisp doesn't suck. That's where you're one quarter wrong.

> They don't even have pattern matching over algebraic sum types if
> you can imagine that.

I'm still waiting for you to precisely define what you mean by
"pattern matching" in this context. All I've heard from you so-far
are crickets. If you've set up a Web page with your personal
definition of "pattern matching" as you've been using that term
here, and you've posted its URL in a newsgroup article I didn't
happen to see, please post just the URL again here so that I might
finally see it. Or e-mail me the URL.

-
Nobody in their right mind likes spammers, nor their automated assistants.
To open an account here, you must demonstrate you're not one of them.
Please spend a few seconds to try to read the text-picture in this box:

/\
| ,-.-.   |  |
| | | |,   .,---.,---.,---.,---.,---.,---.,---|,---. |
| | | ||   |`---.|   ||   ||   ||---'|---'|   |`---. |
| ` ' '`---|`---'`---'`   '`   '`---'`---'`---'`---' |
|  `---' |
| | | o  | | |
| |---.,---.|,---..,---.,---.|,---.,---.   |---.,---.,---.   |
| |   ||---'||   |||   |,---|||   ||---'---|   ||,---|   |
| `   '`---'`---'|---'``   '`---^`---'`---|`---'   `---'``---^ | |
||`---'   '  |
|   |   | |  |
| ,---.,---.|--- . . .,---.,---.,---|,---.,---.   |---.,---.,---.|
| |   ||   ||| | ||   ||   ||   ||---'|---|   ||,---||
| `   '`---'`---'`-'-'`---'`   '`---'`---'`   `---'``---^o   |
\(Rendered by means of )/
 (You don't need JavaScript or images to see that ASCII-text image!!
  You just need to view this in a fixed-pitch font such as Monaco.)

Then enter your best guess of the text (40-50 chars) into this TextField:
  +--+
  |  |
  +--+
--
http://mail.python.org/mailman/listinfo/python-list


best option for python lex/yacc?

2008-06-29 Thread mh
I'm porting a C lex/yacc based project, and would like to redo
it in python.

What's the best option for a python lex/yacc-like?  I've
googled a few things, but wanted to see the current concensus.

Many TIA!
Mark

-- 
Mark Harrison
Pixar Animation Studios
--
http://mail.python.org/mailman/listinfo/python-list