Re: [Tutor] hand-holding for web development

2005-10-17 Thread Jay Loden
You need an Apache config section to tell it what to use mod_python on and how. For example, in httpd.conf or a separate file in your conf.d directory for apache: Directory /var/www/html/ AddHandler mod_python .py PythonHandler test PythonDebug On /Directory tells

Re: [Tutor] Python equiv to PHP include ?

2005-09-29 Thread Jay Loden
Alan, thanks for your responses, they're quite helpful. I suspect the real problem I'm having is simply trying to switch modes of thinking to CGI style or mod_python style instead of the PHP style embedded code. The whole point of this exercise for me was to decide which language I prefer for

Re: [Tutor] How do I add an argument too...

2005-08-03 Thread Jay Loden
I think it was just a typo for the python distro that came out as the epython distro... On Thursday 21 July 2005 9:15 pm, Danny Yoo wrote: On Thu, 21 Jul 2005, Joseph Quigley wrote: optparse.. Can I download that as a module or do I have to download epython? Hi Joseph, optparse derives

[Tutor] Zope/Python web devel

2005-08-03 Thread Jay Loden
I've been considering some web projects recently, but I have some concerns about selecting the tools I plan to use. I like Python, and I was immediately thinking of using Zope to build on. However, I am concerned about performance, resource usage, and scalability. Does anyone here have any

[Tutor] getopt matching incorrect options

2005-07-11 Thread Jay Loden
I have an app that takes a command line argument of -l or --list. It uses the getopt module to parse the arguments, and I just noticed that for some reason, getopt is matching --lis or --li etc to --list. (Code pasted in below) Is this normal behavior, and if so, is there any way to avoid

[Tutor] getopt matching incorrect options

2005-07-11 Thread Jay Loden
I have an app that takes a command line argument of -l or --list. It uses the getopt module to parse the arguments, and I just noticed that for some reason, getopt is matching --lis or --li etc to --list. (Code pasted in below) Is this normal behavior, and if so, is there any way to avoid

Re: [Tutor] Python and Web Pages?

2005-04-23 Thread Jay Loden
I use both Python and PHP on my website to do a variety of tasks. Some things PHP can do much easier than Python, but if you're doing simple things like form handling, Python will do nicely. If you're comfortable with Python, use it. I find Python much easier to work with than PHP for a

Re: [Tutor] how to display an image using python

2005-04-14 Thread Jay Loden
If you don't mind using an external program, you could use the 'display' command from ImageMagick. -Jay On Thursday 14 April 2005 07:59 pm, Ertl, John wrote: All, I have asked this question before, but one more time most have commented about manipulation but displaying the image has become

Re: [Tutor] Cell Bio Newbie Here

2005-04-11 Thread Jay Loden
Ok, it's a logic error in the while loop. Starting at the beginning: you can't compare the value of password until the user inputs the value, which is why it's requiring you to put password = foobar at the top. Otherwise, password has no value, and as far as the interpreter is concerned, it

Re: [Tutor] Re: random import errors

2005-04-05 Thread Jay Loden
Only one version installed, and I could copy it over from elsewhere, but I wouldn't be inclined to do so since it works right now. -Jay On Tuesday 05 April 2005 10:22 pm, Lee Harr wrote: I have a python script that runs on my webserver every fifteen minutes. It has run for several months

[Tutor] random import errors?

2005-04-01 Thread Jay Loden
I have a python script that runs on my webserver every fifteen minutes. It has run for several months with absolutely no problems. Suddenly, yesterday morning I got an email from cron with an import error for sre_constants (see below) I logged in with ssh, manually ran the script and got the

Re: [Tutor] sys.argv[1: ] help

2005-02-25 Thread Jay Loden
Should be: import sys def main(): '''prints out the first command line argument''' print sys.argv[1] main() On Friday 25 February 2005 04:35 pm, Richard gelling wrote: Hi, I am reading ' Learning Python second edition' by Mark Lutz and David Ascher, and I trying the code examples as

Re: [Tutor] Newbie simple question

2005-02-25 Thread Jay Loden
You want readlines() not readline() and it should work something like this: remailfile = open(remail2.txt, r) remails = remailfile.readlines() for line in remails: #do something -Jay On Friday 25 February 2005 05:14 pm, Valone, Toren W. wrote: I need to know how to read the next line while

Re: [Tutor] files in a directory

2005-01-30 Thread Jay Loden
There's a few ways to accomplish this...the way that comes to mind is: ## import glob files = glob.glob(/path/to/director/*.dml) # assuming you want only .dml def spot(file): '''search for intensity spots and report them to an output

Re: [Tutor] New to Python

2005-01-26 Thread Jay Loden
I also recommend the book Dive Into Python - it gets awesome reviews, and the book is under Creative Commons license, so it's free to download and distribute. http://diveintopython.org I also have the book Core Python Programming which is pretty good, and has a nice way of leaping right

[Tutor] glob or filter help

2005-01-21 Thread Jay Loden
I have the following code in my updates script (gets the five most recent updated files on my site) def get_fles(exts, upd_dir): '''return list of all the files matching any extensions in list exts''' fle_list = [] for each in exts: cmd = upd_dir + *. + each ext_ls = glob.glob(cmd)

Re: [Tutor] read line x from a file

2005-01-21 Thread Jay Loden
One simple solution is to do: fle = open(file) contents = file.readlines() file.close() print contents[x] #or store this in a variable, whatever -Jay On Friday 21 January 2005 11:22, J. M. Strother wrote: I have a text file containing 336 records. I can read and print out the whole file

[Tutor] need help planning website updates

2005-01-20 Thread Jay Loden
I have a sort of simple CMS system on my website made from a conglomeration of scripts. On the left column, I want to add a feature that shows the last five items updated (only html exe files in the /var/www/html/ for example) directory that I have updated, with each item as a link to the

Re: [Tutor] need help planning website updates

2005-01-20 Thread Jay Loden
Adding it into the PHP that creates the html would create too much overhead since it loads each page individually upon request, and that would mean running the modified time check on every page load.   But I was thinking about this after I sent the mail, and I think you have a point with just