Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 5:13 PM, wrote: > On Sun, 27 Jun 2010 15:56:23 -0700 > Marc Tompkins wrote: > >> On Sun, Jun 27, 2010 at 3:20 PM, wrote: >> >> I don't have any insight into your other piece of code, but here I think >> you >> just need another set of parentheses - so that the string in

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread petkovas
On Sun, 27 Jun 2010 15:56:23 -0700 Marc Tompkins wrote: On Sun, Jun 27, 2010 at 3:20 PM, wrote: I don't have any insight into your other piece of code, but here I think you just need another set of parentheses - so that the string interpolation is done first, and the result

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Richard D. Moores
On Sun, Jun 27, 2010 at 16:25, Steven D'Aprano wrote: > On Mon, 28 Jun 2010 03:07:47 am Richard D. Moores wrote: >> A "feature" very important to me >> is that with Gmail, my mail is just always THERE, with no need to >> download it > > You see your email without downloading it? You don't understa

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Steven D'Aprano
On Mon, 28 Jun 2010 08:20:01 am petko...@dir.bg wrote: > The full error message is: > > Traceback : > File "insert_into_db_v9.py", line 55, in >WHERE testtable_n = %s""", data1, > str(os.path.splitext(file)[0])) > TypeError: an integer is required Unfortunately this isn't helpful, be

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Steven D'Aprano
On Mon, 28 Jun 2010 03:12:39 am Adam Bark wrote: > I think the 'as' syntax is only available in Python 3.x You think wrong. It is available from Python 2.6 onwards. > Question marks go at the end of the sentence where you would normally > put a full stop if it wasn't a question. That's a terri

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Steven D'Aprano
On Mon, 28 Jun 2010 03:07:47 am Richard D. Moores wrote: > A "feature" very important to me > is that with Gmail, my mail is just always THERE, with no need to > download it You see your email without downloading it? You don't understand how the Internet works, do you? *wry grin* -- Steven D'

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 3:20 PM, wrote: > I have tried the following, too: > > from pg8000 import DBAPI > import os > import os.path > import sys > > # !!! that is test data. It must be changed > conn=DBAPI.connect(host="localhost", database="postgres", user="postgres", > password="test") > > #co

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread petkovas
Can you send the full error text please? I'm not sure which is line 55 and Python normally displays the faulty line as part of the error trace. As it is I can't see any reason for it to fail but I'd like to be sure I'm looking at the right place! Also is there any reason why you explicitly c

Re: [Tutor] statements vs. expression and types

2010-06-27 Thread Hugo Arts
On Sun, Jun 27, 2010 at 6:57 PM, Payal wrote: > Hello, > Please forgive for such a silly questions. I have never taken a course on > computers so am rough with some of basic technical terminology. > > a. I read in a book that "lambdas are expressions ... so they can go > where functions are not al

Re: [Tutor] class questions

2010-06-27 Thread Hugo Arts
On Sun, Jun 27, 2010 at 6:47 PM, Shashwat Anand wrote: > >> >> The problem of the MRO isn't that it doesn't work, it's that it causes >> behavior that is unintuitive. In my example, We would expect D.x to be >> equal to C.x (since D inherits from C, and C overrides the x method). >> However, this

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 7:41 AM, Alan Gauld wrote: > "Marc Tompkins" wrote > > having no default email client (what sort of two-bit operating system >> >>> doesn't have an email client in 2010?); >>> >>> Jesus, you _miss_ Outlook Express? Seriously: the new default is >> webmail. >> Like it,

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Adam Bark
On 27 June 2010 18:22, Steve Willoughby wrote: > On 27-Jun-10 10:12, Adam Bark wrote: > >> On 27 June 2010 17:47, Payal > > > c. What is the correct Python of writing, >>except as e: print 'Msg : ' , e# Capturing all exceptions >> > > Since exceptions are (should be?) subclasses

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Steve Willoughby
On 27-Jun-10 10:12, Adam Bark wrote: On 27 June 2010 17:47, Payal c. What is the correct Python of writing, except as e: print 'Msg : ' , e# Capturing all exceptions Since exceptions are (should be?) subclasses of Exception, you can do: except Exception as e: I think the

Re: [Tutor] capturing error msg in exception

2010-06-27 Thread Adam Bark
On 27 June 2010 17:47, Payal wrote: > Hi, > Again a few queries regarding exceptions, > > a. What is the difference between, > > except ZeroDivisionError as e: print 'Msg : ' , e > except ZeroDivisionError ,e: print 'Msg : ' , e > > Both show, > Msg : integer division or modulo by zero > > b. Wh

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Richard D. Moores
On Sun, Jun 27, 2010 at 07:41, Alan Gauld wrote: > "Marc Tompkins" wrote > I will miss OE. I actually quite like it, its simple but has all the bits > I need for both email and newrgroups. I tried thunderbird and use it > on my Linux box but on windows I usually revert to OE. > > And its lots be

[Tutor] statements vs. expression and types

2010-06-27 Thread Payal
Hello, Please forgive for such a silly questions. I have never taken a course on computers so am rough with some of basic technical terminology. a. I read in a book that "lambdas are expressions ... so they can go where functions are not allowed". What are expressions and what are statements? A si

Re: [Tutor] class questions

2010-06-27 Thread Shashwat Anand
> The problem of the MRO isn't that it doesn't work, it's that it causes > behavior that is unintuitive. In my example, We would expect D.x to be > equal to C.x (since D inherits from C, and C overrides the x method). > However, this is not the case. This is what the problem is with the > old MRO

[Tutor] capturing error msg in exception

2010-06-27 Thread Payal
Hi, Again a few queries regarding exceptions, a. What is the difference between, except ZeroDivisionError as e: print 'Msg : ' , e except ZeroDivisionError ,e: print 'Msg : ' , e Both show, Msg : integer division or modulo by zero b. What is portable and correct way of writing, except (NameEr

Re: [Tutor] class questions

2010-06-27 Thread Hugo Arts
On Sun, Jun 27, 2010 at 4:13 PM, Payal wrote: > Hi Hugo, > > On Sun, Jun 27, 2010 at 01:27:37PM +0200, Hugo Arts wrote: >> Here's my attempt. Consider this simple Diamond hierarchy: > [...] >> Now, with this diagram the following code probably doesn't do what you >> expect: > > Actually, it does

[Tutor] retrieve URLs and text from web pages

2010-06-27 Thread Khawla Al-Wehaibi
Hi, I’m new to programming. I’m currently learning python to write a web crawler to extract all text from a web page, in addition to, crawling to further URLs and collecting the text there. The idea is to place all the extracted text in a .txt file with each word in a single line. So the text h

Re: [Tutor] socket

2010-06-27 Thread Alan Gauld
"Christopher King" wrote process. In other words, I want to connect two computers. I've looked up socket but the explanations are too complex. I think I need a 2-way conversation with a expert to understand it. Or even better, point me to a easier module. You can read the networking topic

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Alan Gauld
"Marc Tompkins" wrote having no default email client (what sort of two-bit operating system doesn't have an email client in 2010?); Jesus, you _miss_ Outlook Express? Seriously: the new default is webmail. Like it, don't like it, but it's really not as if you can't get your mail. I will

Re: [Tutor] class questions

2010-06-27 Thread Payal
Thanks a lot Eike for the code snippet. I got the idea now. With warm regards, -Payal -- On Sat, Jun 26, 2010 at 10:41:59PM +0200, Eike Welk wrote: > Hello Payal! > > On Saturday June 26 2010 19:05:16 Payal wrote: > > Can we say that our own exception classes have only maybe a doc-string > > a

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Alan Gauld
"Steven D'Aprano" wrote having no default email client (what sort of two-bit operating system doesn't have an email client in 2010?); To be fair to MS - and it pains me to do so - they have been beat up so much by the lawyers that its hardlly surprising. After all they have been forced to r

Re: [Tutor] class questions

2010-06-27 Thread Payal
Hi Steven, Thanks a lot for patiently explaining the concepts. I uderstood most of it. With warm regards, -Payal -- On Sun, Jun 27, 2010 at 10:09:38AM +1000, Steven D'Aprano wrote: > Probably not... it's quite complicated, which is why it's rare. I'll > have a think about it and see what I ca

Re: [Tutor] class questions

2010-06-27 Thread Payal
Hi Hugo, On Sun, Jun 27, 2010 at 01:27:37PM +0200, Hugo Arts wrote: > Here's my attempt. Consider this simple Diamond hierarchy: [...] > Now, with this diagram the following code probably doesn't do what you expect: Actually, it does what is expected. The old mro specifically says, bottom-top, le

Re: [Tutor] class questions

2010-06-27 Thread Hugo Arts
On Sun, Jun 27, 2010 at 2:09 AM, Steven D'Aprano wrote: > On Sun, 27 Jun 2010 03:05:16 am Payal wrote: >> >> Can you give any simple example where this simple mro will work >> incorrectly? > > Probably not... it's quite complicated, which is why it's rare. I'll > have a think about it and see what

Re: [Tutor] Advice on math

2010-06-27 Thread Modulok
>> Hello, I've enjoying learning python for the first few years, and >> appreciate all the help I have received from this list. I had some >> interest in programming and am very glad to have made python my choice >> of programming language. Since I didn't go to college for computer >> studies, I fe

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Marc Tompkins
On Sat, Jun 26, 2010 at 4:46 PM, Steven D'Aprano wrote: > Apart from: > The OP was asking about upgrading from Vista to 7, so let me answer your objections here... having no default email client (what sort of two-bit operating system > doesn't have an email client in 2010?); > Jesus, you _miss_