Re: [Tutor] web-based python?

2010-08-02 Thread Carlos Guerrero
IMHO, i believe that yes you can run django inside that server, but in a different way, this is how i believe this could be possible: do your django app but do it inside the django source folder you can download from the official site, and make it so, that all functions and models you need from dj

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

2010-08-02 Thread David Hutto
On Tue, Aug 3, 2010 at 12:05 AM, David Hutto wrote: > On Mon, Aug 2, 2010 at 8:53 PM, Richard D. Moores wrote: >> On Mon, Aug 2, 2010 at 16:57, Steven D'Aprano wrote: >>>  # File *probably* doesn't exist. Consider better error checking. >> >> Steve, before I dig into your detailed reply, please

Re: [Tutor] web-based python?

2010-08-02 Thread Che M
Thanks, Alan, for this set of helpful pointers. Just a few responses. > Actually web apps are all pretty similar. They consist of three basic > parts > (maybe 4): > 1) A mechanism for mapping a URL to a Python function or method. > 2) A mechanism for generating HTML with embedded data values

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

2010-08-02 Thread David Hutto
On Mon, Aug 2, 2010 at 8:53 PM, Richard D. Moores wrote: > On Mon, Aug 2, 2010 at 16:57, Steven D'Aprano wrote: >>  # File *probably* doesn't exist. Consider better error checking. > > Steve, before I dig into your detailed reply, please tell me what you > meant by " # File *probably* doesn't exi

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

2010-08-02 Thread Richard D. Moores
On Mon, Aug 2, 2010 at 16:57, Steven D'Aprano wrote: >  # File *probably* doesn't exist. Consider better error checking. Steve, before I dig into your detailed reply, please tell me what you meant by " # File *probably* doesn't exist. Consider better error checking.". Context was def load(path)

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

2010-08-02 Thread Richard D. Moores
On Mon, Aug 2, 2010 at 16:55, Alan Gauld wrote: > "Richard D. Moores" wrote > >> By golly, you're right! Your point led to changes in 4 lines, the ones >> highlighted: > > Its a Good Thing(TM) to keep your interface specs consistent so > I'd change the orde

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

2010-08-02 Thread Steven D'Aprano
On Tue, 3 Aug 2010 08:42:01 am Richard D. Moores wrote: > On Mon, Aug 2, 2010 at 14:28, Hugo Arts wrote: > > On Mon, Aug 2, 2010 at 8:58 PM, Richard D. Moores wrote: > >> OK, here's my attempt: . > >>  Better? > > > > Much better. But why is that F in the a

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

2010-08-02 Thread Alan Gauld
"Richard D. Moores" wrote By golly, you're right! Your point led to changes in 4 lines, the ones highlighted: Its a Good Thing(TM) to keep your interface specs consistent so I'd change the order of the parameters in repickling() to match those in creat

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

2010-08-02 Thread Richard D. Moores
On Mon, Aug 2, 2010 at 15:43, Hugo Arts wrote: > On Tue, Aug 3, 2010 at 12:42 AM, Richard D. Moores wrote: >> On Mon, Aug 2, 2010 at 14:28, Hugo Arts wrote: >>> On Mon, Aug 2, 2010 at 8:58 PM, Richard D. Moores >>> wrote: OK, here's my attempt:

Re: [Tutor] sys.exit help

2010-08-02 Thread Richard D. Moores
On Mon, Aug 2, 2010 at 13:48, Evert Rol wrote: > (replying to the full list; hope that was intended.) > 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 exit

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

2010-08-02 Thread Hugo Arts
On Tue, Aug 3, 2010 at 12:42 AM, Richard D. Moores wrote: > On Mon, Aug 2, 2010 at 14:28, Hugo Arts wrote: >> On Mon, Aug 2, 2010 at 8:58 PM, Richard D. Moores wrote: >>> >>> OK, here's my attempt: .  Better? >>> >> >> Much better. But why is that F in the

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

2010-08-02 Thread Richard D. Moores
On Mon, Aug 2, 2010 at 14:28, Hugo Arts wrote: > On Mon, Aug 2, 2010 at 8:58 PM, Richard D. Moores wrote: >> >> OK, here's my attempt: .  Better? >> > > Much better. But why is that F in the argument list of both functions? > It's overwritten immediately wit

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

2010-08-02 Thread Hugo Arts
On Mon, Aug 2, 2010 at 8:58 PM, Richard D. Moores wrote: > > OK, here's my attempt: .  Better? > Much better. But why is that F in the argument list of both functions? It's overwritten immediately with the open() call, so it seems unnecessary to include in t

Re: [Tutor] global exception handling?

2010-08-02 Thread Evert Rol
> A week or two back I asked this list about how to deal with SQLite database > errors like 'database is locked'. Since then I figured out one way to > reproduce that error (*see p.s. below if anyone is interested). I can also > then catch the error with a try/except block and prevent it from

Re: [Tutor] sys.exit help

2010-08-02 Thread Evert Rol
(replying to the full list; hope that was intended.) >>> 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 aroun

[Tutor] global exception handling?

2010-08-02 Thread Che M
A week or two back I asked this list about how to deal with SQLite database errors like 'database is locked'. Since then I figured out one way to reproduce that error (*see p.s. below if anyone is interested). I can also then catch the error with a try/except block and prevent it from causing

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

2010-08-02 Thread Richard D. Moores
On Sun, Aug 1, 2010 at 17:38, Hugo Arts wrote: > 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 sma

Re: [Tutor] Where to start with Unit Testing

2010-08-02 Thread Che M
> Che, from the analogies you made, it looks like you might not have very > clear what Unit Testing is for. > > True, UT is a way to automate tests that otherwise you should do > manually (as per your analogy), but the test you automate with UT are > not a "one off" thing (as it is processing t

Re: [Tutor] Where to start with Unit Testing

2010-08-02 Thread Huy Ton That
One final note, that I thought might be useful to others. I've just discovered doctest, which allows you to run tests on your embedded function/class documentation. Check it out here: http://docs.python.org/tutorial/stdlib.html#quality-control On Sun, Aug 1, 2010 at 3:30 AM, Huy Ton That wrote:

Re: [Tutor] Where to start with Unit Testing

2010-08-02 Thread Huy Ton That
Thanks additionally for your insight gems. Without reading too much into it, it was quite simple to create a series of test classes which just run some expected assertion values on a small scenario of inputs and what's expected. I usually find that I learn best by dabbling around in source code,

Re: [Tutor] Menu not working properly

2010-08-02 Thread David Hutto
On Mon, Aug 2, 2010 at 10:41 AM, Luke Paireepinart wrote: > > > On Aug 2, 2010, at 8:13 AM, David Hutto wrote: > >> On Mon, Aug 2, 2010 at 8:00 AM, Evert Rol wrote: Hello Evert Rol,           Thank you for the menu help, I have completed it with great success... There is 1 more p

Re: [Tutor] Menu not working properly

2010-08-02 Thread Luke Paireepinart
On Aug 2, 2010, at 8:13 AM, David Hutto wrote: > On Mon, Aug 2, 2010 at 8:00 AM, Evert Rol wrote: >>> Hello Evert Rol, >>> Thank you for the menu help, I have completed it with great >>> success... There is 1 more problem I am currently having, and when I fix it >>> my program will

Re: [Tutor] Menu not working properly

2010-08-02 Thread David Hutto
On Mon, Aug 2, 2010 at 8:00 AM, Evert Rol wrote: >> Hello Evert Rol, >>           Thank you for the menu help, I have completed it with great >> success... There is 1 more problem I am currently having, and when I fix it >> my program will be completed. If you are interested in helping me with t

Re: [Tutor] Menu not working properly

2010-08-02 Thread Evert Rol
> Hello Evert Rol, > Thank you for the menu help, I have completed it with great > success... There is 1 more problem I am currently having, and when I fix it > my program will be completed. If you are interested in helping me with this > last stretch, I will be greatly appreciative. >

Re: [Tutor] Menu not working properly

2010-08-02 Thread Evert Rol
> My problem is choice 3. Exit, if you select no or put an invalid answer... It > will run menu1... but then it runs > name = raw_input ("Enter your character name. ") > print "Your character name is:", name > > How can i make it so it prints menu1 like normal... then asks you to enter >

[Tutor] Menu not working properly

2010-08-02 Thread Jason MacFiggen
My problem is choice 3. Exit, if you select no or put an invalid answer... It will run menu1... but then it runs name = raw_input ("Enter your character name. ") print "Your character name is:", name How can i make it so it prints menu1 like normal... then asks you to enter your selection