[Tutor] how do i get datetime object or time object from updated in rss

2006-08-03 Thread anil maran
How do i convert this string todatetime objectFri, 21 Apr 2006 03:02:17 +Previously I'd been using mxDateTime (which does everything but requires a C extension) to parse e-mail style dates (i.e. the ones used in RSS and changes.xml) but it looks like they're handled by the standard library.

Re: [Tutor] smtp error from cgi script

2006-08-03 Thread Ewald Ertl
Hi Rob, Rob wrote: Hi, can someone help me interpret the error output below? I can't tell whether this is a coding error, or a configuration error, in which case, it would be up to my host provider. For privacy reasons, I have changed the actual email addresses to [EMAIL PROTECTED]

Re: [Tutor] os.walk()

2006-08-03 Thread Alan Gauld
Christopher Spears [EMAIL PROTECTED] wrote for root,dirs,files in os.walk(base): for name in files: path = os.path.join(root, name) print path Sample output: ./gui_screenshot.jpeg ./find_items.pyc ./find_items.py ./os ./LearningToProgram/loggablebankaccount.py I'm glad that the

Re: [Tutor] critique my script!

2006-08-03 Thread Alan Gauld
I created a function that takes a pattern and a base path and then uses os.walk and glob to traverse directories starting from the base path and place files that match the glob pattern in a dictionary. I'm not sure why you are traversing the paths a second time. Why not just apply glob within

Re: [Tutor] Notes on namespaces, scopes, etc

2006-08-03 Thread Kent Johnson
Dave Kuhlman wrote: I believe that I've incorporated most, if not all, of the suggestions from those on the list, except for Danny's suggestion (above) about closures. The document itself is still here: http://www.rexx.com/~dkuhlman/python_comments.html#namespaces Very nice. Just a few

Re: [Tutor] critique my script!

2006-08-03 Thread Kent Johnson
Alan Gauld wrote: I created a function that takes a pattern and a base path and then uses os.walk and glob to traverse directories starting from the base path and place files that match the glob pattern in a dictionary. I'm not sure why you are traversing the paths a second time. Why

[Tutor] Binary fractions, recommendations?

2006-08-03 Thread Liam Clarke
Hi all, I was recently playing with the problem of implementing the floor() functionality, modulo being specifically mentioned in the briefing... so, after grokking that x = a - (a % b) would do it (i.e. for a = 5.5 and b = 1, you'd get x =5) I felt very pleased... ...until I saw the definiton

Re: [Tutor] Binary fractions, recommendations?

2006-08-03 Thread Luke Paireepinart
Liam Clarke wrote: Hi all, I was recently playing with the problem of implementing the floor() functionality, modulo being specifically mentioned in the briefing. you could convert the float to a string, split on the decimal point, and convert the left-hand side back to an integer :) or

[Tutor] Listbox selection

2006-08-03 Thread Joe Cox
I am still having a problem getting my listbox's binded to the radiobuttons. I am getting closer. ###Assign each Radiobutton with its own listbox values, show one selected button and one listbox### from Tkinter import * root = Tk() var = StringVar() var.set('a') { 'Aluminum' : ['Wrought',

Re: [Tutor] critique my script!

2006-08-03 Thread Christopher Spears
I didn't know I could place the glob in the os.walk traversal. Could you give me an example of how to do this? --- Alan Gauld [EMAIL PROTECTED] wrote: I created a function that takes a pattern and a base path and then uses os.walk and glob to traverse directories starting from the base

Re: [Tutor] Binary fractions, recommendations?

2006-08-03 Thread Kent Johnson
Liam Clarke wrote: Problem is; I can't bitshift on floats, so can't test. Can't bitshift on floats in C either. Does anyone know how I could work on a binary representation of a float? Any language at all, I'm desperate... In C you can certainly get access to the binary representation of a

[Tutor] regular expression

2006-08-03 Thread arbaro arbaro
Hello,I'm trying to mount an usb device from python under linux.To do so, I read the kernel log /proc/kmsg and watch for something like: 6 /dev/scsi/host3/bus0/target0/lun0/:7usb-storage: device scan complete When I compile a regular _expression_ like: r =

[Tutor] python processing of web html forms

2006-08-03 Thread Jeff Peery
Hello, I want to use python to process information input into a HTML form on my website. how is this typically performed? I saw cherrypy and also quixote for web python stuff... I have no experience with python on the web. Thanks.jeff Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone

Re: [Tutor] critique my script!

2006-08-03 Thread Alan Gauld
I didn't know I could place the glob in the os.walk traversal. Could you give me an example of how to do this? I'm not sure why you see a problem. A simplified form of your code is like this: for root,dirs,files in os.walk(abs_base): for name in dirs: path = os.path.join(root,

Re: [Tutor] regular expression

2006-08-03 Thread Kent Johnson
arbaro arbaro wrote: Hello, I'm trying to mount an usb device from python under linux. To do so, I read the kernel log /proc/kmsg and watch for something like: 6 /dev/scsi/host3/bus0/target0/lun0/:7usb-storage: device scan complete When I compile a regular expression like: r =

Re: [Tutor] python processing of web html forms

2006-08-03 Thread Mike Hansen
__ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jeff Peery Sent: Thursday, August 03, 2006 11:38 AM To: tutor@python.org Subject: [Tutor] python processing of web html forms Hello, I want to

[Tutor] File like object for Windows registry

2006-08-03 Thread K . Weinert
Hello! My app should run on debian and windows platforms. For storing the configuration data, I use the ConfigParser module. What I find difficult is to determine a place for my configuration file. On debian, it is simply os.path.join(os.path.expanduser(~)),myconfig) but what am I supposed

Re: [Tutor] python processing of web html forms

2006-08-03 Thread Lloyd Kvam
On Thu, 2006-08-03 at 10:38 -0700, Jeff Peery wrote: Hello, I want to use python to process information input into a HTML form on my website. how is this typically performed? I saw cherrypy and also quixote for web python stuff... I have no experience with python on the web. Thanks.

Re: [Tutor] regular expression

2006-08-03 Thread arbaro arbaro
Hello, Im just answering my own email, since I just found out what my error was. From a regular expression howto: http://www.amk.ca/python/howto/regex/regex.html The match() function only checks if the RE matches at the beginning of the string while search() will scan forward through the

Re: [Tutor] File like object for Windows registry

2006-08-03 Thread Henry Finucane
On 8/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello! My app should run on debian and windows platforms. For storing the configuration data, I use the ConfigParser module. What I find difficult is to determine a place for my configuration file. On debian, it is simply

Re: [Tutor] File like object for Windows registry

2006-08-03 Thread Andre Roberge
On 8/3/06, Henry Finucane [EMAIL PROTECTED] wrote: On 8/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello! My app should run on debian and windows platforms. For storing the configuration data, I use the ConfigParser module. What I find difficult is to determine a place for my

Re: [Tutor] File like object for Windows registry

2006-08-03 Thread Henry Finucane
On 8/3/06, Andre Roberge [EMAIL PROTECTED] wrote: On 8/3/06, Henry Finucane [EMAIL PROTECTED] wrote: On 8/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello! My app should run on debian and windows platforms. For storing the configuration data, I use the ConfigParser module.

Re: [Tutor] File like object for Windows registry

2006-08-03 Thread Alan Gauld
My app should run on debian and windows platforms. Hard lines :-( For storing the configuration data, I use the ConfigParser module. What I find difficult is to determine a place for my configuration file. Config parser basically produces an .in file. The rules that Windows uses to locate

Re: [Tutor] critique my script!

2006-08-03 Thread Christopher Spears
I rewrote my code with Alan's suggestions in mind. #!/usr/bin/python import os, os.path, glob def glob_files(pattern, base_path = '.'): abs_base = os.path.abspath(base_path) #path_list = [] #path_list.append(abs_base) globbed_dict = {} cwd = os.getcwd()

Re: [Tutor] critique my script!

2006-08-03 Thread Alan Gauld
Under the LearningToProgram directory is a test directory that doesn't contain any .pyc files, so the script's returned value is correct. However, .pyc files exist in the LearningToProgram directory, and I would like to put those files in the dictionary too. Is there an elegant way to

Re: [Tutor] critique my script!

2006-08-03 Thread Python
(Sorry about accidental posting before I had finished editing.) On Thu, 2006-08-03 at 15:37 -0700, Christopher Spears wrote: I rewrote my code with Alan's suggestions in mind. #!/usr/bin/python import os, os.path, glob def glob_files(pattern, base_path = '.'): abs_base =

Re: [Tutor] critique my script!

2006-08-03 Thread Python
On Thu, 2006-08-03 at 15:37 -0700, Christopher Spears wrote: I rewrote my code with Alan's suggestions in mind. #!/usr/bin/python import os, os.path, glob def glob_files(pattern, base_path = '.'): abs_base = os.path.abspath(base_path) #path_list = []

Re: [Tutor] critique my script!

2006-08-03 Thread Python
On Fri, 2006-08-04 at 00:26 +0100, Alan Gauld wrote: Under the LearningToProgram directory is a test directory that doesn't contain any .pyc files, so the script's returned value is correct. However, .pyc files exist in the LearningToProgram directory, and I would like to put those

Re: [Tutor] Binary fractions, recommendations?

2006-08-03 Thread Liam Clarke
Hmmm, and then I could use struct to swing it back... so, I'll be using string slices to model bitshifting then. Always found it quite strange that working mathematically with binary is so hard in programming languages. Even in Scheme, which will happily play with imaginary numbers. Regards,

Re: [Tutor] critique my script!

2006-08-03 Thread Kent Johnson
Christopher Spears wrote: I rewrote my code with Alan's suggestions in mind. #!/usr/bin/python import os, os.path, glob def glob_files(pattern, base_path = '.'): abs_base = os.path.abspath(base_path) #path_list = [] #path_list.append(abs_base) globbed_dict = {}

[Tutor] critique my script again!

2006-08-03 Thread Christopher Spears
Here is the complete script with documentation: #!/usr/bin/python #This script prompts the user for a path and a glob pattern. #The script firsts looks in the directory denoted by the path #for a matching file. If a match is found, the path and file are added #to a dictionary as a key and