Generators can only yield ints?

2008-08-22 Thread defn noob
def letters(): a = xrange(ord('a'), ord('z')+1) B = xrange(ord('A'), ord('Z')+1) while True: yield chr(a) yield chr(B) >>> l = letters() >>> l.next() Traceback (most recent call last): File "", line 1, in l.next() File "", line 5,

>> and << operators?

2008-08-22 Thread defn noob
What does >> and << do? Googling on them and they are just ignored... -- http://mail.python.org/mailman/listinfo/python-list

How can I check nbr of cores of computer?

2008-07-29 Thread defn noob
How can I check how many cores my computer has? Is it possible to do this in a Python-app? -- http://mail.python.org/mailman/listinfo/python-list

Re: isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread defn noob
On Jul 15, 7:28 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Jul 15, 11:26 am, defn noob <[EMAIL PROTECTED]> wrote: > > > > > isPrime works when just calling a nbr but not when iterating on a > > list, why? adding x=1 makes it work though but why do I have t

isPrime works but UnBoundLocalError when mapping on list

2008-07-15 Thread defn noob
isPrime works when just calling a nbr but not when iterating on a list, why? adding x=1 makes it work though but why do I have to add it? Is there a cleaner way to do it? def isPrime(nbr): for x in range(2, nbr + 1): if nbr % x == 0: break if x == nbr: return T

Re: Not necessarily related to python Web Crawlers

2008-07-05 Thread defn noob
just crawling is supereasy. its how to index and search that is hard. just start at yahoo.com, scrape out all the links and then for every site visit every link. i wrote a crawler in 15 lines of code. but then it all it did was visit the sites, not indexing them or anything. you could write a fast

Re: site-packages, unzipepd there but import fails

2008-07-03 Thread defn noob
On Jul 3, 8:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 3 juil, 18:51, defn noob <[EMAIL PROTECTED]> wrote: > > > well the reason i unzipped and placed it in site-packages was because > > nothign happened when i ran setup.py(unzipped).

Re: manipulating movie files with Python

2008-07-03 Thread defn noob
I would love the same thing. Dont know what you are doing but this might be relevant even if it is not what you are asking for: http://imdbpy.sourceforge.net/ library to take data from imdb. -- http://mail.python.org/mailman/listinfo/python-list

Re: site-packages, unzipepd there but import fails

2008-07-03 Thread defn noob
and yes it is parallel python. and windows vista. and the python GUI shell. -- http://mail.python.org/mailman/listinfo/python-list

Re: site-packages, unzipepd there but import fails

2008-07-03 Thread defn noob
well the reason i unzipped and placed it in site-packages was because nothign happened when i ran setup.py(unzipped). this has worked with other packages before. -- http://mail.python.org/mailman/listinfo/python-list

Re: site-packages, unzipepd there but import fails

2008-07-03 Thread defn noob
On Jul 3, 5:02 pm, Chris <[EMAIL PROTECTED]> wrote: > On Jul 3, 4:11 pm, defn noob <[EMAIL PROTECTED]> wrote: > > > i unzipped and put the folder in site-packages. when i run setup.py > > install nothing happens. > > > when i do import pp from shell it compla

site-packages, unzipepd there but import fails

2008-07-03 Thread defn noob
i unzipped and put the folder in site-packages. when i run setup.py install nothing happens. when i do import pp from shell it complains it doesnt exist. isnt placing the folder in site-packages enough? these setup.py-files often dont work but normally it still works. -- http://mail.python.

PIL(Py Image lib), show() not showing picture...

2008-07-03 Thread defn noob
from PIL import Image import os print os.path.exists('C:/Users/saftarn/Desktop/images/blob.jpg') im2 = Image.open('C:/Users/saftarn/Desktop/images/blob.jpg') im2.show() first the command prompt pops up then the normal window to display pictures but it doenst show a picture. the prin os.path.exis

Re: Run interpreter in emacs?

2008-07-02 Thread defn noob
thanks but i dont quite understand the load-path, add to the load path. the loadpath has a lot of variables. so where i should i place the python-mode folder and should i then add that directory to the loadpath? -- http://mail.python.org/mailman/listinfo/python-list

Re: Most efficient way to get pixelcolors of an image?

2008-07-02 Thread defn noob
this just shows a GUI that normally shows pictures but it doesnt show any picture... from PIL import Image im = Image.open('C:/Users/saftarn/Desktop/images/giffer.gif') im2 = Image.open('C:/Users/saftarn/Desktop/images/blob.jpg') im.rotate(45).show() im2.show() -- http://mail.python.org/mailm

Run interpreter in emacs?

2008-07-02 Thread defn noob
Can I run the python interpreter from with in Emacs? Do i have to change anything then? or is it by default? it already syntax-highlights python-files. -- http://mail.python.org/mailman/listinfo/python-list

Most efficient way to get pixelcolors of an image?

2008-07-02 Thread defn noob
i want to process a large number of images and store their respective pixels in a matrix. what is the mostt efficient way of opening and checking them? i doubt pygame is made for this purpose :) i guess i could also use tkinter? and why cant i print out matrix after getting the pixels? do i hav

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

Re: Pygame, how to show window without loop? no loop=popupand close...

2008-06-28 Thread defn noob
On 28 Juni, 08:32, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 27, 10:58 pm, defn noob <[EMAIL PROTECTED]> wrote: > > > right. im an idiot anyway. i can just draw the lines before entering > > the loop, problem solved... > > Do not do that; it'll cre

Re: Pygame, how to show window without loop? no loop=popupand close...

2008-06-27 Thread defn noob
right. im an idiot anyway. i can just draw the lines before entering the loop, problem solved... -- http://mail.python.org/mailman/listinfo/python-list

Pygame, how to show window without loop? no loop=popupand close...

2008-06-27 Thread defn noob
Im using PyGame to draw images of graphs and trees. Howver right now i am looping using: while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() screen.fill(screencolor) pygame.draw.circle(screen, linecolor, (500, 20), 12, 0) draw((500, 20), 3)

How to "rebind" py2.5.1 to run from comprompt after uninstalling py3.0?

2008-06-26 Thread defn noob
I installed python30 and so command prompt runs all pythonprograms through that which i didnt want so i uninstalled it. now i cant start any pythonprograms through the commandprompt. how do I "rebind" python25 to luanch when claling .py-files from the command prompt? -- http://mail.python.org/mai

Re: recursion in Class-methods?

2008-06-26 Thread defn noob
> > > if start == end: > > return path > > if not self.dictionary.has_key(start): > >if start not in self.dictionnary: > > > return None > > for node in self.dictionary[start]: > > if node not in path: > > newpa

Re: recursion in Class-methods?

2008-06-26 Thread defn noob
class Graph(object): where does anyone write like that? I've seen only examples like i have written. is the object then passed to init? class Graph(object): def __init__(self, dictionary): self.structure = dictionary or class Graph(object): def __init__(self, object):