Re: [Tutor] REport Card Question

2010-11-30 Thread Alan Gauld
"Robert Sjöblom" wrote On a related note, do all functions implicitly contain "return None" in them? All functions return a value because thats the definition of what a function does. (Some languages have a construct known as a procedure which is a function with no return value, but Python do

Re: [Tutor] Package loading

2010-11-30 Thread Karim
On 11/30/2010 12:58 AM, Karim wrote: On 11/29/2010 09:15 PM, Karim wrote: Hello every one, I created a package with the following structure: * ops/ o __init__.py o tcl/ + __init__.py + pythontcl.py > *python -c "import sys; print sys.

Re: [Tutor] A regular expression problem

2010-11-30 Thread Josep M. Fontana
Sorry, something went wrong and my message got sent before I could finish it. I'll try again. On Tue, Nov 30, 2010 at 2:19 PM, Josep M. Fontana wrote: > On Sun, Nov 28, 2010 at 6:03 PM, Evert Rol wrote: > >> - >> with open('output_tokens.txt', 'a') as out_tokens: >>with open('text

Re: [Tutor] A regular expression problem

2010-11-30 Thread Josep M. Fontana
On Sun, Nov 28, 2010 at 6:14 PM, Steven D'Aprano wrote: > Have you considered just using the isalnum() method? > '¿de'.isalnum() > False Mmm. No, I didn't consider it because I didn't even know such a method existed. This can turn out to be very handy but I don't think it would help me at t

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread Walter Prins
Hello John On 29 November 2010 21:44, John Smith wrote: > Hi, Walter - > > Thanks for all the research. This was my second attempt at installing the > 2.4 version. I did it thus: > > E:\Python27\pyserial-2.4>..\python setup.py install > standart distutils > running install > running build > ru

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith
On 11/30/2010 10:37 AM, Walter Prins wrote: Hello John (snip) In any case, to fix it let's delete all instances of pySerial and then install it again, as follows: 1.) Open up your Python "site-packages" folder in Windows Explorer, e.g. open up: E:\Python27\lib\site-packages 2.) Delete any fol

[Tutor] How to handle exceptions raised inside a function?

2010-11-30 Thread Richard D. Moores
Please take a look at 2 functions I just wrote to calculate the harmonic and geometric means of lists of positive numbers: . Both Hlist and Glist must contain only positive numbers, so I really need to test for this inside each function. But is there a good w

Re: [Tutor] How to handle exceptions raised inside a function?

2010-11-30 Thread Jerry Hill
On Tue, Nov 30, 2010 at 3:00 PM, Richard D. Moores wrote: > Both Hlist and Glist must contain only positive numbers, so I really > need to test for this inside each function. But is there a good way to > do this? What should the functions return should a non-positive number > be detected? Is there

Re: [Tutor] How to handle exceptions raised inside a function?

2010-11-30 Thread Steven D'Aprano
Richard D. Moores wrote: Please take a look at 2 functions I just wrote to calculate the harmonic and geometric means of lists of positive numbers: . Both Hlist and Glist must contain only positive numbers, so I really need to test for this inside each func

Re: [Tutor] How to handle exceptions raised inside a function?

2010-11-30 Thread Patty
This is very interesting to me - the below excerpt is something I was trying to do for one of my programs and gave up on it: A fifth approach, common in some other languages, is to return some arbitrary value, and set an error flag. The caller then has to write code like this: result = funct

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread Walter Prins
Hello John, On 30 November 2010 16:57, John Smith wrote: > Hi, Walter - > > I did the above and then got this: > > >>> import serial > > > Traceback (most recent call last): > File "", line 1, in >import serial > File "E:\Python27\lib\site-packages\serial\__init__.py", line 18, in > >

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith
On 11/30/2010 6:23 PM, Walter Prins wrote: Hello John, (snip) Apparently so. Well, win32file is part of the PyWin32 package, which are a set of modules that wrap many Windows API's. I'm not sure why it was't/isn't required for PySerial 2.5 or whether as you say perhaps this module is include

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread Adam Bark
On 01/12/10 01:00, John Smith wrote: Hi, Walter - I got pywin32-214.win32-py2.7.exe because I have the Intel i7 (I'm guessing that the AMD versions are for the AMD processor). However, all of the exe offerings have the same "Python not found in registry" problem that started this whole thing

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread John Smith
On 11/30/2010 7:27 PM, Adam Bark wrote: On 01/12/10 01:00, John Smith wrote: Hi, Walter - I got pywin32-214.win32-py2.7.exe because I have the Intel i7 (I'm guessing that the AMD versions are for the AMD processor). However, all of the exe offerings have the same "Python not found in registry"

Re: [Tutor] Web Harvesting & AJAX/Javascript

2010-11-30 Thread Walter Prins
Hello Roy On 29 November 2010 19:42, Roy Hinkelman wrote: > Researching this has led me to PAMIE and Selenium. PAMIE is giving me > problems with permissions, and the discussion group appears to be fading > away. I have not tried Selenium yet. Both open a browser instance, and PAMIE > is quite s