Re: Little Q: how to print a variable's name, not its value?

2005-03-30 Thread Stewart Midwinter
thanks Aaron, I'll pick what's behind door no. 1 ! That is, I liked your first solution. Having said that, I would only have to place either solution once in my code, then I could call it again and again. So either one would be just as 'light' in actual usage. Taking this idea a little further,

Re: tkinter destroy()

2005-03-30 Thread [EMAIL PROTECTED]
Your app seems to give the right state values only if you select 'Freni a posto'. But I see you recognize that with your 'FIXME' note. also the app seems to have too many variables and widgets defined as self objects. That isn't necessary unless they will be used outside the method they were cr

Re: PyParsing module or HTMLParser

2005-03-30 Thread Lad
Paul, thanks a lot. It seems to work but I will have to study the sample hard to be able to do the exercise (the extraction of the description ) successfully. Is it possible to email you if I need some help with that exercise? Thanks again for help Lad. -- http://mail.python.org/mailman/listinfo

Re: math - need divisors algorithm

2005-03-30 Thread Ed Suominen
Philp Smith wrote: > Hi > > Does anyone have suggested code for a compact, efficient, elegant, most of > all pythonic routine to produce a list of all the proper divisors of an > integer (given a list of prime factors/powers) Is this compact enough? :-) def properDivisors(N): return [x for

Re: McMillan Installer vs. Python 2.4

2005-03-30 Thread Simon John
[EMAIL PROTECTED] wrote: [snip] > First, I got the latest Installer, 6a2, from the Vaults of Parnassus. > This version is listed as the 'Windows' version. This means two > things: The .py files are sprinkled with DOS-style line endings > (CR/LF) and file endings (^Z), and the runtime support fil

Re: Actor pattern in GUI

2005-03-30 Thread M Ali
Hmm... no takers? Too bad, the pattern and it's implementation in python is pretty interesting... [EMAIL PROTECTED] (M Ali) wrote in message news:<[EMAIL PROTECTED]>... > Hi, > > I am trying to grok using actor patterns in a gui as explained here by > Andrew Eland: > http://www.andreweland.org/co

Mac OS X Installer for Python 2.4.1 available

2005-03-30 Thread Anthony Baxter
Thanks to Bob Ippolito, there's now an installer for Python 2.4.1 available for Mac OS X 10.3 and later. Grab it from the Python 2.4.1 page - http://www.python.org/2.4.1/ Anthony -- http://mail.python.org/mailman/listinfo/python-list

Re: LD_LIBRARY_PATH - how to set?

2005-03-30 Thread Roman Yakovenko
Thanks for help. But it is not exactly solution I am looking for. I would like to do it from python script. For example update_env() #<- this function will change LD_LIBRARY_PATH import extension_that_depends_on_shared_library Roman On Mar 31, 2005 9:35 AM, John Abel <[EMAIL PROTECTED]> wrote: >

Pari Python

2005-03-30 Thread Philp Smith
Hi I'm interested to try Pari Python but haven't had much success in the past compiling such packages for Windows. Has anyone any advice or is there somewhere out there a precompiled version? Thanks Phil -- http://mail.python.org/mailman/listinfo/python-list

Re: math - need divisors algorithm

2005-03-30 Thread Philp Smith
excellent - thanks in the meantime I managed to write something myself which a)works b)looks reasonably elegant and pythonic but c) is recursive d) requires a mainroutine and co-routine I have a feeling if I analysed it it would prove to be relatively inefficient as I'm sure it creates

Re: Little Q: how to print a variable's name, not its value?

2005-03-30 Thread Aaron Bingham
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Restating: I'm doing some debugging of some code. I want to print out > the value of two variables whose names are known. Let's call them > myTime and myPlace. > > #debug: > if self.debug: >print "myTime = %s, myPlace = %s" % (myTime, myPlac

Re: LD_LIBRARY_PATH - how to set?

2005-03-30 Thread John Abel
With Solaris 8+ you would use the command crle, with Linux (RedHat/SuSE/Mandrake) you need to add the relevant directories /etc/ld.so.conf and run ldconfig. I've not got a Debian box to hand, so I can't say if it matches, but that should give you a pointer. HTH J Roman Yakovenko wrote: On Mar

Re: LD_LIBRARY_PATH - how to set?

2005-03-30 Thread Roman Yakovenko
On Mar 31, 2005 9:20 AM, John Abel <[EMAIL PROTECTED]> wrote: > What OS? Linux? Solaris? Does it matter? If so, please explain why ( lack of knowledge ) I am using Linux ( Debian Surge ) Thanks > J > > Roman Yakovenko wrote: > > >Hi. I have small problem. I need to load extension module th

Making a DLL with python?

2005-03-30 Thread jppx1
Can I use python to make a regular Windows DLL that will be called from other programs? I know I can use the win32 extensions to make a COM server, but I need a straight DLL. Regards, Phillip Phillip Piper A man's life does

Re: LD_LIBRARY_PATH - how to set?

2005-03-30 Thread John Abel
What OS? Linux? Solaris? J Roman Yakovenko wrote: Hi. I have small problem. I need to load extension module that depends on shared library. Before actually importing module I tried to edit os.environ or to call directly to os.putenv without any success - shared library was not found. I tried to s

Re: Weakrefs to classes that derive from str

2005-03-30 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > [Ron Garret] > > Thanks for the detailed explanation. I understand now why you can't > > create weakrefs to these types. What I don't understand still is why > > you can't create weakrefs to user-defined classes th

UnicodeEncodeError in string conversion

2005-03-30 Thread Maurice LING
Hi, I'm working on a script that searches a public database and retrives results using SOAP interface. However, it seems that the results may contains unicodes. When I try to pump the results into Firebird database using kinterbasdb module, some results will give me a UnicodeEncodeError. From w

Re: Little Q: how to print a variable's name, not its value?

2005-03-30 Thread [EMAIL PROTECTED]
my god, I've created a monster! Maybe I should restate my original problem. Actually, the word 'problem' is too strong. I had a little curiosity about whether I could write a couple of lines of code more succinctly, or more pythonically. I didn't realize that this would trigger a discussion abou

Re: Python List Issue

2005-03-30 Thread Greg Ewing
Nick L wrote: I noticed that with python lists, generally when you make a copy of a list (ie, List1 = List2) List1 just becomes a reference to List2 and any modifications done to List1 affects List2. Ok I can live with this but I want to make a completely seperate copy not attached to the original

Re: returning a list: IndexError

2005-03-30 Thread Steven Bethard
[EMAIL PROTECTED] wrote: Steven Bethard wrote: py> import numarray as na py> tbl = na.zeros((32, 16)) py> def get_value(): ... data = test() ... c1 = data[0] ... c2 = data[1] ... print tbl[c1, c2] ... py> def test(): ... t1 = 0x0 ... t2 = 0x1 ... return tbl[t1, t2] ... p

Re: math - need divisors algorithm

2005-03-30 Thread Tim Peters
[Philp Smith] > Does anyone have suggested code for a compact, efficient, elegant, most of > all pythonic routine to produce a list of all the proper divisors of an > integer (given a list of prime factors/powers) If the canonical factorization of N is the product of p_i**e_i, the number of diviso

Re: : Last Chance 2005 IORCC Entries

2005-03-30 Thread iorcc
Ivan Actually, it was simply an oversite by me, not by anyone else in the Ruby community. I hope you don't take offense to this simple mistake of mine. The contest is open (for another 12 hours or so) and nobody is discriminated against as you suggest. Pythonists are MOST welcome to contribute,

LD_LIBRARY_PATH - how to set?

2005-03-30 Thread Roman Yakovenko
Hi. I have small problem. I need to load extension module that depends on shared library. Before actually importing module I tried to edit os.environ or to call directly to os.putenv without any success - shared library was not found. I tried to search the Internet for the answer. The only approach

Re: return the last item in a list

2005-03-30 Thread Erik Max Francis
Raymond Hettinger wrote: I'm looking for an 'easy' way to have the last item in a list returned. Try mylist.pop() or mylist[-1]. Note that list.pop also removes the last element from the list in the process. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA

Re: Turn of globals in a function?

2005-03-30 Thread Greg Ewing
Oren Tirosh wrote: def noglobals(f): . import new . return new.function( . f.func_code, . {'__builtins__':__builtins__}, . f.func_name, . f.func_defaults, . f.func_closure . ) Be aware that this will render the function incapable of seeing *any* globals at all

Re: ossaudiodev full duplex

2005-03-30 Thread Greg Ewing
[EMAIL PROTECTED] wrote: fh= ossaudiodev.open("/dev/dsp", "rw") fh.setparameters(ossaudiodev.AFMT_S16_LE, number_of_channels, sample_rate) fh.writeall(frames_out) frames_in= fh.read(number_of_samples * sample_width) fh.close() One problem with this is that you can't use a single file object for ind

Re: mysteriously nonfunctioning script - very simple

2005-03-30 Thread Greg Ewing
Sean McIlroy wrote: I did try it, and it didn't work either. It appears there must be something wrong with my computer, hopefully something benign. Just a thought: Is your computer's clock set correctly? -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealan

Re: Python 2.4.1 build (configure) ?

2005-03-30 Thread Skip Montanaro
Venkat> When I checked the .py sources (in Lib folder) thru grep for Venkat> 'ipv6', I see the same references I'd see, if I ran the Venkat> configure command without the --enable-ipv6 option. Is that Venkat> normal or is there an issue I need to address here. Yes, it's normal.

AAC extracton

2005-03-30 Thread Lucas Raab
In a M4A file encoded with iTunes, persay, how does one extraction the AAC data?? I'm looking into a project using pymedia and I know it supports the AAC format, but how does the extraction of AAC data work?? Just going a certain number of bytes into the file?? TIA -- --

Re: problem running the cgi module

2005-03-30 Thread chris patton
Thanks for the help. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem running the cgi module

2005-03-30 Thread pythonUser_07
I will take a guess that you might 1) make sure cgi is enabled in your webserver configuration 2) Probably must place the cgi script under $WEBSERVERDOCS/cgi-bin unless you alter the configuration. Also, the webserver might need to be configured to understand what interpreter uses .py files. (not

Re: urllib.urlretireve problem

2005-03-30 Thread gene . tani
.from urllib2 import urlopen . try: . urlopen(someURL) . except IOError, errobj: .if hasattr(errobj, 'reason'): print 'server doesnt exist, is down, DNS prob, or we don't have internet connect' .if hasattr(errobj, 'code'): print errobj.code -- http://mail.python.org/mailma

Re: [Tkinter] LONG POST ALERT: Setting application icon on Linux

2005-03-30 Thread Jeff Epler
I have written a rather hackish extension to use NET_WM_ICON to set full-color icons in Tkinter apps. You can read about it here: http://craie.unpy.net/aether/index.cgi/software/01112237744 you'll probably need to take a look at the EWMH spec, too. If KDE supports NET_WM_ICON, this may work f

Re: Weakrefs to classes that derive from str

2005-03-30 Thread Raymond Hettinger
[Ron Garret] > Thanks for the detailed explanation. I understand now why you can't > create weakrefs to these types. What I don't understand still is why > you can't create weakrefs to user-defined classes that inherit from > these types. I would think that instances of user-defined classes have

Re: returning a list: IndexError

2005-03-30 Thread shama . bell
Steven Bethard wrote: > [EMAIL PROTECTED] wrote: > > from Numeric import * > > > > # Initialize the 32x16 global array to zeros > > tbl = zeros((32, 16) > > > > def getValue( value): > > data = test(value) > > c1 = data[0] > > c2 = data[1] > > print tbl[c1, c2] > > > > def test( va

Re: Suggesting methods with similar names

2005-03-30 Thread Terry Reedy
"Bengt Richter" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > BTW, when are we going to be able to write > > @classdeco > class Foo(object): That possibility is currently being discussed for 2.5 on the pydev list. There are mixed opinions, none yet from Guido that I noticed. Te

returning a list: IndexError

2005-03-30 Thread shama . bell
Hello, I am getting the following error when returning a list: return tbl[c1,c2] "IndexError: each subindex must be either a slice, an integer, Ellipsis, or NewAxis" What does it mean? Here's the code snippet from Numeric import * # Initialize the 32x16 global array to zeros tbl = zeros(

Re: McMillan Installer vs. Python 2.4

2005-03-30 Thread Simon John
[EMAIL PROTECTED] wrote: > 1. Does anyone know why McMillan Installer 5b5 does not work with > Python 2.4 under Linux (works with Python 2.3 just fine), and how to > fix it? I expect so. > 2. Will anyone be picking up the maintenance and development ball for > McMillan Installer? There was a 6a

Re: Suggesting methods with similar names

2005-03-30 Thread Bengt Richter
On Wed, 30 Mar 2005 17:55:32 GMT, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: >[Bearophile] >> Working in the interactive window I receive an error like >> this when I write the wrong method name: >> >> >>> table.addGlas() >> Traceback (most recent call last): >> File "", line 1, in ? >> Attr

Python plug-in Frameworks like Eclipse RCP...

2005-03-30 Thread Jim Hargrave
Eclipse provides a very nice application framework which supports plug-ins. It's easy to dynamically add new functionality, menu items, property editors, options etc.. using a combination of XML and Java code. Is there a similar framework for Python? If not any hints on how such a framework wou

Re: Using something other than ';' to separate statements

2005-03-30 Thread Michael Hoffman
Ivan Van Laningham wrote: Bad Michael. Bad, bad Michael. :( Well personally I consider it better to tell people of hacks like that with a warning not to use them than let them discover them on their own (without such a warning). Plus dubious Python hacks that should never be used in production cod

McMillan Installer vs. Python 2.4

2005-03-30 Thread mrmakent
3 quick questions for the newsgroup: 1. Does anyone know why McMillan Installer 5b5 does not work with Python 2.4 under Linux (works with Python 2.3 just fine), and how to fix it? 2. Will anyone be picking up the maintenance and development ball for McMillan Installer? 3. Is there another, bette

Python 2.4.1 build (configure) ?

2005-03-30 Thread Venkat B
Hi all, While building the latest 2.4.1 version for Linux/RH9, I wanted to enable IPV6 support (sockets). So, I ran the configure command ./configure --enable-ipv6 Then I ran the 'make' and 'make altinstall' commands. When I checked the .py sources (in Lib folder) thru grep for 'ipv6', I see the

Re: urllib.urlretireve problem

2005-03-30 Thread Skip Montanaro
>> For example, for Temporary Name Resolution Failure, python raises an >> exception which I've handled well. The problem lies with obsolete >> urls where no exception is raised and I end up having a 404 error >> page as my data. Diez> It makes no sense having urllib generatin

RE: IMAP4.search by message-id ?

2005-03-30 Thread Tony Meyer
> Can anyone tell me how to get a message's number from the message-id > using IMAP4.search? > I've tried this: > resp, items = server.search(None, 'HEADER', > '"Message-id"', msgID) but it gives me a 'bogus search criteria' error >>> import imaplib >>> i = imaplib.IMAP4("mail.example.com")

Re: returning a list: IndexError

2005-03-30 Thread Steven Bethard
[EMAIL PROTECTED] wrote: from Numeric import * # Initialize the 32x16 global array to zeros tbl = zeros((32, 16) def getValue( value): data = test(value) c1 = data[0] c2 = data[1] print tbl[c1, c2] def test( value): t1 = 0x0 t2 = 0x1 return tbl[t1, t2] In test, tbl[0x0,

Re: Weakrefs to classes that derive from str

2005-03-30 Thread Ron Garret
In article <[EMAIL PROTECTED]>, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: > [Ron Garret] > > Why doesn't this work? > > > > >>> from weakref import ref > > >>> class C(str): pass > > ... > > >>> ref(C()) > > Traceback (most recent call last): > > File "", line 1, in ? > > TypeError: cannot

problem running the cgi module

2005-03-30 Thread chris patton
Hi everyone. I'm trying to code an HTML file on my computer to make it work with the cgi module. For some reason I can't get it running. This is my HTML script: -- HOWDY! -- And here is

Re: Weakrefs to classes that derive from str

2005-03-30 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Peter Hansen <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > foo(int) > foo(float) > foo(dict) > foo(list) > foo(str) > > TypeError: cannot create weak reference to 'C' object > > > foo(tuple) > > TypeError: cannot create weak reference t

Re: More decorator rumination

2005-03-30 Thread Scott David Daniels
Jack Diederich wrote: On Wed, Mar 30, 2005 at 02:48:51PM -0800, Scott David Daniels wrote: In particular, I thought about something like: @mousexy def OnRightClick(self, x, y): ... so all event-responding methods tend to look like: def OnRightClick(self, event): x = event.Get

More decorator rumination

2005-03-30 Thread Scott David Daniels
Over on comp.python.education we were discussing a (generally seen as) misuse of decorators to build the definite integral of a function. On thinking over the definite integral decorator, I had almost decided that one necessary, but not sufficient, criterion for a good decorator is that it must not

Re: initialize a dictionary

2005-03-30 Thread Steven Bethard
[EMAIL PROTECTED] wrote: I need to iterate values by row and column as well. I tried this w,x = 32, 16 A = [ [0x0]*w for i in range(x)] print A py> import numarray py> print numarray.zeros((16, 8)) [[0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0] [

Re: Suggesting methods with similar names

2005-03-30 Thread bearophileHUGS
Diez B. Roggisch>it will make an object return always _something_ - and thus you don't catch misspellings in non-interactive< Uhm, I'm sorry, I don't understand you. If you look at the code I've just posted, you can see that it still raises AttributeError, the difference is just the error message.

Re: initialize a dictionary

2005-03-30 Thread shama . bell
The F.A.Q. does not explain how to create a 2 dimensional array and initialize it to zero. I need to iterate values by row and column as well. I tried this w,x = 32, 16 A = [ [0x0]*w for i in range(x)] print A It does not create a 2 dimensional array with 32 rows and 16 columns Thanks, -SB

pySerial- need help.

2005-03-30 Thread kamarudin samsudin
Hi all, I try to invoke python serial script via my browser using PHP (exec function). For the serial communication, i used pySerial module. It fine when it run it as root but when i try to run it from browser, i got this error in my httpd/error_log File "weather1.py", line 9, in ? ser=seri

Re: is there a problem on this simple code

2005-03-30 Thread jrlen balane
a simple question regarding threading and timer: if i put my timer control inside the thread, will the thread be exited every time there is a timer event??? please help... def someThreadHere() ... someTimer.start(3000) def someTimerEvent() . On Wed, 16 Mar 2005

Re: [maintenance doc updates]

2005-03-30 Thread "Martin v. Löwis"
Do Re Mi chel La Si Do wrote: But, for previous versions of Python, I downloaded a CHM version; and, at http://docs.python.org/download.html, I don't found this format. is this a lapse of memory? It is there now. Would it be possible to have a continuity in the availability of the formats? Unfor

Re: initialize a dictionary

2005-03-30 Thread Sean Blakey
On 30 Mar 2005 13:02:05 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > Can I do something like this? > > table = {} > table[32, 16] = 0x0 > > Where 32 specifies rows and 16 specifies columns and i am trying to > initialize it to zero > > I should be able to do comparisons like

initialize a dictionary

2005-03-30 Thread shama . bell
Hello, Can I do something like this? table = {} table[32, 16] = 0x0 Where 32 specifies rows and 16 specifies columns and i am trying to initialize it to zero I should be able to do comparisons like: table[t1, t2] == 0x1 etc. -SB -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools to iter transition

2005-03-30 Thread David M. Cooke
Steven Bethard <[EMAIL PROTECTED]> writes: > Terry Reedy wrote: >>>But if classmethods are intended to provide alternate constructors >> But I do not remember that being given as a reason for >> classmethod(). But I am not sure what was. > > Well I haven't searched thoroughly, but I know one plac

Re: Suggesting methods with similar names

2005-03-30 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I have a class Surface with many methods. Working in the interactive > window I receive an error like this when I write the wrong method name: > table.addGlas() > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'Surface' object has no

Re: urllib.urlretireve problem

2005-03-30 Thread Diez B. Roggisch
> I'm coding a program for offline package management. > The link that I provided could be obsolete by newer packages. That is > where my problem is. I wanted to know how to raise an exception here so > that depending on the type of exception I could make my program function. > > For example, for

Re: Newbiw - PypenGL and OpenGLContext

2005-03-30 Thread Mike C. Fletcher
Steve T wrote: >I have been searching for a language to help with a product I am >developing - last week I discovered PYOpenGL - looks really useful. I >found some demos which I studied to create part of what I need (a heap >of boxes) but when I try and add an image to the box faces it looks as >

Re: Using something other than ';' to separate statements

2005-03-30 Thread Ivan Van Laningham
Hi All-- Michael Hoffman wrote: > > Jaime Wyant wrote: > > > # This won't work > > if a > 5: print "a > 5";else print "Doh" > > This will: > > ["Doh", "a > 5"][a > 5] > > I highly discourage using it though--it's somewhat obtuse. > Bad Michael. Bad, bad Michael. Metta, Ivan ---

Re: [ANN]: Last Chance 2005 IORCC Entries

2005-03-30 Thread Ivan Van Laningham
Hi All-- [EMAIL PROTECTED] wrote: > > FOR IMMEDIATE RELEASE: Wed Mar 30 11:58:39 CST 2005 > LOCATION: http://iorcc.dyndns.org/2005/press/033005.html > ANNOUNCEMENT: 2005 IORCC Deadline Approaches >Entry Deadline March 31st, 2005 >

Re: Using something other than ';' to separate statements

2005-03-30 Thread Peter Hansen
Michael Hoffman wrote: Jaime Wyant wrote: # This won't work if a > 5: print "a > 5";else print "Doh" This will: ["Doh", "a > 5"][a > 5] I highly discourage using it though--it's somewhat obtuse. It's also limited to evaluating expressions, which is probably not very useful to the OP... -- http://m

Re: checking if program is installing using python

2005-03-30 Thread Peter Hansen
[EMAIL PROTECTED] wrote: does this help? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52224 It's very rare that a program like Word is installed in the PATH, so it's unlikely this helps. Generally you would need to look in the registry, or perhaps use os.popen() to parse the output of ex

[ANN]: Last Chance 2005 IORCC Entries

2005-03-30 Thread iorcc
FOR IMMEDIATE RELEASE: Wed Mar 30 11:58:39 CST 2005 LOCATION: http://iorcc.dyndns.org/2005/press/033005.html ANNOUNCEMENT: 2005 IORCC Deadline Approaches Entry Deadline March 31st, 2005 Less than 36 Hours Left, Great Prizes and Fun

Re: Using something other than ';' to separate statements

2005-03-30 Thread Michael Hoffman
Jaime Wyant wrote: # This won't work if a > 5: print "a > 5";else print "Doh" This will: ["Doh", "a > 5"][a > 5] I highly discourage using it though--it's somewhat obtuse. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem in designing a global directory in python

2005-03-30 Thread Bruno Desthuilliers
'@'.join([..join(['fred','dixon']),..join(['gmail','com'])]) a écrit : noob warning: what is so wonderful about the NEW class over the old ? A whole lot of things. But the main thing to know is that old-style classes are deprecated, and will disappear in the future. -- http://mail.python.org/mailm

Re: Using something other than ';' to separate statements

2005-03-30 Thread Jaime Wyant
On Wed, 30 Mar 2005 14:26:20 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: > Jaime Wyant wrote: > > Well, I'm embedding python in an old C console app. This app uses a > > lot of ; delimited records. > > > > I want to allow the execution of arbitrary python statements inside > > some of these rec

Re: Problem in designing a global directory in python

2005-03-30 Thread Bruno Desthuilliers
Tian a écrit : I googled about how to write singleton in python, but even if I use Singleton, in which module's namespace should I keep the instance of this singleton? You found the doc but I'm afraid you did not grasp the concept. You don't have to 'keep the instance' anywhere - it's the job of t

Re: AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread [EMAIL PROTECTED]
The most simple way to get this error I can think of is like this. It happens because len does not know how to calculate the lenght of this object. -class classA: - def __init__(self): - pass -a = classA() -print len (a) Traceback (most recent call last): File "./test.py", line 10, in ?

Python and USB

2005-03-30 Thread RaviPaike
Rogger, I am trying to use wrapper for libusb. I downloaded the Usb.py but I am not sure that I have the libusb installed on my Pc. Can you help me in getting libusb.py or libusb.c .   Thank you, Ravi -- http://mail.python.org/mailman/listinfo/python-list

Re: Using something other than ';' to separate statements

2005-03-30 Thread André Roberge
Jaime Wyant wrote: [snip] After goofing around with this idea, I've realized you can't be very expressive with a bunch of python statements strung together. My biggest problem is that I can't figure out (i don't think you can), how to do conditionals that are strung together: # This won't work if

TOC of Python Cookbook now online (was Re: author index for Python Cookbook 2?)

2005-03-30 Thread beliavsky
[EMAIL PROTECTED] wrote: > Premshree Pillai wrote: > > There's an index here: > http://harvestman.freezope.org/cookbook/creds.html > > That lists the authors. Where is a list of the recipes? I emailed the O'Reilly webmaster, and the table of contents are now online at http://www.oreilly.com/catalo

Re: RELEASED Python 2.4.1 (final)

2005-03-30 Thread Terry Reedy
The page http://www.python.org/download/ needs to be added to the list of things updated with a new release. It would, for instance, have me download python-2.4.msi rather than the new python-2.4.1 msi, which is a couple of clicks farther away. A naive visitor would be much less likely to fin

Re: AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread vincent wehren
"MackS" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] | I'm new to Python. In general I manage to understand what is happening | when things go wrong. However, the small program I am writing now fails | with the following message: | | AttributeError: ClassA instance has no attr

Re: urllib.urlretireve problem

2005-03-30 Thread Ritesh Raj Sarraf
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Larry Bates wrote: > I noticed you hadn't gotten a reply.  When I execute this it put's the > following in the retrieved file: > > > > 404 Not Found > > Not Found > The requested URL /pool/updates/main/p/perl/libparl5.6_5.6.1-8.9_i386.deb > was no

Re: checking if program is installing using python

2005-03-30 Thread Trent Mick
[EMAIL PROTECTED] wrote] > does this help? > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52224 There is the "which" module that I wrote that does this a little more robustly: http://starship.python.net/~tmick/#which However, I didn't see the original posting for this thread so I'm

Re: Using something other than ';' to separate statements

2005-03-30 Thread Peter Hansen
Jaime Wyant wrote: Well, I'm embedding python in an old C console app. This app uses a lot of ; delimited records. I want to allow the execution of arbitrary python statements inside some of these records. I was hoping there was an easy way to set the statement terminator. I will simply make up

Re: Suggesting methods with similar names

2005-03-30 Thread bearophileHUGS
Raymond Hettinger>When you're done, consider posting the result as an ASPN cookbook recipe.< I still cannot write in the cookbook... I think I have problems with the registration. So you can put it there... I've found that difflib is good enough for the string matching. This idea isn't fully mine,

Re: checking if program is installing using python

2005-03-30 Thread [EMAIL PROTECTED]
does this help? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52224 -- http://mail.python.org/mailman/listinfo/python-list

Re: AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread Michael Spencer
MackS wrote: I'm new to Python. In general I manage to understand what is happening when things go wrong. However, the small program I am writing now fails with the following message: In general you are more likely to get helpful responses from this group if you post the actual code that has the p

Re: list-comprehension and map question (simple)

2005-03-30 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, runsun pan <[EMAIL PROTECTED]> wrote: . . . >Secondly, [x+y for x,y in itertools.izip(xs, ys)] did go much faster >than map(lambda x,y: x+y, xs, ys). The latter is not only the slowest >one, but

Re: PyParsing module or HTMLParser

2005-03-30 Thread Paul McGuire
Lad - Well, here's what I've got so far. I'll leave the extraction of the description to you as an exercise, but as a clue, it looks like it is delimited by "View Detail " at the beginning, and "Quantity: 500" at the end, where 500 could be any number. This program will print out: ['Title:', 'S

Re: CGI, FieldStorage and Filename

2005-03-30 Thread Neil Benn
Neil Benn wrote: Hello, I'm writing a simple cgi script and want to be able to access the filename in a FieldStorage file instance. I have successfully manmaged to access the file as a 'file-like object' by using the simple code of : Sorry, split the filename on path not pathext.. ha

AttributeError: ClassA instance has no attribute '__len__'

2005-03-30 Thread MackS
I'm new to Python. In general I manage to understand what is happening when things go wrong. However, the small program I am writing now fails with the following message: AttributeError: ClassA instance has no attribute '__len__' Following the traceback,I see that the offending line is self.x =

CGI, FieldStorage and Filename

2005-03-30 Thread Neil Benn
Hello, I'm writing a simple cgi script and want to be able to access the filename in a FieldStorage file instance. I have successfully manmaged to access the file as a 'file-like object' by using the simple code of : objInFile = objForm['DataFile'].file I can easily read through th

checking if program is installing using python

2005-03-30 Thread GujuBoy
i want to check to see if a certain program is installed on my windows box using python. how can i do that...(ie, i want to see if "word" is installed) please help -- http://mail.python.org/mailman/listinfo/python-list

Re: Write an hexadecimal file

2005-03-30 Thread rbt
Larry Bates wrote: There is not such thing as a hexadecimal file. Right, 300 is 300 whether you choose to represent it in decimal, binary, hex, etc... it's still only 300 of something ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: return the last item in a list

2005-03-30 Thread Raymond Hettinger
[David Bear] > I'm looking for an 'easy' way to have the last item in a list returned. Try mylist.pop() or mylist[-1]. Raymond Hettinger -- http://mail.python.org/mailman/listinfo/python-list

Re: author index for Python Cookbook 2?

2005-03-30 Thread Raymond Hettinger
[Fuzzyman] > Three of my recipes are in - but one has been merged with someone elses > and improved beyond all recognition :-) Gets my vote for QOTW quote of the week. The comment captures the spirit of the cookbook and highlights the benefits of the process (public review, reader comments, compe

Re: Grouping code by indentation - feature or ******?

2005-03-30 Thread Javier Bezos
"Myles Strous" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] >>> satisfy some handy properties, the first of which being: >>> l[:n] + l[n:] = l >> >> I don't think l[:5] + l[5:] = l is a handy property >> and to me is clearly counterintuitive. Further, > > It can be quite usef

Re: [DB-SIG] Looking for Stephen Turner, maintainer of informixdb

2005-03-30 Thread Eric Brunson
Read the license. If he's released it under GPL or BSD, then you could, in all good faith, release a fork of the code until he surfaces. Carsten Haese wrote: Hello everybody: I have discovered that the functionality for connecting Python to an Informix database is currently in a frustrating stat

Re: Suggesting methods with similar names

2005-03-30 Thread Raymond Hettinger
[Bearophile] > Working in the interactive window I receive an error like > this when I write the wrong method name: > > >>> table.addGlas() > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'Surface' object has no attribute 'addGlas' > > Is it possibile to make the ob

Re: return the last item in a list

2005-03-30 Thread TZOTZIOY
On 30 Mar 2005 10:48:17 -0700, rumours say that David Bear <[EMAIL PROTECTED]> might have written: >I've googled for the above and get way too many hits.. > >I'm looking for an 'easy' way to have the last item in a list returned. > >I've thought about > >list[len(list)-1] > >but thought there wou

return the last item in a list

2005-03-30 Thread David Bear
I've googled for the above and get way too many hits.. I'm looking for an 'easy' way to have the last item in a list returned. I've thought about list[len(list)-1] but thought there would be a more gracefull way. -- http://mail.python.org/mailman/listinfo/python-list

Re: Write an hexadecimal file

2005-03-30 Thread Raymond Hettinger
[Cesar Andres Roldan Garcia] > I'm trying to write an hexadecimal file... I mean not a text plain... >I have to convert a float decimal number in float hexadecimal one, > and that's done. The struct module provides a portable way to convert a float to and from a sequence of bytes. The binascii mo

Dr. Dobb's Python-URL! - weekly Python news and links (Mar 30)

2005-03-30 Thread Cameron Laird
QOTW: "This is a Python newsgroup. Assume that we all have been brainwashed." -- Peter Otten "[M]y experience porting Java to Jython is that it mostly involves deleting stuff :-)" -- Kent Johnson "[K]eep in mind, however, that not all problems in life can be solved with software." -- Roy Smith

  1   2   >