[Tutor] Uncertain about exceptions

2005-07-06 Thread Matej Cepl
Hi, I have here two Python modules (see attached), where newsparser.py defines (among other things) an object SoupReader and an exception PageNotAvailable. This object (or its children) is then periodically created in a loop in reprocess.py. Now, my question is concerned with the use of exception

Re: [Tutor] Uncertain about exceptions

2005-07-06 Thread Kent Johnson
Matej Cepl wrote: > Now, my question is concerned with the use of exception in SoupReader.suck. > The idea is that when the page is not available for download, whole object > goes up in flames, the rest of SoapReader.__init__ is skipped over, and the > exception is then caught in reprocess.py cycle

Re: [Tutor] Is there a way to combine a request for numbers and letters?

2005-07-06 Thread christinA
Please will you find out why the score on your mails are that high? My ISP is sending them directly to my spambox. For your convenience I copied the headers. Especially 0.8 MSGID_FROM_MTA_HEADER Message-Id was added by a relay 2.2 RCVD_IN_BL_SPAMCOP_NET Received via a relay in bl.spamcop.net

[Tutor] (no subject)

2005-07-06 Thread Michael Huster
In python under windows, how can I create and access a file on the Desktop? The following do NOT work: fp = open(r'Desktop\myFile','r') fp = open(r'\Desktop\myFile','r') fp = open(r'c:\Desktop\myFile','r') fp = open(r'c:\Windows\Desktop\myFile','r') I don't want to drill into c:\Documents and Set

[Tutor] Finding Desktop Files

2005-07-06 Thread Michael Huster
Repost - I forgot a subject In python under windows, how can I create and access a file on the Desktop? The following do NOT work: fp = open(r'Desktop\myFile','r') fp = open(r'\Desktop\myFile','r') fp = open(r'c:\Desktop\myFile','r') fp = open(r'c:\Windows\Desktop\myFile','r') I don't want to d

Re: [Tutor] (no subject)

2005-07-06 Thread Light
You could use this: import os fp = open(os.path.expanduser('~')+r'\Desktop\myFile', 'r') Light > In python under windows, how can I create and access a file on the > Desktop? The following do NOT work: fp = open(r'Desktop\myFile','r') > fp = open(r'\Desktop\myFile','r') > fp = open(r'c:\Desktop

Re: [Tutor] Case ? (fwd)

2005-07-06 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 6 Jul 2005 00:01:52 -0700 (PDT) From: Mike Cheponis <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Case ? On Tue, 5 Jul 2005, Danny Yoo wrote: > On Tue, 5 Jul 2005, Mike Cheponis wrote: > >> Why does Python not have

Re: [Tutor] (no subject)

2005-07-06 Thread Mark Thomas
On 7/6/05, Michael Huster <[EMAIL PROTECTED]> wrote: > In python under windows, how can I create and access a file on the Desktop? > The following do NOT work: How about... >>> userp = os.getenv('USERPROFILE') + '\\Desktop\\MyFile.txt' >>> fo = file(userp, 'w') -- _ ( ) Mark Thomas ASCII

[Tutor] Adding attributes to imported class

2005-07-06 Thread Michael Lange
Hello list, I'm trying to write a python wrapper for the tkDnD Tk extension to add drag and drop support to Tkinter. Looking for a way to give all widgets access to the newly defined dnd methods I came to create a subclass of Tkinter.Tk() and pass the dnd methods to Tkinter.BaseWidget() (all T

[Tutor] Problem with data storage

2005-07-06 Thread festus freeborn
plz I need infor About "Problem with data storage" Thanks__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@python.org http://

Re: [Tutor] (no subject)

2005-07-06 Thread Danny Yoo
On Wed, 6 Jul 2005, Michael Huster wrote: > In python under windows, how can I create and access a file on the > Desktop? The following do NOT work: fp = open(r'Desktop\myFile','r') fp > = open(r'\Desktop\myFile','r') fp = open(r'c:\Desktop\myFile','r') fp = > open(r'c:\Windows\Desktop\myFile','

[Tutor] file io: reading an int32 at the end of a file?

2005-07-06 Thread Marcus Goldfish
Hi, I have a file format that ends in a 4-byte (int32) number. I would like to read this value in python on a WinXP machine with something like: fname = 'somefile' f = open(fname, 'rb') f.seek(-4,2) offset = f.read() ... but this doesn't seem to work. The value that Python returns is: '@\x

Re: [Tutor] Case ? (fwd)

2005-07-06 Thread Danny Yoo
> > It's a proposed enhancement: > > > >http://www.python.org/peps/pep-0275.html > > Since this didn't come out in Python 2.4, is it "automatically" > re-considered for 2.5 ? Hello! It's still in the "open" set of peps: http://www.python.org/peps/ so there's no guarantee that PEP 275

Re: [Tutor] (no subject)

2005-07-06 Thread Rudy Schockaert
This will work, but only on an English version of the OS. E.g. in Dutch the desktop is called 'Bureaublad'.On 7/6/05, Mark Thomas < [EMAIL PROTECTED]> wrote:On 7/6/05, Michael Huster < [EMAIL PROTECTED]> wrote:> In python under windows, how can I create and access a file on the Desktop? The followi

Re: [Tutor] file io: reading an int32 at the end of a file?

2005-07-06 Thread Danny Yoo
On Wed, 6 Jul 2005, Marcus Goldfish wrote: > I have a file format that ends in a 4-byte (int32) number. I would like > to read this value in python on a WinXP machine with something like: > > fname = 'somefile' > f = open(fname, 'rb') > f.seek(-4,2) > offset = f.read() > > ... but this doesn't

Re: [Tutor] Case ? (fwd)

2005-07-06 Thread Smith, Jeff
If you like the switch statement (which I do) and believe Python should have one (which I do) then you might take a look at this which someone posted when I asked this same question a few months ago: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410692 Jeff -Original Message- F

Re: [Tutor] Problem with data storage

2005-07-06 Thread Bob Gailer
At 08:36 AM 7/6/2005, festus freeborn wrote: plz I need infor About "Problem with data storage" We need more information. How does this question relate to Python? What is the problem you are having? Why do you need to know? Bob Gailer mailto:[EMAIL PROTECTED] 510 558 3275 home 720 938 2625 cell

Re: [Tutor] file io: reading an int32 at the end of a file?

2005-07-06 Thread Bob Gailer
At 01:12 PM 7/6/2005, Marcus Goldfish wrote: Hi, I have a file format that ends in a 4-byte (int32) number.  I would like to read this value in python on a WinXP machine with something like: fname = 'somefile' f = open(fname, 'rb') f.seek(-4,2) offset = f.read() ... but this doesn't seem to work.

Re: [Tutor] Adding attributes to imported class

2005-07-06 Thread jfouhy
Quoting Michael Lange <[EMAIL PROTECTED]>: > I'm trying to write a python wrapper for the tkDnD Tk extension to add > drag and drop support Hi Michael, Just a side issue --- tkDnD seems to be broken in python 2.4: see bug 1164742, http://sourceforge.net/tracker/index.php?func=detail&aid=1164742&

Re: [Tutor] Case ? (fwd)

2005-07-06 Thread Alan G
The reason why Python doresn't have a case statement is simply because Guido didn't put one in. Why he didn't I don't know, you'd need to ask him. But I guess that since case stateents are simply syntactic sugar (well nearly), that providing one might have seemed like going against Python's eth

Re: [Tutor] Problem with data storage

2005-07-06 Thread Alan G
From: "festus freeborn" <[EMAIL PROTECTED]> > plz I need infor About "Problem with data storage" You might need to give us a clue here. What kind of problem? What kind of data? What kind of storage? - for how long? how quickly retrieved? And if its a homework exercise, which it looks like it mi

Re: [Tutor] file io: reading an int32 at the end of a file?

2005-07-06 Thread Alan G
-- ... but this doesn't seem to work. The value that Python returns is: '@\x19\x01\x00' but I know from similar code in Matlab that the correct sequence is: 64 25 1 0 Can someone point out my error? -- That

[Tutor] Doctype declaration

2005-07-06 Thread gordnjen
Thanks to everyone who helped me with the problem I had with my "age" program. I now have it working properly (yay).   So, now I need to know how to insert a doctype declaration into my python script so that a) the python script runs properly and b)the page validates as valid XHTML.   Here i

Re: [Tutor] Doctype declaration

2005-07-06 Thread Kent Johnson
gordnjen wrote: > So, now I need to know how to insert a doctype declaration into my > python script so that a) the python script runs properly and b)the page > validates as valid XHTML. > > Here is my code below. It runs fine as a python script, but won't validate: > > import time > print "C

Re: [Tutor] What's wrong with this code?

2005-07-06 Thread Nathan Pinno
Hi all, I meant to ask why the main part after the password is not working right. No one has answered that yet. When I run the code and try to load a file that has been saved, a TypeError appears. How do I fix the code so no more errors will show up. Here is the newest code so far: # Thi

[Tutor] Why is this error showing up? (Original Message: (Tutor) What's wrong with this code?) Ignore previous post.

2005-07-06 Thread Nathan Pinno
Hi all,   Here's one of the messages that pops up:   Traceback (most recent call last):  File "D:\password.py", line 77, in ?    filename == raw_input("Filename to load: ")NameError: name 'filename' is not defined   Why is it popping up whenever I try to load a file?   Here's the latest code: