Re: average of PIL images

2008-02-18 Thread 7stud
On Feb 18, 10:18 am, vaneric <[EMAIL PROTECTED]> wrote: > hi > i have a set of RGB images of diff faces (of people )as a 2 dim > numpyarray > ..something like > threefaces=array([[xa1,xa2,xa3], >        [xb1,xb2,xb3], >        [xc1,xc2,xc3]]) > where xa1,xa2,xa3 are  tuples each representing rgb va

Re: average of PIL images

2008-02-18 Thread 7stud
On Feb 18, 1:58 pm, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 18, 10:18 am, vaneric <[EMAIL PROTECTED]> wrote: > > > > > hi > > i have a set of RGB images of diff faces (of people )as a 2 dim > > numpyarray > > ..something like > > th

Re: average of PIL images

2008-02-18 Thread 7stud
On Feb 18, 2:05 pm, 7stud <[EMAIL PROTECTED]> wrote: > num = arr[1:, 2:] > > That says to get all elements from row 1 to the bottom that are in > from column 2 to the end of the row. err.. That says to get all elements from row 1 to the last row which are in column 2, column

Re: Understanding While Loop Execution

2008-02-18 Thread 7stud
On Feb 18, 4:53 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > Brad wrote: > > Hi folks, > > > I'm still fairly new to programming in python and programming in > > general. a = [1, 2, 3] b = a print a print b print a[0] = 100 print a print b --output:-- [1, 2, 3] [1, 2, 3] [100, 2, 3] [100, 2, 3]

Re: ROUNDING???

2008-02-18 Thread 7stud
On Feb 18, 7:57 pm, katie smith <[EMAIL PROTECTED]> wrote: > in python im doing the problem 255/494 > > it keeps giving me 0 instead of .51 > what am i doing wrong? > > please help me I have been looking for hours > >       >

Re: usage of .encode('utf-8','xmlcharrefreplace')?

2008-02-18 Thread 7stud
On Feb 18, 10:52 pm, "Carsten Haese" <[EMAIL PROTECTED]> wrote: > On Mon, 18 Feb 2008 21:36:17 -0800 (PST), J Peyret wrote > > > > > Well, as usual I am confused by unicode encoding errors. > > > I have a string with problematic characters in it which I'd like to > > put into a postgresql table. >

Re: usage of .encode('utf-8','xmlcharrefreplace')?

2008-02-18 Thread 7stud
To clarify a couple of points: On Feb 18, 11:38 pm, 7stud <[EMAIL PROTECTED]> wrote: > A unicode string looks like this: > > s = u'\u0041' > > but your string looks like this: > > s = 'he Company\xef\xbf\xbds ticker' > > Note that there is

Re: usage of .encode('utf-8','xmlcharrefreplace')?

2008-02-19 Thread 7stud
On Feb 19, 12:15 am, J Peyret <[EMAIL PROTECTED]> wrote: > On Feb 18, 10:54 pm, 7stud <[EMAIL PROTECTED]> wrote: > > > One last point: you can't display a unicode string.  The very act of > > trying to print a unicode string causes it to be converted to a > &g

Re: average of PIL images

2008-02-19 Thread 7stud
On Feb 19, 12:13 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 19 Feb 2008 04:01:04 -0200, vaneric <[EMAIL PROTECTED]>   > escribió: > > > On Feb 19, 1:38 am, Robert Kern <[EMAIL PROTECTED]> wrote: > >> Averaging color > >> images is tricky; you really shouldn't do it in the RGB colo

Re: Querying a complex website

2008-02-19 Thread 7stud
schweet1 wrote: > Greetings, > > I am attempting to use python to submit a query to the following URL: > > https://ramps.uspto.gov/eram/patentMaintFees.do > > The page looks simple enough - it requires submitting a number into 2 > form boxes and then selecting from the pull down. > > However, my te

Re: Querying a complex website

2008-02-20 Thread 7stud
schweet1 wrote: > On Feb 19, 4:04�pm, 7stud <[EMAIL PROTECTED]> wrote: > > schweet1 wrote: > > > Greetings, > > > > > I am attempting to use python to submit a query to the following URL: > > > > >https://ramps.uspto.gov/eram/patentMa

Re: Querying a complex website

2008-02-20 Thread 7stud
7stud wrote: > schweet1 wrote: > > On Feb 19, 4:04�pm, 7stud <[EMAIL PROTECTED]> wrote: > > > schweet1 wrote: > > > > Greetings, > > > > > > > I am attempting to use python to submit a query to the following URL: > > > > > &

Re: newbie in python

2008-02-21 Thread 7stud
[EMAIL PROTECTED] wrote: > Hi anyone > > I'm very interesed to learn python and really willing to do so,but > unfortunately dont know where to start, or what programs need to > install to start. > > Can someone help me to get in the right track, and get a good move? > > Thanks for all help > If yo

Re: can't set attributes of built-in/extension type

2008-02-21 Thread 7stud
On Feb 21, 11:19 am, Neal Becker <[EMAIL PROTECTED]> wrote: > I'm working on a simple extension.  Following the classic 'noddy' example. > > In [15]: cmplx_int32 > Out[15]: > > Now I want to add an attribute to this type.  More precisely, I want a class > attribute. > > cmplx_int32.test = 0 >

Re: understaning "self"

2008-02-21 Thread 7stud
On Feb 21, 6:34 am, "Poppy" <[EMAIL PROTECTED]> wrote: > I've been searching online to try get a better understanding of what "self" > does when I define this parameter in my class functions. All I'm finding is > debates on whether  "self" has any value to the language but that doesn't > help me in

Re: understaning "self"

2008-02-21 Thread 7stud
On Feb 21, 11:49 am, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 21, 6:34 am, "Poppy" <[EMAIL PROTECTED]> wrote: > > > > > I've been searching online to try get a better understanding of what "self" > > does when I define this param

Re: Return value of an assignment statement?

2008-02-21 Thread 7stud
On Feb 21, 2:43 pm, mrstephengross <[EMAIL PROTECTED]> wrote: > Hi all. In C, an assignment statement returns the value assigned. For > instance: > >   int x >   int y = (x = 3) > > In the above example, (x=3) returns 3, which is assigned to y. > > In python, as far as I can tell, assignment statem

Re: n00b with urllib2: How to make it handle cookie automatically?

2008-02-22 Thread 7stud
On Feb 21, 11:50 pm, est <[EMAIL PROTECTED]> wrote: > Hi all, > > I need urllib2 do perform series of HTTP requests with cookie from > PREVIOUS request(like our browsers usually do ). Many people suggest I > use some library(e.g. pycURL) instead but I guess it's good practise > for a python beginne

Re: n00b with urllib2: How to make it handle cookie automatically?

2008-02-22 Thread 7stud
On Feb 21, 11:50 pm, est <[EMAIL PROTECTED]> wrote: > Hi all, > > I need urllib2 do perform series of HTTP requests with cookie from > PREVIOUS request(like our browsers usually do ). > Cookies from a previous request made in the currently running program? Or cookies from requests that were made

Re: n00b with urllib2: How to make it handle cookie automatically?

2008-02-22 Thread 7stud
On Feb 21, 11:50 pm, est <[EMAIL PROTECTED]> wrote: > > class SmartRequest(): > You should always define a class like this: class SmartRequest(object): unless you know of a specific reason not to. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for suggestions on improving numpy code

2008-02-23 Thread 7stud
On Feb 22, 11:37 pm, David Lees <[EMAIL PROTECTED]> wrote: > I want to read > and process a single column. Then why won't a list suffice? -- http://mail.python.org/mailman/listinfo/python-list

Re: Seeing "locals()" from imported function

2008-02-23 Thread 7stud
On Feb 23, 10:06 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > I apologize for this very basic question, but I can't understand how > this works... > I want to import a function from module B into my main script A, so > this function can see and use the locals from A. > > For example: > > de

Re: Seeing "locals()" from imported function

2008-02-23 Thread 7stud
On Feb 23, 11:41 pm, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 23, 10:06 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > > > > > I apologize for this very basic question, but I can't understand how > > this works... > > I want to

Re: n00b with urllib2: How to make it handle cookie automatically?

2008-02-24 Thread 7stud
On Feb 24, 4:41 am, est <[EMAIL PROTECTED]> wrote: > On Feb 23, 2:42 am, Rob Wolfe <[EMAIL PROTECTED]> wrote: > > > > > est <[EMAIL PROTECTED]> writes: > > > Hi all, > > > > I need urllib2 do perform series of HTTP requests with cookie from > > > PREVIOUS request(like our browsers usually do ). Man

Re: Create multiple directories

2008-02-24 Thread 7stud
On Feb 24, 6:27 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > Paul Lemelle wrote: > > I am somewhat new to Python and I am trying to create a program that > > automatically creates directories from a range of numbers. I > > researched the os.mkdir & os.makedirs methods, but they do not seem to > > (

network programming: how does s.accept() work?

2008-02-25 Thread 7stud
I have the following two identical clients #test1.py:--- import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = 'localhost' port = 5052 #server port s.connect((host, port)) print s.getsockname() response = [] while 1: piece = s.recv(1024) if piece == '':

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 2:43 am, [EMAIL PROTECTED] wrote: > On 25 Feb, 09:51, 7stud <[EMAIL PROTECTED]> wrote: > > > > > I have the following two identical clients > > > #test1.py:--- > > import socket > > > s = socket.socket(socket.AF_INET, socket.SOCK_

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 2:43 am, [EMAIL PROTECTED] wrote: > > by reusing the same variables without storing the previous values. > This could make the Python > garbage collector to attempt freeing the socket object created with > the first connection, therefore > closing the connection. > > If I'm right, your p

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 4:08 am, 7stud <[EMAIL PROTECTED]> wrote: > > The question I'm really trying to answer is: if a client connects to a > host at a specific port, but the server changes the port when it > creates a new socket with accept(), how does data sent by the client >

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 5:17 am, 7stud <[EMAIL PROTECTED]> wrote: > On Feb 25, 4:08 am, 7stud <[EMAIL PROTECTED]> wrote: > > > > > The question I'm really trying to answer is: if a client connects to a > > host at a specific port, but the server changes the port whe

Re: Is there any method to urlretrieve to a file the html source from a url with "Transfer-encoding": chunked

2008-02-25 Thread 7stud
On Feb 25, 8:25 am, Aldo Ceccarelli <[EMAIL PROTECTED]> wrote: > Thank you All for your suggestions: > > I could finally assess that > > besides partial read from chunked url - by-passed thanks to a socket > approach: > > f.i. this was good for > me:http://python.about.com/od/networkingwithpython/

Re: network programming: how does s.accept() work?

2008-02-25 Thread 7stud
On Feb 25, 10:56 am, Thomas Bellman <[EMAIL PROTECTED]> wrote: > 7stud <[EMAIL PROTECTED]> wrote: > > The question I'm really trying to answer is: if a client connects to a > > host at a specific port, but the server changes the port when it > > creates a n

Re: how to measure memory usage on Mac OSX ?

2008-02-26 Thread 7stud
On Feb 26, 3:43 am, "masayuki.takagi" <[EMAIL PROTECTED]> wrote: > hi all, > > i want to measure memory usage of my python process on Mac OSX. > > i tired resource module, but it doesn't work on OSX. > > how can i get it ? > > thnx. > > -- masayuki takagi #mac osx 10.4.7 import resource print res

Re: network programming: how does s.accept() work?

2008-02-26 Thread 7stud
On Feb 25, 10:00 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > >  7stud <[EMAIL PROTECTED]> wrote: > > But your claim that the server doesn't change its port flies in the > > face of every description I've read a

Re: network programming: how does s.accept() work?

2008-02-26 Thread 7stud
On Feb 25, 10:08 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > There can be many TCP connections to a server all using the same > endpoint. Take a look at the traffic coming out of any busy web server: > everything that comes out of the same server comes from port 80. That > doesn't stop it listeni

Re: BaseHTTPServer and do_POST method

2008-02-27 Thread 7stud
On Feb 27, 5:33 am, rocksportrocker <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to implement a local server for storing and retrieving > numerical data. > So I use BaseHTTPServer as follows: > > - >     from BaseHTTPServer import * > >  

Re: threading/Queue: join() and task_done() not working? (deadlock)

2008-02-27 Thread 7stud
Gal Aviel wrote: > Hello All, > > I'm seeing strange behavior where one thread waits on a queue using join() and > the later (or so I think, according to order of the printing in STDOUT) > another > thread calls task_done() on the very same queue, What is task_done()? The python docs don't list

Re: call by reference howto????

2008-02-27 Thread 7stud
On Feb 27, 5:02 pm, Tamer Higazi <[EMAIL PROTECTED]> wrote: > Hi! > Can somebody of you make me a sample how to define a function based on > "call by reference" ??? > > I am a python newbie and I am not getting smart how to define functions, > that should modify the variable I passed by reference.

Re: threading/Queue: join() and task_done() not working? (deadlock)

2008-02-28 Thread 7stud
On Feb 28, 1:47 am, Gal Aviel <[EMAIL PROTECTED]> wrote: > 7stud yahoo.com> writes: > > > What is task_done()?  The python docs don't list any such function. > > I'm using Python 2.5 and it's in the docs ... According to the docs, join() unblocks only

Re: more pythonic

2008-02-28 Thread 7stud
On Feb 28, 4:40 am, Temoto <[EMAIL PROTECTED]> wrote: > Hello. > > There is a Django application, i need to place all its data into > Access mdb file and send it to user. > It seems to me that params filling for statement could be expressed in > a more beautiful way. > Since i'm very new to Python,

Re: more pythonic

2008-02-28 Thread 7stud
On Feb 28, 4:48 am, 7stud <[EMAIL PROTECTED]> wrote: > > It's my understanding that the way you insert arguments into queries > has to be done in a db specific way.   > Rather: It's my understanding that the way you insert arguments into queries *should* be done in a

Re: tcp

2008-03-02 Thread 7stud
On Mar 2, 6:09 am, Gif <[EMAIL PROTECTED]> wrote: > i have this small script which after some router configurations works. > > ## > > #! /usr/bin/python > import socket > > HOST = '' > PORT = 1515 > s = socket.socket(socket.AF_INET, socket.SOC

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-10 Thread 7stud
On Mar 10, 9:44 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Why does my compiler say invalid syntax and then highlight the > quotation marks in the following code: > > # This program is to find primes. > primes = [] > import math > import gmpy > while 1: >     run = int(raw_input("Do you want to

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-10 Thread 7stud
On Mar 10, 9:44 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Why does my compiler say invalid syntax and then highlight the > quotation marks in the following code: > > # This program is to find primes. > primes = [] > import math > import gmpy > while 1: >     run = int(raw_input("Do you want to

Re: ord function problem from newbie

2008-03-17 Thread 7stud
[EMAIL PROTECTED] wrote: > I convert all to lowercase, > > import string > > small = string.lower(name) > print "Here is the calculated value:" > > print small > for ch in small: > v = ord(ch)-96 > print v > I don't know if you are using an

Re: Need Help Starting Out

2008-03-18 Thread 7stud
On Mar 18, 10:10 am, jmDesktop <[EMAIL PROTECTED]> wrote: > Hi, I would like to start using Python, but am unsure where to begin. > I know how to look up a tutorial and learn the language, but not what > all technologies to use.   I think you are getting ahead of yourself. Get the book Learning P

Re: is hash map data structure available in Python?

2008-03-19 Thread 7stud
On Mar 19, 2:40 am, grbgooglefan <[EMAIL PROTECTED]> wrote: > Hi, > I have a situation that I need to search a name in a big list of names > in my Python embedded interpreter. I am planning to use hash map for > quicker search. > How do I create hash map in Python? > Can you please guide me to some

Re: if __name__ == '__main__':

2008-03-20 Thread 7stud
On Mar 20, 10:21 am, "Simon Brunning" <[EMAIL PROTECTED]> wrote: > On Thu, Mar 20, 2008 at 4:12 PM, Bhagwat Kolde <[EMAIL PROTECTED]> wrote: > > Hi, > > I am new to the python and not getting meaning of following line, > > > if __name__ == '__main__': > >       main() > The if statement is used to

Re: Removal of tkinter from python 3.0? [was: Fate of the repr modulein Py3.0]

2008-03-20 Thread 7stud
On Mar 20, 8:42 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Paul Rubin" <"http://phr.cx"@NOSPAM.invalid> wrote in message > > news:[EMAIL PROTECTED] > | "Daniel Fetchinson" <[EMAIL PROTECTED]> writes: > | > Is it just me or others also think that it would be a major loss to > | > remove tkinter

Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread 7stud
On Mar 22, 3:34 pm, bsoist <[EMAIL PROTECTED]> wrote: > On Mar 22, 12:40 pm, jmDesktop <[EMAIL PROTECTED]> wrote: > > > For students 9th - 12th grade, with at least Algebra I.  Do you think > > Python is a good first programming language for someone with zero > > programming experience?  Using Linu

problem with CGIHTTPServer

2008-03-28 Thread 7stud
1) I have this simple cgi server: import CGIHTTPServer import BaseHTTPServer class MyRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = ['/my_cgi_scripts'] server = BaseHTTPServer.HTTPServer( ('', 8111), MyRequestHandler ) server.serve_forever() 2) I

Re: problem with CGIHTTPServer

2008-03-28 Thread 7stud
On Mar 28, 10:12 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 28 Mar 2008 12:38:45 -0300, 7stud <[EMAIL PROTECTED]>   > escribió: > > > After I start the server script, load the html page in my browser, and > > click on the link, I ge

Re: output problem

2009-01-18 Thread 7stud
On Jan 16, 8:24 am, "Jean-Paul VALENTIN" wrote: > Feature? the output of below Hello program he0.py started from command > line looks as follows: > F:\prompt>he0.py > Hello > F:\prompt> > > 'Hello' was sent with sys.stdout.write, so "without newline". > But why cannot be output (more logically): >

Re: Start Python at client side from web app

2009-01-21 Thread 7stud
On Jan 21, 1:10 am, Thomas Guettler wrote: > Hi, > > I want to start Python at the client side from a web application. The > app is an intranet application, and all client PCs are under our control (we > can install software on them). > > But I don't want to update the installation too often. Here

Re: New to python, open source Mac OS X IDE?

2009-01-28 Thread 7stud
On Jan 27, 6:07 pm, Burukena wrote: > On 1/27/09 8:44 PM, James Stroud wrote: > > > joseph.a.mar...@gmail.com wrote: > >> Greetings! I've heard enough raving about Python, I'm going to see for > >> myself what all the praise is for! > > >> I'm on a Mac. I use Netbeans for Java, PHP, and C if neede

Re: exception in urllib2

2009-02-01 Thread 7stud
On Feb 1, 3:34 am, asit wrote: > I hv been developing a link scanner. Here the objective is to > recursively scan a particular web site. > > During this, my script methttp://images.google.co.in/imghp?hl=en&tab=wi > and passed it to the scan function, whose body is like this.. > > def scan(site): >

Re: exception in urllib2

2009-02-01 Thread 7stud
On Feb 1, 3:34 am, asit wrote: > I hv been developing a link scanner. Here the objective is to > recursively scan a particular web site. > > During this, my script methttp://images.google.co.in/imghp?hl=en&tab=wi > and passed it to the scan function, whose body is like this.. > > def scan(site): >

Re: Upgrade Python on a Mac

2009-03-30 Thread 7stud
On Mar 3, 4:01 am, Graham Dumpleton wrote: > On Mar 3, 8:53 am, Rey Bango wrote: > > > Hi, > > > I'd like to upgrade the installed version of Python that came standard > > on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot > > in it, I just wanted to get a better understanding o

Re: File Creation Not Working In A Thread Class?

2008-05-11 Thread 7stud
On May 11, 5:50 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > bc90021 wrote: > > You are a perfect example of exactly what I was talking about, and why > > the Python community is such a poor one. > > I though you were treated quite fairly all things considered.   (You > started the personal attacks

Re: downloading a link with javascript in it..

2008-05-12 Thread 7stud
On May 12, 1:54 pm, Jetus <[EMAIL PROTECTED]> wrote: > I am able to download this page (enclosed code), but I then want to > download a pdf file that I can view in a regular browser by clicking > on the "view" link. I don't know how to automate this next part of my > script. It seems like it uses J

Re: downloading a link with javascript in it..

2008-05-12 Thread 7stud
On May 12, 4:59 pm, 7stud <[EMAIL PROTECTED]> wrote: > On May 12, 1:54 pm, Jetus <[EMAIL PROTECTED]> wrote: > > > I am able to download this page (enclosed code), but I then want to > > download a pdf file that I can view in a regular browser by clicking > > on

Re: write to specific line in file?

2008-05-16 Thread 7stud
globalrev wrote: > i ahve a program that takes certain textsnippets out of one file and > inserts them into another. > > problem is it jsut overwrites the first riow every time. > > i want to insert every new piece of text into the next row. > so: > 1. how do i write to a new line every time i writ

Re: Cookies and CookieJar

2008-05-17 Thread 7stud
On May 16, 9:21 am, Larry Bates <[EMAIL PROTECTED]> wrote: > I'm struggling with a project using mechanize and cookies to screen scape a > website.  The site requires a client created cookie for authentication.  Below > is the code I'm attempting to use with the traceback I'm getting: > >  >>> impo

Re: Cookies and CookieJar

2008-05-17 Thread 7stud
Larry Bates wrote: > I'm struggling with a project using mechanize and cookies to screen scape a > website. The site requires a client created cookie for authentication. Are you sure that is correct? As far as I know, the usual course of events is for a site to set a cookie header in the respons

Re: smtplib "authentication required" error

2008-05-17 Thread 7stud
On May 17, 12:18 pm, cher <[EMAIL PROTECTED]> wrote: > Hey, > > Don't know if you can help, but I'm trying to import archived messages > from Thunderbird into my gmail account and keep getting these types of > errors.  I am using the GML program to help incorporate, but the SMTP > server is not bei

Re: python persistence

2008-03-31 Thread 7stud
On Mar 31, 5:31 pm, [EMAIL PROTECTED] wrote: > Can you have a Python object stored entirely on disk? import cPickle as cp class Dog(object): def __init__(self, name): self.name = name d = Dog("Spot") f = open("data.txt", "w") cp.dump(d, f) f.close() f = open("data.txt") stored_obj

Re: Looking for indent advice howto in emacs python-mode

2008-03-31 Thread 7stud
On Mar 31, 10:32 am, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > Here's what I want to do: > > if ( ( v == 1 ) >    or ( v == 2 ) >    or ( v == 3 ) ): >      pass > python indenting = 4 spaces -- http://mail.python.org/mailman/listinfo/python-list

BeautiflSoup -- getting all the attributes of a tag?

2008-04-01 Thread 7stud
You can treat a tag like a dictionary to obtain a specific attribute: import BeautifulSoup as bs html = "hello" doc = bs.BeautifulSoup(html) div = doc.find("div") print div print div["x"] --output:-- a But you can't iterate over a tag to get all the attributes: import BeautifulSoup as bs htm

Re: BeautiflSoup -- getting all the attributes of a tag?

2008-04-01 Thread 7stud
On Apr 1, 5:25 pm, 7stud <[EMAIL PROTECTED]> wrote: > You can treat a tag like a dictionary to obtain a specific attribute: > > import BeautifulSoup as bs > > html = "hello" > > doc = bs.BeautifulSoup(html) > div = doc.find("div") > print div &

Re: XML Parsing

2008-04-01 Thread 7stud
On Apr 1, 1:42 pm, Alok Kothari <[EMAIL PROTECTED]> wrote: > Hello, >           I am new to XML parsing.Could you kindly tell me whats the > problem with the following code: > > import xml.dom.minidom > import xml.parsers.expat > document = """Lettermanis token>betterthan token>JayLeno""" > > # 3 h

Re: class / module introspection?

2008-04-02 Thread 7stud
On Apr 2, 1:27 pm, Brian Munroe <[EMAIL PROTECTED]> wrote: > On Apr 2, 12:07 pm, Brian Munroe <[EMAIL PROTECTED]> wrote: > > > > > This gives me ['system1','system2'] - which I can then use __import__ > > on. > > Addendum, thanks Bruno! > > I also required the helper function (my_import) from the P

Re: Parsing HTML?

2008-04-03 Thread 7stud
On Apr 3, 12:39 am, [EMAIL PROTECTED] wrote: > BeautifulSoup does what I need it to.  Though, I was hoping to find > something that would let me work with the DOM the way JavaScript can > work with web browsers' implementations of the DOM.  Specifically, I'd > like to be able to access the innerHTM

Re: Is there any way to say ignore case with "in"?

2008-04-04 Thread 7stud
On Apr 4, 2:43 pm, [EMAIL PROTECTED] wrote: > Is there any way in python to say > >     if string1 in string2: >         > > ignoring the case of string1 and string2? > > I know I could use:- > >     if lower(string1) in lower(string2): >         > > but it somehow feels there ought to be an easi

Re: TKinter, buttonwidget response problem(1) and all btns the same size(2)!

2008-04-04 Thread 7stud
On Apr 4, 7:06 pm, [EMAIL PROTECTED] wrote: > 1st question: > > when i run this program 1 will be printed into the interpreter when i > run it BUT without me clicking the actual button. > when i then click the button "1", nothing happens. > > obv i dont want any output when i dont push the button b

Re: TKinter, buttonwidget response problem(1) and all btns the same size(2)!

2008-04-05 Thread 7stud
[EMAIL PROTECTED] wrote: > > one thing i dont rally get, i ahve to add my_button.bind() somewhere? > i changed the stuff u said though and i get this error(the program > executes though and i can press the buttons): > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:

Re: TKinter, buttonwidget response problem(1) and all btns the same size(2)!

2008-04-05 Thread 7stud
On Apr 5, 12:02 am, [EMAIL PROTECTED] wrote: > am i not doing that then? did u look at the code? where do i add the > bind if this: > btnDisplay = Button(self, text="1", command=self.Display) >         btnDisplay.grid(row=3, column=0, padx=5, pady=5) > > is not enough? > > def Display(self, event_o

Re: Tkinter, add pressed buttons onto string display string, how to?

2008-04-05 Thread 7stud
[EMAIL PROTECTED] wrote: > using tkinter and python i now have a small App (that will hopefully > soon be a fully functioning calculator) where u can push buttons and > the corresponding number or operator is shown. > > when u press 1, "1" appears on the screen, pres + and "+" appears etc. > > at

Re: Tkinter, add pressed buttons onto string display string, how to?

2008-04-05 Thread 7stud
On Apr 5, 1:55 pm, 7stud <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > using tkinter and python i now have a small App (that will hopefully > > soon be a fully functioning calculator) where u can push buttons and > > the corresponding number or operator is

Re: Tkinter, add pressed buttons onto string display string, how to?

2008-04-05 Thread 7stud
> > Just like the message says: You are trying to use `str` (on the right hand > > side of the assignment) before anything is bound to that name. > > > Ciao, > >         Marc 'BlackJack' Rintsch > > i know but i want the variable str(which i found out is a reserved > word so i changed it) to be acc

Re: Tkinter, a lot of buttons, make prog shorter?

2008-04-06 Thread 7stud
On Apr 6, 1:59 pm, [EMAIL PROTECTED] wrote: > is there anyway to make this shorter? i hate having these big blocks > of similar-looking code, very unaesthetic. > maybe doesnt matter good-code-wise? > anyway can i make some function that makes this shorter? > like put the etiquettes on the button fr

Re: Tkinter, a lot of buttons, make prog shorter?

2008-04-06 Thread 7stud
On Apr 6, 4:12 pm, 7stud <[EMAIL PROTECTED]> wrote: > You said you were an experienced programmer, but you keep posting code > with the same mistakes over and over again.  Why are you attaching the > buttons to self? Remember this: > Another thing you should be aware of: se

Re: Tkinter, a lot of buttons, make prog shorter?

2008-04-06 Thread 7stud
On Apr 6, 8:50 pm, [EMAIL PROTECTED] wrote: > should i not use self. in Clean() and Calculate() either? > You probably shouldn't be using classes at all. When you are trying to learn the basics of a language, you don't want to complicate things further with classes. Copying a program off the int

Re: Confused about Boost.Python & bjam

2008-04-12 Thread 7stud
On Apr 12, 4:53 am, Till Kranz <[EMAIL PROTECTED] goettingen.de> wrote: > Hi, > > I tried to get started with Boost.Python. unfortunately I never used the > bjam build system before. As it is explained in the documentation I tried > to adapt the the files form the examples directory. I copied 'Jamr

Re: urllib2 Basic authentication, what am I doing wrong?

2008-04-13 Thread 7stud
Michel Bouwmans wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hey everybody, > > I'm having a little problem with urllib2 and Basic HTTP authentication. > > I have the following code: > > auth = urllib2.HTTPPasswordMgrWithDefaultRealm() > auth.add_password(None, 'https://webmail.osg-

Re: Tkinter, image not appearing in function but without function

2008-04-13 Thread 7stud
On Apr 13, 11:12 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sun, 13 Apr 2008 08:57:29 -0700, skanemupp wrote: > > why is the first program not working? when i click the screen the map > > is not appearing. > > > the second program works. > > > from Tkinter import * > > > master =

Re: How to print a unicode string?

2008-04-18 Thread 7stud
On Apr 18, 5:38 pm, [EMAIL PROTECTED] wrote: > I'd like to print out a unicode string. > > I'm running Python inside Emacs, which understands utf-8, so I want to > force Python to send utf-8 to sys.stdout. > > From what I've googled, I think I need to set my locale. I don't > understand how. > > im

Re: How to print a unicode string?

2008-04-18 Thread 7stud
On Apr 18, 6:36 pm, 7stud <[EMAIL PROTECTED]> wrote: > On Apr 18, 5:38 pm, [EMAIL PROTECTED] wrote: > > > > > I'd like to print out a unicode string. > > > I'm running Python inside Emacs, which understands utf-8, so I want to > > force Python

Re: Inheritance confusion

2008-04-19 Thread 7stud
On Apr 19, 12:37 am, Hook <[EMAIL PROTECTED]> wrote: > Hi, > > I'm having a problem with multiple inheritance - it's clearly something > I've missed, but the web pages and books that I've consulted aren't > helping, so I'll throw myself on the mercy and collective wisdom of > Usenet! > > I've got 4

Re: where do I begin with web programming in python?

2008-05-02 Thread 7stud
On May 1, 3:25 pm, jmDesktop <[EMAIL PROTECTED]> wrote: > I have been to the main python site, but am still confused.  I have > been using .net, so it may be obvious how to do this to everyone > else.  I am aware there are various frameworks (Django, Pylons, etc.), > but I would like to know how to

Re: Is using range() in for loops really Pythonic?

2008-05-10 Thread 7stud
On May 10, 8:19 pm, John Salerno <[EMAIL PROTECTED]> wrote: > I know it's popular and very handy, but I'm curious if there are purists > out there who think that using something like: > > for x in range(10): >     #do something 10 times > > is unPythonic. The reason I ask is because the structure o

Re: Problem with custom events in wxpython

2008-05-11 Thread 7stud
On May 11, 7:23 am, Jimmy <[EMAIL PROTECTED]> wrote: > hi, all > > I'm having a problem with creating custom events in wxpython. > > I have a class A handling some data processing work and another class > B of GUI matter. I need GUI to display information when data in A is > updated. > I know cutom

Re: File Creation Not Working In A Thread Class?

2008-05-11 Thread 7stud
On May 11, 12:42 pm, bc90021 <[EMAIL PROTECTED]> wrote: > > It's difficult to know what's wrong with the code you posted because: > > > * it is not self-contained: otherFile, fileName, pattern are names > >   which you do not define; > > > * the IOError you reported earlier can't arise as a result

Re: File Creation Not Working In A Thread Class?

2008-05-11 Thread 7stud
bc90021 wrote: > Hi All, > > Thanks in advance for any and all help! > > I have this code: > > g = open(fileName, 'a') > > where fileName is defined before the line it's used in. It works fine > when I use it outside a thread class. > > When I put the same line in a thread class, it no longer work

Re: File Creation Not Working In A Thread Class?

2008-05-11 Thread 7stud
On May 11, 1:28 pm, bc90021 <[EMAIL PROTECTED]> wrote: > > ...and the exact error message was? > > > Here is a tip: if you want people to help you, then you have to help > > them to help you.  Personally, I wouldn't respond to anymore of your > > questions because you seem incapable of posting the

Re: File Creation Not Working In A Thread Class?

2008-05-11 Thread 7stud
On May 11, 2:01 pm, 7stud <[EMAIL PROTECTED]> wrote: > On May 11, 1:28 pm, bc90021 <[EMAIL PROTECTED]> wrote: > > > > > > ...and the exact error message was? > > > > Here is a tip: if you want people to help you, then you have to help > > >

Re: File Creation Not Working In A Thread Class?

2008-05-11 Thread 7stud
On May 11, 2:11 pm, bc90021 <[EMAIL PROTECTED]> wrote: > [CUT] > > > I have in no way assumed that you are stupid.  I have tried to help you > > formulate your problem better so that people on the list can help you. > > I believe I have done so respectfully, with the aim of introducing you > > to t

installing lxml ?

2009-11-11 Thread 7stud
I'm trying to install lxml, but I can't figure out the installation instructions. Here: http://codespeak.net/lxml/installation.html it says: 1) Get the easy_install tool. Ok, I went to the easy_install website, downloaded, and installed it. The last two lines of the output during installation

Re: installing lxml ?

2009-11-11 Thread 7stud
On Nov 11, 6:31 am, Jussi Piitulainen wrote: > 7stud writes: > > I'm trying to install lxml, but I can't figure out the installation > > instructions.  Here: > ... > > My os is mac os x 10.4.11.   But this: > > > STATIC_DEPS=true easy_install lxml

Re: installing lxml ?

2009-11-11 Thread 7stud
On Nov 11, 7:37 am, "Diez B. Roggisch" wrote: > And third, > there are limits to what extend one can anticipate the ineptness of > others to read. The page you cite from starts with: > >    For special installation instructions regarding MS Windows and > MacOS-X, see below. > > And below you find

Re: installing lxml ?

2009-11-11 Thread 7stud
On Nov 11, 1:37 pm, Terry Reedy wrote: > 7stud wrote: > > On Nov 11, 7:37 am, "Diez B. Roggisch" wrote: > >> And third, > >> there are limits to what extend one can anticipate the ineptness of > > Calling you inept was unnecessary, but > >

<    1   2   3   4   5   6   >