Re: wxStyledTextCtrl - Dead?

2006-04-10 Thread David Rasmussen
Dave Mandelin wrote: > I don't know the answers to 1 and 2, but from the demo I know that the > answer to 3 is wx.stc.StyledTextControl. > > As for 4, I guess it depends on what you want to do. StyledTextControl > looked pretty scary to me, and for my application I mainly needed to > display style

Re: import help

2006-04-10 Thread placid
Dennis Lee Bieber wrote: > On 10 Apr 2006 20:55:31 -0700, "placid" <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > > > > > > Traceback (most recent call last): > > File "LinkedList.py", line 7, in ? > > main() > > File "LinkedList.py", line 4, in main > > n = Node

Re: using vim as a python class/module/function etc.. browser

2006-04-10 Thread Robert Kern
Chris Jones wrote: > Robert Kern wrote: >>Of course, modern versions of Exuberant Ctags also support Python, too. > > I apt-installed this package but the man page is rather intimidating so > I thought I might as well make sure I was going in the right direction. You will probably want to read

Re: Python 3.0 or Python 3000?

2006-04-10 Thread Sergei Organov
Robert Kern <[EMAIL PROTECTED]> writes: > Sergei Organov wrote: >> Dennis Lee Bieber <[EMAIL PROTECTED]> writes: >> >>>On Mon, 10 Apr 2006 12:12:58 +0200, Benjamin Niemann <[EMAIL PROTECTED]> >>>declaimed the following in comp.lang.python: [...] >> Anyway, it's unfair to speak of one of the most w

Re: Python 3.0 or Python 3000?

2006-04-10 Thread Robert Kern
Sergei Organov wrote: > Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > >>On Mon, 10 Apr 2006 12:12:58 +0200, Benjamin Niemann <[EMAIL PROTECTED]> >>declaimed the following in comp.lang.python: >> >>>That's actually the versioning scheme of TeX, currently being at 3.141592 >> >> My last expo

Re: Programming Tutorial for absolute beginners

2006-04-10 Thread Frank Millman
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Frank Millman > wrote: > > > Then you can mention that, if they just want the integer portion, they > > can use int(3/2). I think that most people with the slightest > > understanding of basic arithmetic will relate to this without a > > pr

Re: Python 3.0 or Python 3000?

2006-04-10 Thread Sergei Organov
Dennis Lee Bieber <[EMAIL PROTECTED]> writes: > On Mon, 10 Apr 2006 12:12:58 +0200, Benjamin Niemann <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >> >> That's actually the versioning scheme of TeX, currently being at 3.141592 > >My last exposure to TeX was some 15 od

Re: can't pass command-line arguments

2006-04-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Duncan Booth <[EMAIL PROTECTED]> wrote: >Windows variants such as NT/2000/XP are not based on MS-DOS in any way. Then why are Windows system files still restricted to 8.3 names? Doesn't that restriction derive from a core MS-DOS-based kernel? -- http://mail.pyth

Re: import help

2006-04-10 Thread placid
so there is a record of this problem i had, to solve this problem either use import node . . . n = node.Node("test") or from node import * . . . n = Node("test") Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting a list of objects by multiple attributes

2006-04-10 Thread nghoffma
If you are lambda-phobic (as I am) this should also work for an arbitrary set of attributes: attrs = 'attr1 attr2 attr3'.split() sortlist = [[getattr(o,a) for a in attrs] + [o] for o in objects] sorted_objects = [x[-1] for x in sorted(sortlist)] -Noah -- http://mail.python.org/mailman/listinfo/

Re: using vim as a python class/module/function etc.. browser

2006-04-10 Thread Chris Jones
Robert Kern wrote: > Chris Jones wrote: > >>I'm trying to make sense of a python program and was wondering if vim >>has any python-oriented functionalities (apart from syntax highlighting) >>that would make it somewhat easier to browse the source code. >> >>What I had in mind is something that w

Re: Help on exceptions (was: Convertion of Unicode to ASCII NIGHTMARE)

2006-04-10 Thread Roger Binns
"Serge Orlov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It can be like this. Notice special url, it is pointing to a > non-existing :) tutorial about why concatenating byte strings with > unicode strings can produce UnicodeDecodeError An alternate is to give an error code that

BayPIGgies: April 13, 7:30pm (IronPort)

2006-04-10 Thread Aahz
The next meeting of BayPIGgies will be Thurs, April 13 at 7:30pm at IronPort. This meeting features JJ reviewing "Professional Software Development" with discussion and newbie questions afterward. BayPIGgies meetings alternate between IronPort (San Bruno, California) and Google (Mountain View, C

Backing Up VMWare

2006-04-10 Thread D
Hello - has anyone written a Python script to backup VMWare servers? If so, I'd appreciate any pointers as to how to go about doing so. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: import help

2006-04-10 Thread placid
Scott David Daniels wrote: > placid wrote: > > I have the following class code for a Node for a Linked List, (saved in > > node.py) > > > > class Node : > > def __init__(self,element): > >self.element = element > >self.next = None > > > > then i have another module called Link

Re: Saving files from post data via sys.stdin

2006-04-10 Thread ACB
> form = cgi.FieldStorage() > > for k in form.keys(): > do_something_with(form, k) > >> Is there some class that can take this input and make it easier to deal >> with? > > A dictionary. > > I need to >> save each of the ulimage values as individual images and gain access to >> the values of s

Re: updated pre-PEP: The create statement

2006-04-10 Thread Michael Spencer
Steven Bethard wrote: > Azolex wrote: >> Steven Bethard wrote: >>> and named, nested hierarchies like XML documents could be created >>> like:: >>> >>> create ETobject html: >>> "This statement would generate an ElementTree object" >>> >>> create ETobject head: >>> "

Re: TypeError + generator + str.join(): Bug or user error?

2006-04-10 Thread Tim Peters
[Paul Du Bois] > Using win32 python 2.4.1, I have a minimal test program: > > def generate(): > raise TypeError('blah') > yield "" > > print "\n".join((generate())) > > Executing the program gives: > > Traceback (most recent call last): > File "", line 5, in ? > TypeError: sequence expect

How to initiate HotSync of Palm device?

2006-04-10 Thread dylpkls91
I am writing a program that uses the Palm handheld as a sort of input device. However, the code that communicates with it thru the serial port locks the port up, so if the user initiates a HotSync on the device, the operation fails. I would like to have a setup where the user presses a button on my

waiting for file lock?

2006-04-10 Thread s99999999s2003
hi i need to go into a directory to grab some files and do some processing. The thing is, i need to wait till the process that generates the files in that directory to finish before i can grab the files. eg if file A is being generated and has not finished, my python script will not go into the dir

Re: using vim as a python class/module/function etc.. browser

2006-04-10 Thread Robert Kern
Chris Jones wrote: > I'm trying to make sense of a python program and was wondering if vim > has any python-oriented functionalities (apart from syntax highlighting) > that would make it somewhat easier to browse the source code. > > What I had in mind is something that would let me use CTRL+] t

Re: writing captcha image file

2006-04-10 Thread amaltasb
I get this msg: Traceback (most recent call last): File "/usr/local/apache/cgi-bin/newuser.cgi", line 61, in ? cstatus = im.save(file_name,'JPEG') File "/usr/local/lib/python2.4/PIL/Image.py", line 1299, in save fp = __builtin__.open(fp, "wb") IOError: [Errno 13] Permission denied: '/us

Re: Decorators, Identity functions and execution...

2006-04-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Roy Smith <[EMAIL PROTECTED]> wrote: >One of the most basic >maxims on the Internet has always been, "Be liberal in what you accept, be >conservative in what you produce". How do you explain top-posting, then? -- http://mail.python.org/mailman/listinfo/python-l

Re: Decorators, Identity functions and execution...

2006-04-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Carl Banks" <[EMAIL PROTECTED]> wrote: >Always use spaces when posting, and use them in your code as well. >Spaces are the current recommended practice, and in the future tabs >might become illegal. I'd prefer tabs myself, but it's more important >to respect comm

Re: how relevant is C today?

2006-04-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Roy Smith <[EMAIL PROTECTED]> wrote: >I would add to that list PostScript. Most people think of it as just >format for print files, but it's a a real general-purpose programming >language, and a cool one at that (with an clear similarity to FORTH). Having used

using vim as a python class/module/function etc.. browser

2006-04-10 Thread Chris Jones
I'm trying to make sense of a python program and was wondering if vim has any python-oriented functionalities (apart from syntax highlighting) that would make it somewhat easier to browse the source code. What I had in mind is something that would let me use CTRL+] to automatically display what

Re: how relevant is C today?

2006-04-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, bruno at modulix <[EMAIL PROTECTED]> wrote: >gregarican wrote: >> Here are a few languages I recommend most programmers should at least >> have a peek at: >> >(snip) >> 2) Lisp - Along with FORTRAN, one of the oldest programming languages >> still in use. Pure fun

Python/up2date error on RHEL4

2006-04-10 Thread Dayton Jones
I'm trying to run up2date and keep getting: Traceback (most recent call last): File "/usr/sbin/up2date", line 27, in ? from up2date_client import repoDirector File "/usr/share/rhn/up2date_client/repoDirector.py", line 5, in ? import rhnChannel File "/usr/share/rhn/up2date_client

Re: import help

2006-04-10 Thread Scott David Daniels
placid wrote: > I have the following class code for a Node for a Linked List, (saved in > node.py) > > class Node : > def __init__(self,element): >self.element = element >self.next = None > > then i have another module called LinkedList.py, with following code > > import sys

TypeError + generator + str.join(): Bug or user error?

2006-04-10 Thread Paul Du Bois
Using win32 python 2.4.1, I have a minimal test program: def generate(): raise TypeError('blah') yield "" print "\n".join((generate())) Executing the program gives: Traceback (most recent call last): File "", line 5, in ? TypeError: sequence expected, generator found replacing TypeEr

writing captcha image file

2006-04-10 Thread amaltasb
I have a script which generates captcha file on /usr/local/apache/htdocs/captcha directory. The script is working fine when i execute it from terminal> >/usr/local/bin/python generateCaptcha.cgi > and it writes to /htdocs/captcha >directory but when I execute the script through http://www.mydomai

Re: Saving files from post data via sys.stdin

2006-04-10 Thread James Stroud
ACB wrote: > I am rewriting an existing PERL script I wrote several months ago. It is a > script that is used as the action for a form containing several type="file" > inputs. The script is run unbuffered and writes the data from sys.stdin to > a file which is stat'ed by another script called

Re: updated pre-PEP: The create statement

2006-04-10 Thread Steven Bethard
Azolex wrote: > Steven Bethard wrote: >> and named, nested hierarchies like XML documents could be created >> like:: >> >> create ETobject html: >> "This statement would generate an ElementTree object" >> >> create ETobject head: >> "generate the head" >>

Re: Best Python web-hosting?

2006-04-10 Thread John Salerno
walterbyrd wrote: > And they have mod_python. You sure about that? I've learned to be skeptical, because a lot of hosts don't even seem to understand the difference between supporting "Python" (which in reality is just CGI for them) and mod_python. In fact, I've even been told that a host *do

Saving files from post data via sys.stdin

2006-04-10 Thread ACB
I am rewriting an existing PERL script I wrote several months ago. It is a script that is used as the action for a form containing several type="file" inputs. The script is run unbuffered and writes the data from sys.stdin to a file which is stat'ed by another script called asyncornously from

Re: how to pipe to variable of a "here document"

2006-04-10 Thread gry
http://www.python.org/doc/topics/database/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting a list of objects by multiple attributes

2006-04-10 Thread gry
For multiple keys the form is quite analogous: L.sort(key=lambda i: (i.whatever, i.someother, i.anotherkey)) I.e., just return a tuple with the keys in order from your lambda. Such tuples sort nicely. -- George Young -- http://mail.python.org/mailman/listinfo/python-list

Help on exceptions (was: Convertion of Unicode to ASCII NIGHTMARE)

2006-04-10 Thread Serge Orlov
ChaosKCW wrote: > Ok I get it now. Sorry for the slowness. I have to say as a lover of > python for its simplicity and clarity, the charatcer set thing has been > harder than I would have liked to figure out. I think there is a room for improvement here. In my opinion the message is too confusing

Sorting a list of objects by multiple attributes

2006-04-10 Thread Steve Bergman
Hi, I am trying to come up with a clean and simple way to sort a list of objects (in this case SQLObject instances) by multiple attributes. e.g. a Person object may have an age, a lastName, and a firstName. I'd like to be able to arbitrarily sort by any combination of those in any order. I woul

import help

2006-04-10 Thread placid
Hi all, I have the following class code for a Node for a Linked List, (saved in node.py) class Node : def __init__(self,element): self.element = element self.next = None then i have another module called LinkedList.py, with following code import sys import node def main():

Re: How to write a python program to export the help document to a file?

2006-04-10 Thread Trent Mick
[boyeestudio wrote] > How to write a python program to export the help document to a file? > for example: >I need the os document,I use: > >>>import os > >>>help(os) > then it will show me all about os.But I need it redirect to a file. > How to do that? $ pydoc os > os.txt Trent -- Tren

How to write a python program to export the help document to a file?

2006-04-10 Thread boyeestudio
How to write a python program to export the help document to a file? for example:    I need the os document,I use: >>>import os >>>help(os) then it will show me all about os.But I need it redirect to a file. How to do that? Thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list

Re: python on Mac

2006-04-10 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: >Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > >> In article <[EMAIL PROTECTED]>, >> "pierreth" <[EMAIL PROTECTED]> wrote: >> >> >You removed /usr/bin/python! This is a really bad idea >> >> Is there any way to put it

Re: Best Python web-hosting?

2006-04-10 Thread walterbyrd
John Salerno wrote: > I was testing out http://www.devisland.net/ and it's pretty nice. They > installed the latest versions of Python, mod_python and mysqldb at my > request, and support was good. Only real problem is it's too expensive > for the space you get (about $5/month for 100MB), but you s

Re: Best Python web-hosting?

2006-04-10 Thread walterbyrd
John Salerno wrote: > I was testing out http://www.devisland.net/ and it's pretty nice. They > installed the latest versions of Python, mod_python and mysqldb at my > request, and support was good. Only real problem is it's too expensive > for the space you get (about $5/month for 100MB), but you s

Re: jpype and zxJDBC

2006-04-10 Thread Kent Johnson
benchline wrote: > So, I decided to try to see if I could use jdbc from cpython using > jpype and that works great. It's quite a bit faster then using jython > and the db api on the same database my tests too. Did you compare jpype/jdbc with jython/jdbc? I wonder if the slowdown might be in zxJ

Re: Programming Tutorial for absolute beginners

2006-04-10 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Frank Millman wrote: > Why not think to the future, and do it like this. Instruct the reader > to enter 'from __future__ import division'. You do not have to explain > the details, just say that this is the way division will work in the > future, and this statement will eve

Re: python on Mac

2006-04-10 Thread Alex Martelli
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > "pierreth" <[EMAIL PROTECTED]> wrote: > > >You removed /usr/bin/python! This is a really bad idea > > Is there any way to put it back, short of a full system reinstall? There's a free 3rd party tool known as Pac

Re: jpype and zxJDBC

2006-04-10 Thread benchline
No luck yet with the python db api. I keep getting this error when trying to create a com.ziclix.python.sql.PyConnection object: File "/usr/lib/python2.4/site-packages/jpype/_jpackage.py", line 53, in __call__ raise TypeError, "Package "+self.__name+" is not Callable" TypeError: Package com

Re: scipy/numpy inverse cumulative normal

2006-04-10 Thread noonoo
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > [EMAIL PROTECTED] wrote: > > I was wondering if scipy/numpy has the inverse cumulative normal > > function, ie the function f in this expression > > > > f(scipy.stats.norm.cdf(1.2)) = 1.2 > > > > or more generally, a function f which f

Re: challenging (?) metaclass problem

2006-04-10 Thread Peter Otten
[EMAIL PROTECTED] wrote: > I have what in my eyes seems a challenging problem. > Thanks to Peter Otten, i got the following code to work. It is a sort > of named tuple. Don't trust code posted in a newsgroup -- it may sometimes be quality-challenged :-) > Now my problem is the following. I want

Re: Python Shell window

2006-04-10 Thread jay graves
> find the errand CMD prompt and move it. errand -> errant -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling Web Services from Python

2006-04-10 Thread Robert Boyd
On 4/7/06, Ivan Zuzak <[EMAIL PROTECTED]> wrote: [snip] > I need a package/tool that generates web service proxies that will do > all the low-level HTTP work. (Someting like the WSDL.EXE tool in .NET > Framework) The ZSI and SOAPy packages [1] that i found (should) have > those functionalities but

Re: Python Shell window

2006-04-10 Thread jay graves
Jay wrote: > Is their any way of setting wear the Python Shell window appears on the > screen when I run my program? > > I am testing a full screen program with no Window Frame on a comp with > 2 monitors and I have to keep pressing the Key to bring the > Shell to the front and then moving it manu

Re: wxStyledTextCtrl - Dead?

2006-04-10 Thread Dave Mandelin
I don't know the answers to 1 and 2, but from the demo I know that the answer to 3 is wx.stc.StyledTextControl. As for 4, I guess it depends on what you want to do. StyledTextControl looked pretty scary to me, and for my application I mainly needed to display styled text, not edit it, so I embedde

swig-style utility

2006-04-10 Thread Philippe Martin
Hi, I need to add a feature to an existing C wrapper that is not based on swig (pycsc:http://homepage.mac.com/jlgiraud/pycsc/Pycsc.html) I'm not the best with C wrapper and would love it if there were some type of utility that would generate the correct code (most) for a specific C function that

Re: GridBagSizer

2006-04-10 Thread Dave Mandelin
Probably just that GridBagSizer is complicated and confusing, and you can usually get what you want more easily and maintainably by nesting simpler sizers like Box and FlexGrid. -- Want to play tabletop RPGs with your friends online? Try RPZen: http://koboldsoft.com -- ht

Re: Problem embedding Python...

2006-04-10 Thread Dave Mandelin
> C:\DOCUME~1\ANDY~1.MCC\LOCALS~1\Temp/cckhbaaa.o(.text+0x2b):main.cpp: > undefined reference to `_imp__Py_Initialize' These errors indicate that the linker can't find the Python library (python24.lib). > -L"C:\Python24\Lib" I think you want to say -L"C:\Python24\Libs" instead. 'libs' contains

Re: Tkinter problem on Mac OS X

2006-04-10 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Andrew Trevorrow) wrote: > Our app uses embedded Python to allow users to run arbitrary scripts. > Scripts that import Tkinter run fine on Windows, but on Mac OS X there > is a serious problem. After a script does "root = Tk()" our app's menus

Re: newbie to SWIG/Python

2006-04-10 Thread Steve Juranich
Vasya wrote: > Hello, > > I have an API represented in a C header file. I ran SWIG over > this hedaer fiel and generated a .py (python file) and a .c. If I write > a Python script against this API how do I "link" the Python script with > the SWIG-generated files?? > > Thanks, Vasili > ht

Re: "Locate" command in Python

2006-04-10 Thread BartlebyScrivener
>>45.9 mb Yikes. I keep all of my data files on a separate logical drive. I indexed only that one. I'm going to try and figure a way to store the results of os.walk(root) as a shelve, and then search it that way. In the meantime, you might try the script we were playing with in the previous thre

Re: newbie: Need Help Moving Data from Kirbybase to Gadfly

2006-04-10 Thread dc
I have muddle through this and gotten my script to work. Corrected code attached. # get global modules for python import os import sys #get database manager module from kirbybase import KirbyBase, KBError # open a database, embedded db = KirbyBase() result=db.select('test2.tbl', ['recno'],['*'

newbie to SWIG/Python

2006-04-10 Thread Vasya
Hello, I have an API represented in a C header file. I ran SWIG over this hedaer fiel and generated a .py (python file) and a .c. If I write a Python script against this API how do I "link" the Python script with the SWIG-generated files?? Thanks, Vasili -- http://mail.python.org/mailman/

Re: "Locate" command in Python

2006-04-10 Thread mwt
On my system, files.cache ended up being 45.9 Mb (800,000+ lines)! Pretty fun script. I can imagine some interesting variations. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: how relevant is C today?

2006-04-10 Thread David Rasmussen
Thomas Bellman wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > >> "const" is in C89/C90. > > Although with slightly different semantics from in C++... For > instance: > > static const int n = 5; > double a[n]; > > is valid C++, but not valid C. > There are other difference

Re: how relevant is C today?

2006-04-10 Thread David Rasmussen
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > David Rasmussen <[EMAIL PROTECTED]> wrote: > >> In my everyday work, I am forced to use a C90 only compiler, and >> everyday I miss some C++ feature that wouldn't make my program any more >> complex, quite the opposite. These are fe

Re: best way to install python modules on linux

2006-04-10 Thread Harry George
Fabian Braennstroem <[EMAIL PROTECTED]> writes: > Hi, > > I am pretty new to python and will use it mainly in > combination with scientific packages. I am running ubuntu > breezy right now and see that some packages are out of date. > Do you have any suggestion, how I can get/keep the latest > py

Re: DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE

2006-04-10 Thread Harry George
"geletine" <[EMAIL PROTECTED]> writes: > Nobody has mentioned that c was proprietary until richard stallman > wrote gcc in 1987, c is a great for system programming. Just because > something is originally proprietary does not mean its technically > rubbish, there are plenty of merits in java escia

Re: Is there a Python MVC that works just as well with just CGI, or FCGI?

2006-04-10 Thread Damjan
TurboGears? www.turbogears.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem Dynamic Loading Linux C++ .so module using python2.4

2006-04-10 Thread Roman Yakovenko
On 10 Apr 2006 12:42:28 -0700, liam_herron <[EMAIL PROTECTED]> wrote: > I have compiled my boost-enabled C++ module and have it working when I > explicity set my LD_LIBRARY_PATH before invoking the python2.4 > interpreter. Now I don't want everyone to have to set this environment > variable so I w

Problem Dynamic Loading Linux C++ .so module using python2.4

2006-04-10 Thread liam_herron
I have compiled my boost-enabled C++ module and have it working when I explicity set my LD_LIBRARY_PATH before invoking the python2.4 interpreter. Now I don't want everyone to have to set this environment variable so I would like to devise a way that the module can load itself. My attempt was to

Re: unboundlocalerror with cgi module

2006-04-10 Thread Tim Hochberg
Kent Johnson wrote: > Tim Hochberg wrote: > >>Kent Johnson wrote: >> >>>David Bear wrote: >>> >>> I'm attempting to use the cgi module with code like this: import cgi fo = cgi.FieldStorage() # form field names are in the form if 'name:part' keys = fo.keys() for i in ke

Re: HTMLParser fragility

2006-04-10 Thread John J. Lee
"Lawrence D'Oliveiro" <[EMAIL PROTECTED]> writes: > I've been using HTMLParser to scrape Web sites. The trouble with this > is, there's a lot of malformed HTML out there. Real browsers have to be > written to cope gracefully with this, but HTMLParser does not. Not only > does it raise an except

Re: unboundlocalerror with cgi module

2006-04-10 Thread Fredrik Lundh
"David Bear" wrote: > I'm attempting to use the cgi module with code like this: > > import cgi > fo = cgi.FieldStorage() > # form field names are in the form if 'name:part' > keys = fo.keys() > for i in keys: > try: > item,value=i.split(':') > except NameError, Unbo

Re: unboundlocalerror with cgi module

2006-04-10 Thread Tim Hochberg
Tim Hochberg wrote: > Kent Johnson wrote: > >>David Bear wrote: >> >> >>>I'm attempting to use the cgi module with code like this: >>> >>>import cgi >>>fo = cgi.FieldStorage() >>># form field names are in the form if 'name:part' >>>keys = fo.keys() >>>for i in keys: >>> try: >>>

Re: unboundlocalerror with cgi module

2006-04-10 Thread Kent Johnson
Tim Hochberg wrote: > Kent Johnson wrote: >> David Bear wrote: >> >>> I'm attempting to use the cgi module with code like this: >>> >>> import cgi >>> fo = cgi.FieldStorage() >>> # form field names are in the form if 'name:part' >>> keys = fo.keys() >>> for i in keys: >>>try: >>>

Dr. Dobb's Python-URL! - weekly Python news and links (Apr 10)

2006-04-10 Thread Peter Otten
QOTW: "You need 23 C/C++ people to do the job of one Pythoneer ;-)" - Jorge Godoy "I've never seen an 'object-relational mapping' ... which doesn't drive me into a murderous, foam-at-mouth rage in a very short time." - Alex Martelli Python objects may be equal and unequal at the same time if

Re: unboundlocalerror with cgi module

2006-04-10 Thread Tim Hochberg
Kent Johnson wrote: > David Bear wrote: > >>I'm attempting to use the cgi module with code like this: >> >>import cgi >>fo = cgi.FieldStorage() >># form field names are in the form if 'name:part' >>keys = fo.keys() >>for i in keys: >>try: >>item,value=i.split(':') >>

Re: About classes and OOP in Python

2006-04-10 Thread Gregor Horvath
Hi, fyhuang schrieb: > I've been wondering a lot about why Python handles classes and OOP the > way it does. From what I understand, there is no concept of class > encapsulation in Python, i.e. no such thing as a private variable. Any the answer is here: http://tinyurl.com/obgho -- Mit freund

Re: python interpreter widget for Tkinter?

2006-04-10 Thread Ian Parker
In message <[EMAIL PROTECTED]>, Alexandre Guimond <[EMAIL PROTECTED]> writes >Hi i was wondering if there already existed a simple python interpreter >widget for tkinter? Basically, i would like to be able to lauch a >python interpreter in a seperate window from my tkinter app for >debugging purpo

Re: very strange problem in 2.4

2006-04-10 Thread conor . robinson
Ok, so I found out that even though mylist[] and all objects in it were fine ie id(mylist[i]) != id(mylist[all others]) what was happening is that during a reproduction function a shallow copies were being made making all offspring (genetic algorithm) have different id(mylist[0..n]), however the ac

Re: very strange problem in 2.4

2006-04-10 Thread conor . robinson
Ok, so I found out that even though mylist[] and all objects in it were fine ie id(mylist[i]) != id(mylist[all others]) what was happening is that during a reproduction function a shallow copies were being made making all offspring (genetic algorithm) have different id(mylist[0..n]), however the ac

Re: very strange problem in 2.4

2006-04-10 Thread conor . robinson
Ok, so I found out that even though mylist[] and all objects in it were fine ie id(mylist[i]) != id(mylist[all others]) what was happening is that during a reproduction function a shallow copies were being made making all offspring (genetic algorithm) have different id(mylist[0..n]), however the ac

Re: very strange problem in 2.4

2006-04-10 Thread conor . robinson
Ok, so I found out that even though mylist[] and all objects in it were fine ie id(mylist[i]) != id(mylist[all others]) what was happening is that during a reproduction function a shallow copies were being made making all offspring (genetic algorithm) have different id(mylist[0..n]), however the ac

Re: very strange problem in 2.4

2006-04-10 Thread conor . robinson
Ok, so I found out that even though mylist[] and all objects in it were fine ie id(mylist[i]) != id(mylist[all others]) what was happening is that during a reproduction function a shallow copies were being made making all offspring (genetic algorithm) have different id(mylist[0..n]), however the ac

Re: unboundlocalerror with cgi module

2006-04-10 Thread Kent Johnson
David Bear wrote: > I'm attempting to use the cgi module with code like this: > > import cgi > fo = cgi.FieldStorage() > # form field names are in the form if 'name:part' > keys = fo.keys() > for i in keys: > try: > item,value=i.split(':') > except NameError, Unboun

Re: unboundlocalerror with cgi module

2006-04-10 Thread Felipe Almeida Lessa
Em Seg, 2006-04-10 às 11:29 -0700, David Bear escreveu: > However, the except block does not seem to catch the exception and an > unboundlocalerror is thrown anyway. What am I missing? See http://docs.python.org/tut/node10.html : """ A try statement may have more than one except clause, to specif

Re: How can I reduce the number of queries to my PostgreSQL database?

2006-04-10 Thread Alan Morgan
In article <[EMAIL PROTECTED]>, SR <[EMAIL PROTECTED]> wrote: >As a starter project for learning Python/PostgreSQL, I am building a >Books database that stores information on the books on my bookshelf. > >Say I have three tables. > >Table "books" contains rows for book_id, title, subtitle, ISBN. >

unboundlocalerror with cgi module

2006-04-10 Thread David Bear
I'm attempting to use the cgi module with code like this: import cgi fo = cgi.FieldStorage() # form field names are in the form if 'name:part' keys = fo.keys() for i in keys: try: item,value=i.split(':') except NameError, UnboundLocalError: print "ex

Python Shell window

2006-04-10 Thread Jay
Is their any way of setting wear the Python Shell window appears on the screen when I run my program? I am testing a full screen program with no Window Frame on a comp with 2 monitors and I have to keep pressing the Key to bring the Shell to the front and then moving it manually to the other scre

RE: python + access + odbc + linux

2006-04-10 Thread Philippe Martin
Thanks TIM. Philippe Tim Golden wrote: > [Philippe Martin] > > | I understand that access can be accessed through an ODBC driver under > | windows (instead of Jet). > | > | I am wondering if the same can be done under Linux. > > You need to look at the mdbtools packages > > http://mdbtools

Re: minidom + wxPython woes

2006-04-10 Thread Lonnie Princehouse
I'm hesitant to resort to tricks like "import pyexpat before wx, so that symbols are loaded from the right library". Luckily, I stumbled onto pxdom. It's a pure-python DOM implementation, and switching to it was as easy as this: # import xml.dom.minidom as dom import pxdom as dom -- http://mai

Re: updated pre-PEP: The create statement

2006-04-10 Thread Azolex
Steven Bethard wrote: > I've updated the PEP based on a number of comments on comp.lang.python. > The most updated versions are still at: > > http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt > http://ucsu.colorado.edu/~bethard/py/pep_create_statement.html > > In this post, I

Re: [fcntl]how to lock a file

2006-04-10 Thread Carl J. Van Arsdall
You know, I spent some time with this module and had some interesting results. I had to do file locking over nfs using lockd. This poised an interested problem as I couldn't get the python fcntl module to work correctly via nfs even with lockd setup. Anyhow, I ended up writing an extention i

Re: how to make a generator use the last yielded value when it regains control

2006-04-10 Thread Lonnie Princehouse
In general, you're right - if speed is a concern, loops should be used instead of recursion in Python when possible. In this case, the recursive overhead is insignificant compared to the expense of iterating over the sequence at every iteration. By the time there are 70 stack frames of recursion

Re: Characters contain themselves?

2006-04-10 Thread Graham Fawcett
WENDUM Denis 47.76.11 (agent) wrote: > While testing recursive algoritms dealing with generic lists I stumbled > on infinite loops which were triggered by the fact that (at least for my > version of Pyton) characters contain themselves. [snip] > Leading to paradoxes and loops objects which contain

Re: how relevant is C today?

2006-04-10 Thread gregarican
Rune wrote: > No. Simula is the "original object oriented programming language". Thanks for pointing this out. I had read about references to Simula but never looked beyond the term itself. Interesting stuff. Especially since it was developed so long ago. Very interesting... -- http://mail.pyth

How to create a single executable console application?

2006-04-10 Thread Podi
I followed the instructions from http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable Copied the second setup.nsi, setup.py, single.py and everything works like a champ. I then replaced "single.exe" by "hello.exe" in setup.nsi. Created hello.py as follows: #! python def main():

Re: how to make a generator use the last yielded value when it regains control

2006-04-10 Thread Felipe Almeida Lessa
Em Seg, 2006-04-10 às 10:05 -0700, Lonnie Princehouse escreveu: > I happen to think the recursive version is more elegant, but that's > just me ;-) It may be elegant, but it's not efficient when you talk about Python. Method calls are expensive: $ python2.4 -mtimeit 'pass' 1000 loops, best of

Re: [fcntl]how to lock a file

2006-04-10 Thread marcello
thank you a lot for your answering Bye Marcello -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >