[Tutor] requests/responses from urllib2

2008-08-10 Thread Eric Abrahamsen
I've got a question about the way urllib2 makes its requests. If I've got a python web framework running behind a web server, and that framework uses urllib2 to make a request to another server, how does that traffic go in and out of my server machine? The python docs say that urllib2 requi

Re: [Tutor] something is fundamentally wrong...

2008-08-10 Thread Joshua Nikkel
ah that was it. I had a variable named len earlier. On a restart it was fine. Thanks! On Sun, Aug 10, 2008 at 2:04 PM, Robert Berman <[EMAIL PROTECTED]>wrote: > No. Not so. > > Observe, please: > Python 2.5.2 (r252:60911, May 7 2008, 15:19:09) > [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2

Re: [Tutor] Unable to catch exception

2008-08-10 Thread Kent Johnson
On Sun, Aug 10, 2008 at 6:16 PM, James <[EMAIL PROTECTED]> wrote: > Kent, > > I'm not importing BadStatusLine. I'm only importing mechanize, which > downloads a page repeatedly. From time to time a BadStatusLine > exception is raised. I'm unsure how to go about catching it. Try adding from httplib

Re: [Tutor] Download file via HTTP GET with progress monitoring & custom headers?

2008-08-10 Thread Kent Johnson
On Sun, Aug 10, 2008 at 6:09 PM, xbmuncher <[EMAIL PROTECTED]> wrote: > I want to download a file via HTTP GET protocol (perhaps HTTP POST in the > future, whatever method should allow relativly easy changes to be made to > use POST later on) > I need to send custom headers like in urllib2.urlreque

Re: [Tutor] puzzling EOFError when mocking raw_input in doctest

2008-08-10 Thread Kent Johnson
On Sun, Aug 10, 2008 at 4:03 PM, <[EMAIL PROTECTED]> wrote: > > Hi all, > > I've continued playing about with mocking raw_input in doctests in light of > Kent's reply. > > I've hit an odd thing---if my substitute for raw_input returns '', I get an > EOFError. The code below shows the problem. It a

Re: [Tutor] Unable to catch exception

2008-08-10 Thread James
Kent, I'm not importing BadStatusLine. I'm only importing mechanize, which downloads a page repeatedly. From time to time a BadStatusLine exception is raised. I'm unsure how to go about catching it. Thoughts? -j On Sun, Aug 10, 2008 at 1:54 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Sat,

[Tutor] Download file via HTTP GET with progress monitoring & custom headers?

2008-08-10 Thread xbmuncher
I want to download a file via HTTP GET protocol (perhaps HTTP POST in the future, whatever method should allow relativly easy changes to be made to use POST later on) I need to send custom headers like in urllib2.urlrequest() I need to be able to monitor the download progress WHILE it downloads lik

Re: [Tutor] IP address parse

2008-08-10 Thread Kent Johnson
On Sun, Aug 10, 2008 at 1:58 AM, Josh Rosen <[EMAIL PROTECTED]> wrote: >> Since it doesn't look like you're doing anything with the parts of the ip >> besides writing the whole ip to a file, you can eliminate the capturing >> parentheses in your regular expression and replace them with a single pai

Re: [Tutor] running python script

2008-08-10 Thread Alan Gauld
"r t" <[EMAIL PROTECTED]> wrote this works, but the problem is the commad prompt stays open in the background cluttering up my desktop. So, 1. How do i close the command prompt after starting my program??? You don't. Instead you arrange for it not to open in the first place! The trick is to

[Tutor] puzzling EOFError when mocking raw_input in doctest

2008-08-10 Thread broek
Hi all, I've continued playing about with mocking raw_input in doctests in light of Kent's reply. I've hit an odd thing---if my substitute for raw_input returns '', I get an EOFError. The code below shows the problem. It arises equally if myrawalt is used in the doctest in place of myraw

Re: [Tutor] using generators to mock raw_input for doctest

2008-08-10 Thread broek
- Message from [EMAIL PROTECTED] - Date: Sun, 10 Aug 2008 14:03:38 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Reply-To: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] using generators to mock raw_input for doctest On Sun, Aug 10, 2008 at 1:38 AM, <[EMAIL PROTECTED

Re: [Tutor] running python script

2008-08-10 Thread Timothy Grant
On Sat, Aug 9, 2008 at 3:33 PM, r t <[EMAIL PROTECTED]> wrote: > currently i have a batch file that is associated with .txt extentions > so when i double click on a text file, windows runs the batch file that then > sends command line args to MY text editor program..."Texteditor.py", instead > of M

Re: [Tutor] using generators to mock raw_input for doctest

2008-08-10 Thread Kent Johnson
On Sun, Aug 10, 2008 at 1:38 AM, <[EMAIL PROTECTED]> wrote: > 2) Is there some better way to enable doctesting of code that uses > raw_input? All I found when googling was the suggestion that in place of: > > def myfunc(): > # code employing raw_input here > > one could write: > > def myfunc(in

Re: [Tutor] something is fundamentally wrong...

2008-08-10 Thread Robert Berman
No. Not so. Observe, please: Python 2.5.2 (r252:60911, May  7 2008, 15:19:09) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "copyright", "credits" or "license()" for more information.         Personal firewall software may

Re: [Tutor] importing path question

2008-08-10 Thread Kent Johnson
On Sat, Aug 9, 2008 at 6:03 PM, dave selby <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a main directory 'kmotion2' where python scripts live. They > access a library of scripts in 'kmotion2/core' as 'kmotion2/core' has > a __init__.py file. However I now need to create a new directory > 'utili

[Tutor] IP matching?.

2008-08-10 Thread bob gailer
PLEASE START A NEW SUBJECT. greg whittier wrote: On Sun, Aug 10, 2008 at 10:38 AM, Olrik Lenstra <[EMAIL PROTECTED]> wrote: That bit of code doesn't make a lot of sense to me so far. I don't see how that could "X" out a public address. (I do appreciate the help!) Regards, Olrik

Re: [Tutor] Unable to catch exception

2008-08-10 Thread Kent Johnson
On Sat, Aug 9, 2008 at 12:28 PM, James <[EMAIL PROTECTED]> wrote: > All, > > I'm having a rather strange problem that I'm hoping someone can shed > some light on. I'm trying to catch a BadStatusLine exception raised by > the httplib library. > The error only happens once every blue moon, but to avo

[Tutor] running python script

2008-08-10 Thread r t
currently i have a batch file that is associated with .txt extentions so when i double click on a text file, windows runs the batch file that then sends command line args to MY text editor program..."Texteditor.py", instead of Microsofts *feature rich* Crappad. :-P this works, but the problem is th

[Tutor] something is fundamentally wrong...

2008-08-10 Thread Joshua Nikkel
I've pasted the following from my python shell. Please note that the first two lines of code are taken directly from the standard tutorial files under section 3.1.2. Will someone please tell me why something as basic and straightforward as this will not work? Everything else seems to work just f

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread Alan Gauld
"Olrik Lenstra" <[EMAIL PROTECTED]> wrote I'm probably asking for a lot here. But I don't think I understand this fully. Thats OK. def onScan(self): self.myfile = open('foo.txt') self.count = 0 self.setTimer(0.01, self.processLine) def processLine(self) line = self.myfile.readli

[Tutor] Back-end Bittorrent Client in python

2008-08-10 Thread xbmuncher
I want to be able to download bittorrent files with the bittorrent protocol in my python program using only the native libraries in it. All I am interested is being able to download & upload simultanaeously, reading parts that make up the torrent package and being able to choose files/folders to do

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread greg whittier
On Sun, Aug 10, 2008 at 10:38 AM, Olrik Lenstra <[EMAIL PROTECTED]> wrote: > That bit of code doesn't make a lot of sense to me so far. > I don't see how that could "X" out a public address. > > (I do appreciate the help!) > > Regards, > Olrik > r = re.compile(r"(\d+)\.(\d+)\.\d+\.\d+") m = re.sea

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread Olrik Lenstra
That bit of code doesn't make a lot of sense to me so far. I don't see how that could "X" out a public address. (I do appreciate the help!) Regards, Olrik ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Questions about the new turtle module in Python 2.6b2

2008-08-10 Thread Dick Moores
At 11:57 PM 8/9/2008, you wrote: Dick Moores schrieb: Gregor, 1. I want the window to open with the right edge 0 pixels from the right edge of my screen. However, setup(width=.75, height=.915, startx=-0, starty=0) doesn't work. I h

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread greg whittier
On Sun, Aug 10, 2008 at 6:49 AM, Olrik Lenstra <[EMAIL PROTECTED]> wrote: > The program runs fine and works perfectly as the code is right now, But > while I'm asking for the bar, can I ask for some advice on the following bit > of code too? > > <<< > ##-

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread Olrik Lenstra
I'm probably asking for a lot here. But I don't think I understand this fully. This is the part I tried to get the Bar in. I actually got it in GUI wise. >> But I had no idea to let it run the moment I clicked "Scan" >> > > OK, Normally you have to update the bar values from inside a > loop on you

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread Alan Gauld
"Olrik Lenstra" <[EMAIL PROTECTED]> wrote This is the part I tried to get the Bar in. I actually got it in GUI wise. But I had no idea to let it run the moment I clicked "Scan" OK, Normally you have to update the bar values from inside a loop on your Scan method. In practice you probably need

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread Olrik Lenstra
This is the part I tried to get the Bar in. I actually got it in GUI wise. But I had no idea to let it run the moment I clicked "Scan" I got the code I tried to put in from another python file that I found somewhere on the net. It's attached as test.pyw <<< class MyFrame(wx.Frame): def __init_

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread Alan Gauld
"Olrik Lenstra" <[EMAIL PROTECTED]> wrote I've been developing a program for a while now (I am still a beginner though) and I want to add a progress bar (gauge bar) to my program. I am having quite some trouble actually implementing it though. I attached the file TSO.pyw which is my current