[Tutor] Where to start with Unit Testing

2010-08-01 Thread Huy Ton That
Hi all, Do any of you have any feedback, strategies and best practices related to unit testing within Python. This is a relatively new topic for me. I was thinking of starting with reading the documentation associate with the unittest module. -Huy ___ T

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Mark Lawrence
On 01/08/2010 08:30, Huy Ton That wrote: Hi all, Do any of you have any feedback, strategies and best practices related to unit testing within Python. This is a relatively new topic for me. I was thinking of starting with reading the documentation associate with the unittest module. -Huy __

Re: [Tutor] problem with simple script

2010-08-01 Thread Richard D. Moores
(This repeats an earlier post of mine, and gives the correct link to the script I wrote about: . In a subsequent post I reported that I had gotten rid of the flag in a further revision: This link is correct. I apologize

Re: [Tutor] Writing scripts and apps for Internet consumption

2010-08-01 Thread Timo
On 01-08-10 00:40, Eric Hamiter wrote: On Sat, Jul 31, 2010 at 4:48 PM, bob gailer > wrote: Please post that code, and the URL you use to invoke it. test.py: this works on my laptop but not on the server http://pastebin.com/ChjUzLRU Just a wild guess, but maybe

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Mac Ryan
On Sun, 2010-08-01 at 03:30 -0400, Huy Ton That wrote: > Hi all, > > Do any of you have any feedback, strategies and best practices related > to unit testing within Python. This is a relatively new topic for me. > I was thinking of starting with reading the documentation associate > with the unitt

[Tutor] Help with Import Error problems

2010-08-01 Thread Roy Khristopher Bayot
Hi. Good day. I am having an import error problem. Last week, I was following this site: http://sites.google.com/site/spatialpython/processing-aster-with-python-numpy-and-gdal. I was able to make the python script run on the terminal. But this week, it was throwing some error. This was the traceb

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Evert Rol
> Hi. Good day. > > I am having an import error problem. Last week, I was following this site: > http://sites.google.com/site/spatialpython/processing-aster-with-python-numpy-and-gdal. > I was able to make the python script run on the terminal. But this week, it > was throwing some error. >

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread python
Mac, > My answer falls in the category "feedback" ... I'm not the OP, but I wanted to let you know that I really enjoyed your feedback - excellent writeup! Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: h

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Che M
> Do any of you have any feedback, strategies and best practices > related to unit testing within Python. This is a relatively new topic > for me. I was thinking of starting with reading the documentation > associate with the unittest module. The idea of unit testing/test driven development

[Tutor] web-based python?

2010-08-01 Thread Alex Hall
Hi all, I have an IPowerWeb.com server, which claims to support Python. How would I use this? For example, to start, how would I print html code to the screen, or manage input from a form? Thanks. -- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/m

Re: [Tutor] web-based python?

2010-08-01 Thread Hugo Arts
On Sun, Aug 1, 2010 at 7:07 PM, Alex Hall wrote: > Hi all, > I have an IPowerWeb.com server, which claims to support Python. How > would I use this? For example, to start, how would I print html code > to the screen, or manage input from a form? Thanks. > There is a myriad of python web developme

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Roy Khristopher Bayot
Evert, I got it back working. But it was with some stroke of luck. And I dont know the explanation. I installed the latest source of GEOS (as suggested by someone from the gdal channel). Then i tried the script. It gave me a different import error. ImportError: libgeos-3.3.0.so: cannot open shar

Re: [Tutor] web-based python?

2010-08-01 Thread python
Alex, > I have an IPowerWeb.com server, which claims to support Python Many hosting providers claim to support Python. The best hosting service I've found for Python is webfaction.com. Originally this hosting provider specialized in just Python hosting and this enthusiasm for Python and hands-on

Re: [Tutor] web-based python?

2010-08-01 Thread Alex Hall
On 8/1/10, Hugo Arts wrote: > On Sun, Aug 1, 2010 at 7:07 PM, Alex Hall wrote: >> Hi all, >> I have an IPowerWeb.com server, which claims to support Python. How >> would I use this? For example, to start, how would I print html code >> to the screen, or manage input from a form? Thanks. >> > > Th

Re: [Tutor] web-based python?

2010-08-01 Thread Hugo Arts
On Sun, Aug 1, 2010 at 7:46 PM, Alex Hall wrote: > > I had looked into Django before. What is confusing me is that it > sounds like it is meant to be run on the server directly. I do not > have direct access to my server, I just rent space on it and can > login. Maybe I am missing something, but h

Re: [Tutor] web-based python?

2010-08-01 Thread bob gailer
On 8/1/2010 1:07 PM, Alex Hall wrote: Hi all, I have an IPowerWeb.com server, which claims to support Python. How would I use this? For example, to start, how would I print html code to the screen, or manage input from a form? Thanks. Another participant just raised a similar question! Unf

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Evert Rol
> I got it back working. But it was with some stroke of luck. And I dont know > the explanation. > > I installed the latest source of GEOS (as suggested by someone from the gdal > channel). Then i tried the script. It gave me a different import error. > > ImportError: libgeos-3.3.0.so: cannot

Re: [Tutor] Help with Import Error problems

2010-08-01 Thread Roy Khristopher Bayot
Evert, Thank you very much. I do hope it goes on working. :D Roy On Mon, Aug 2, 2010 at 2:09 AM, Evert Rol wrote: > > I got it back working. But it was with some stroke of luck. And I dont > know the explanation. > > > > I installed the latest source of GEOS (as suggested by someone from the

Re: [Tutor] web-based python?

2010-08-01 Thread Alex Hall
On 8/1/10, bob gailer wrote: > On 8/1/2010 1:07 PM, Alex Hall wrote: >> Hi all, >> I have an IPowerWeb.com server, which claims to support Python. How >> would I use this? For example, to start, how would I print html code >> to the screen, or manage input from a form? Thanks. > Another participan

[Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Richard D. Moores
is a work in progress. If I could get the script to tell whether or not the pickle files already existed, I could radically revise it (yeah, functions and all :) ). So how to find if a file exists? Vista, Python 3.1 Thanks, Dick Moores

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread python
Richard, Look at the os.path.isfile function. Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] web-based python?

2010-08-01 Thread Hugo Arts
On Sun, Aug 1, 2010 at 8:28 PM, Alex Hall wrote: > > Sure, but django would be quite helpful. I want to do more than just > print, the point is to be able to handle form input, resize/position > images, all that. Still, it is good to not have to go through the > hastle of getting a straight answer

Re: [Tutor] web-based python?

2010-08-01 Thread Che M
> > There is a myriad of python web development frameworks. Here's a link > > with a ton of info: > > > > http://wiki.python.org/moin/WebFrameworks > I had looked into Django before. What is confusing me is that it > sounds like it is meant to be run on the server directly. I do not > have direc

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Richard D. Moores
On Sun, Aug 1, 2010 at 11:33, wrote: > Richard, > > Look at the os.path.isfile function. > > Malcolm Thanks, Malcolm. That makes a tremendous difference. If anyone's curious, they see what use I've made of os.path.isfile(path): Dick > _

[Tutor] sys.exit help

2010-08-01 Thread Jason MacFiggen
I was wondering how can I change sys.exit so if you use command line to run the program. it prompts a message asking if the user wants to exit instead of automatically just exiting? import random import sys my_hp = 50 mo_hp = 50 menu1 = """ Menu Selections: 1 - Attack

Re: [Tutor] sys.exit help

2010-08-01 Thread Hugo Arts
On Sun, Aug 1, 2010 at 10:26 PM, Jason MacFiggen wrote: > I was wondering how can I change sys.exit so if you use command line to run > the program. it prompts a message asking if the user wants to exit instead > of automatically just exiting? You can't change sys.exit, but you can build somethin

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Steven D'Aprano
On Mon, 2 Aug 2010 04:29:39 am Richard D. Moores wrote: > is a work in progress. If I > could get the script to tell whether or not the pickle files already > existed, I could radically revise it (yeah, functions and all :) ). > So how to find if a file exist

Re: [Tutor] sys.exit help

2010-08-01 Thread Evert Rol
> I was wondering how can I change sys.exit so if you use command line to run > the program. it prompts a message asking if the user wants to exit instead of > automatically just exiting? Just write a wrapper exit() function around sys.exit that does that. You don't want to change the sys.exit f

Re: [Tutor] sys.exit help

2010-08-01 Thread Steven D'Aprano
On Mon, 2 Aug 2010 06:26:24 am Jason MacFiggen wrote: > I was wondering how can I change sys.exit so if you use command line > to run the program. it prompts a message asking if the user wants to > exit instead of automatically just exiting? Don't do that. Leave sys.exit alone, write your own quit

Re: [Tutor] Tutor Digest, Vol 78, Issue 8

2010-08-01 Thread Daniel Sarmiento
> Date: Sun, 1 Aug 2010 12:28:49 -0700 > From: "Richard D. Moores" > To: pyt...@bdurham.com > Cc: tutor@python.org > Subject: Re: [Tutor] How to get script to detect whether a file >exists? > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > On Sun, Aug 1, 2010 at 11:33,

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Daniel Sarmiento
> Date: Sun, 1 Aug 2010 12:28:49 -0700 > From: "Richard D. Moores" > To: pyt...@bdurham.com > Cc: tutor@python.org > Subject: Re: [Tutor] How to get script to detect whether a file >exists? > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > On Sun, Aug 1, 2010 at 11:33,

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Richard D. Moores
On Sun, Aug 1, 2010 at 13:37, Steven D'Aprano wrote: > On Mon, 2 Aug 2010 04:29:39 am Richard D. Moores wrote: >> is a work in progress. If I >> could get the script to tell whether or not the pickle files already >> existed, I could radically revise it (yea

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Richard D. Moores
On Sun, Aug 1, 2010 at 15:00, Richard D. Moores wrote: > On Sun, Aug 1, 2010 at 14:44, Daniel Sarmiento wrote: >> >> Without knowing what your code does, I think it will be something like: >> >> try: >>     F_unused = open(path1, 'rb') >>     F_used = open(path2, 'rb') >> except IOError: >>    

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Hugo Arts
On Mon, Aug 2, 2010 at 12:53 AM, Richard D. Moores wrote: > On Sun, Aug 1, 2010 at 15:00, Richard D. Moores wrote: >> On Sun, Aug 1, 2010 at 14:44, Daniel Sarmiento wrote: >>> > >>> Without knowing what your code does, I think it will be something like: >>> >>> try: >>>     F_unused = open(path1

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread David Hutto
On Sun, Aug 1, 2010 at 12:18 PM, Che M wrote: > > >> Do any of you have any feedback, strategies and best practices >> related to unit testing within Python. This is a relatively new topic >> for me. I was thinking of starting with reading the documentation >> associate with the unittest module. >

Re: [Tutor] web-based python?

2010-08-01 Thread Eric Hamiter
On Sun, Aug 1, 2010 at 1:56 PM, Che M wrote: > For a long time I have hoped for a "Python web apps for absolute beginners" > tutorial that doesn't assume any knowledge. For a beginner, it is not even > clear what a "web frameworks" is let alone which one he/she should start > with or if it is ev

Re: [Tutor] web-based python?

2010-08-01 Thread David Hutto
On Sun, Aug 1, 2010 at 7:38 PM, Eric Hamiter wrote: > On Sun, Aug 1, 2010 at 1:56 PM, Che M wrote: >> >> For a long time I have hoped for a "Python web apps for absolute >> beginners" >> tutorial that doesn't assume any knowledge.  For a beginner, it is not >> even >> clear what a "web frameworks

Re: [Tutor] web-based python?

2010-08-01 Thread Alan Gauld
"Che M" wrote For a long time I have hoped for a "Python web apps for absolute beginners" I just checked Alan Gauld's Learning to Program and was disappointed to see the section on writing web apps hasn't been done yet, I started on the client side topic but then Python 3 came out and

Re: [Tutor] sys.exit help

2010-08-01 Thread Alan Gauld
"Jason MacFiggen" wrote I was wondering how can I change sys.exit so if you use command line to run the program. it prompts a message asking if the user wants to exit instead of automatically just exiting? Don't just use sys.exit use a try/except SystemExit... import sys try: ...sys.

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Richard D. Moores
On Sun, Aug 1, 2010 at 16:01, Hugo Arts wrote: > On Mon, Aug 2, 2010 at 12:53 AM, Richard D. Moores wrote: >> On Sun, Aug 1, 2010 at 15:00, Richard D. Moores wrote: >>> On Sun, Aug 1, 2010 at 14:44, Daniel Sarmiento >>> wrote: >> Without knowing what your code does, I think it will b

Re: [Tutor] How to get script to detect whether a file exists?

2010-08-01 Thread Hugo Arts
On Mon, Aug 2, 2010 at 2:26 AM, Richard D. Moores wrote: > > Well, I'd like to try. Could you give me, say, an outline of what > might be a good way? Actually, before I changed to the error catching, > I tried to break it up into a bunch of small functions. But they got > all tangled up with some

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Che M
> > The idea of unit testing/test driven development has remained > > foreign to me throughout my time trying to learn Python--by choice. > > I want to make desktop GUI applications and I don't use MVC, so > > the idea of writing tests strikes me as far more work--and a major > > delayer of gett

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread David Hutto
On Sun, Aug 1, 2010 at 9:11 PM, Che M wrote: > > >> > The idea of unit testing/test driven development has remained >> > foreign to me throughout my time trying to learn Python--by choice. >> > I want to make desktop GUI applications and I don't use MVC, so >> > the idea of writing tests strikes m

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread David Hutto
On Sun, Aug 1, 2010 at 9:31 PM, David Hutto wrote: > On Sun, Aug 1, 2010 at 9:11 PM, Che M wrote: >> >> >>> > The idea of unit testing/test driven development has remained >>> > foreign to me throughout my time trying to learn Python--by choice. >>> > I want to make desktop GUI applications and I

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread David Hutto
On Sun, Aug 1, 2010 at 9:39 PM, David Hutto wrote: > On Sun, Aug 1, 2010 at 9:31 PM, David Hutto wrote: >> On Sun, Aug 1, 2010 at 9:11 PM, Che M wrote: >>> >>> > The idea of unit testing/test driven development has remained > foreign to me throughout my time trying to learn Python--by

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Huy Ton That
All these responses are incredible, I will go through them on my venture to bring unit testing under my belt. I have never done formal unit testing in my programming career, I've just gone through way of general debugging and utilizing version control such as Mercurial. On Sun, Aug 1, 2010 at 9:4

Re: [Tutor] Where to start with Unit Testing

2010-08-01 Thread Mac Ryan
> A different analogy comes to my mind; I once saw two different sets of > people analyze data. One did it "by hand": visually inspecting > thousands > of signals herself and typing Y or N to accept or reject each signal. > The > other did it with an automated system that accepted or rejected > s