Toronto and Area Python Users Group (PyGTA) Meeting Tuesday, 7pm at the Linux Caffe

2006-03-28 Thread Mike C. Fletcher
We will be holding our regular meeting at our regular time, on the Fourth Tuesday of the Month from 7pm to 9pm at the (very cool) Linux Caffe (located at the Corner of Grace and Harbord). We're going with small topical discussions (and/or lightning talks) this time around, with more

Graphs from Python

2006-03-28 Thread DurumDara
Hi ! I want to create graphs (edges, nodes) from python. In the last project I used graph.py that create dot files - and then I can convert these dot files with ATT neato command line tool. But ATT code is instable, sometimes need to reinstalling, and it is use horizontal layouts. This cause

Re: Difference between 'is' and '=='

2006-03-28 Thread Felipe Almeida Lessa
Em Seg, 2006-03-27 às 23:02 -0800, alex23 escreveu: Felipe Almeida Lessa wrote: I said [constants defined in your code] can (maybe should?) be used with is, and AFAICT I'm right as well: b = a b is a True You should _never_ use 'is' to check for equivalence of value. Yes, due

Re: How to inplement Session in CGI

2006-03-28 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: Python disappointly failed to provide a convinient cgi session management module. Probably because there are much better options for web programming in Python ? Not willing to use external modules, I would like to implement a simplest Session object on my own.

Re: instantiate a class with a variable

2006-03-28 Thread bruno at modulix
John wrote: Hi, is it possible to instantiate a class with a variable. example class foo: def method(self): pass x='foo' Can I use variable x value to create an instance of my class? You got examples using string 'foo', now if all you need is to store or pass around the

Re: object references

2006-03-28 Thread bruno at modulix
DrConti wrote: Hi Bruno, hi folks! thank you very much for your advices. I didn't know about the property function. I learned also quite a lot now about references. Ok everything is a reference but you can't get a reference of a reference... I saw a lot of variations on how to solve this

Re: Graphs from Python

2006-03-28 Thread [EMAIL PROTECTED]
Metapost: http://cm.bell-labs.com/who/hobby/MetaPost.html Examples: http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html ImageMagick: http://www.imagemagick.org/script/index.php Metapost presupposes you know TeX/LaTeX. If you need help in converting metapost output to eps or pdf, let

Python VBR to CBR

2006-03-28 Thread timsspamaddress
Hi, I'm currently downloading podcasts using Juice, and I want to get them more easily transferred to my music player (Creative Zen). I'm currently writing something that will rename and alter the ID tags to be more friendly (in Python), but in the process, I'd like to convert from Variable Bit

Re: Plone or TurboGears for Intranet

2006-03-28 Thread Ravi Teja
They are very different tools, apples and oranges. Plone is built for content management needs and TurboGears is built for general application development purposes. Both can work behind Apache but are not based on Apache. They use their own servers. Plone gives you a lot out of the box, but

Re: How do clients(web browser) close a python CGI program that is not responding?

2006-03-28 Thread Ben Sizer
Sullivan WxPyQtKinter wrote: Hi,there. Sometimes a python CGI script tries to output great quantities of HTML responce or in other cases, it just falls into a dead loop. How could my client close that CGI script running on the server? Generally speaking, remote users don't have control over

Converting Time question

2006-03-28 Thread Math
Hello PythonPeople.. Can anybody help me out? How do I convert a time of day from milliseconds? For example: I got the following time in milliseconds: 1,090516451769E+15 And I want to print it like: 17:14:11.769 I'm on WinXP Time zone: GMT +01:00 Thank you all! --

Re: Difference between 'is' and '=='

2006-03-28 Thread Joel Hedlund
This does *not* also mean constants and such: snip a = 123456789 a == 123456789 True a is 123456789 False I didn't mean that kind of constant. I meant named constants with defined meaning, as in the example that I cooked up in my post. More examples: os.R_OK,

Re: Difference between 'is' and '=='

2006-03-28 Thread Joel Hedlund
You should _never_ use 'is' to check for equivalence of value. Yes, due to the implementation of CPython the behaviour you quote above does occur, but it doesn't mean quite what you seem to think it does. /me not checking for value. I'm checking for identity. Suppose a is a constant. I want

Re: How do clients(web browser) close a python CGI program that is not responding?

2006-03-28 Thread Jon Ribbens
In article [EMAIL PROTECTED], Sullivan WxPyQtKinter wrote: Hi,there. Sometimes a python CGI script tries to output great quantities of HTML responce or in other cases, it just falls into a dead loop. How could my client close that CGI script running on the server? I tried to use the STOP

Re: Difference between 'is' and '=='

2006-03-28 Thread Joel Hedlund
Not those kind of constants, but this one: Python 2.4.2 (#2, Nov 20 2005, 17:04:48) [GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2 Type help, copyright, credits or license for more information. CONST = 123456789 a = CONST a == CONST True a is CONST True That's a little

To run a python script in all the machines from one server

2006-03-28 Thread muttu2244
Hi Everyone I want to run a python script in all the machines that are connected through local network and collect the information about that machine such as HDD size, RAM capacity(with number of slots) ,processer speed etc. But i want to run a script from just the server, so that it should

Re: How to inplement Session in CGI

2006-03-28 Thread Piet van Oostrum
Sullivan WxPyQtKinter [EMAIL PROTECTED] (SW) wrote: SW Python disappointly failed to provide a convinient cgi session SW management module. Not willing to use external modules, I would like to SW implement a simplest Session object on my own. SW The basic problem is: how could a python CGI

Re: To run a python script in all the machines from one server

2006-03-28 Thread Martin P. Hellwig
[EMAIL PROTECTED] wrote: Hi Everyone I want to run a python script in all the machines that are connected through local network and collect the information about that machine such as HDD size, RAM capacity(with number of slots) ,processer speed etc. But i want to run a script from just

Re: Difference between 'is' and '=='

2006-03-28 Thread Joel Hedlund
a is None is quicker than a == None I think it's not such a good idea to focus on speed gains here, since they really are marginal (max 2 seconds total after 1000 comparisons): import timeit print timeit.Timer(a == None, a = 1).timeit(int(1e7)) 4.19580316544 print

Re: To run a python script in all the machines from one server

2006-03-28 Thread Eyal Lotem
[EMAIL PROTECTED] wrote: Hi Everyone I want to run a python script in all the machines that are connected through local network and collect the information about that machine such as HDD size, RAM capacity(with number of slots) ,processer speed etc. But i want to run a script from just

Link to Daily Python-URL from www.python.org?

2006-03-28 Thread Tim Churches
Am I correct in thinking that there is no longer any link from anywhere on the Python Web site at http;//www.python.org to the Daily Python-URL at http://www.pythonware.com/daily/ ? There is no sign of it on the Community page, nor any reference to it at http://planet.python.org/ I'm sure there

Re: New Python logo in high resolution format

2006-03-28 Thread Brian Quinlan
The new Python logo is available in high-resolution format here: http://tinyurl.com/n4rge Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: Python VBR to CBR

2006-03-28 Thread Matthias Bläsing
timsspamaddress wrote: I'm currently writing something that will rename and alter the ID tags to be more friendly (in Python), but in the process, I'd like to convert from Variable Bit Rate to Constant Bit Rate. Is there a library for doing this, or alternatively, what would be the stages

Re: New Python logo in high resolution format

2006-03-28 Thread Tim Parkin
Brian Quinlan wrote: The new Python logo is available in high-resolution format here: http://tinyurl.com/n4rge Cheers, Brian Thats the old logo, the new logo is at the same address but swap the last url segment from 'logo' to 'newlogo' There still isn't a 'usage' guide for the new logo but

Re: Link to Daily Python-URL from www.python.org?

2006-03-28 Thread Peter Otten
Tim Churches wrote: Am I correct in thinking that there is no longer any link from anywhere on the Python Web site at http;//www.python.org to the Daily Python-URL at http://www.pythonware.com/daily/ ? There is no sign of it on the Community page, nor any reference to it at

Re: Converting Time question

2006-03-28 Thread Math
Me again.. I guess I ask it wrong.. I measure a time at racing events.this tracktime is measures in the format hh:mm:ssDDD where DDD = thousands of a second...like 17:14:11.769 This format is being saved as a number of micro seconds since 1970.. like 1,090516451769E+15 How do I convert from the

Re: multiple assignment

2006-03-28 Thread bruno at modulix
Anand wrote: Wouldn't it be nice to say id, *tokens = line.split(',') id, tokens_str = line.split(',', 1) But then you have to split tokens_str again. id, tokens_str = line.split(',', 1) tokens = tokens_str.split(',') this is too verbose. head_tail = lambda seq: seq[0], seq[1:]

Re: To run a python script in all the machines from one server

2006-03-28 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I want to run a python script in all the machines that are connected through local network and collect the information about that machine such as HDD size, RAM capacity(with number of slots) ,processer speed etc. But i want to run a script

Re: Converting Time question

2006-03-28 Thread Sybren Stuvel
Math enlightened us with: How do I convert a time of day from milliseconds? Milliseconds since what? Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the

Re: To run a python script in all the machines from one server

2006-03-28 Thread Sybren Stuvel
Nick Craig-Wood enlightened us with: If these are unix machines then I would use ssh/scp. Use scp to copy the script to /tmp then run it and collect the output with ssh (and os.popen/subprocess) I'd use ssh only. Just give a 'cat /tmp/myscript.sh' command, then output the contents of the

Re: Converting Time question

2006-03-28 Thread Sybren Stuvel
Math enlightened us with: I measure a time at racing events.this tracktime is measures in the format hh:mm:ssDDD where DDD = thousands of a second...like 17:14:11.769 This format is being saved as a number of micro seconds since 1970.. like 1,090516451769E+15 How do I convert from the

Re: doctest, unittest, or if __name__='__main__'

2006-03-28 Thread Roy Smith
In article [EMAIL PROTECTED], Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] writes: I have noticed some distinctly funny and confused feelings I get when using the unittest module, stuff that feels clunky and odd about how it is set-up, however I thought

Re: problems with looping, i suppose

2006-03-28 Thread Sion Arrowsmith
John Salerno [EMAIL PROTECTED] wrote: Does what I originally pasted in my message look incorrect? To me, it all seems indented properly. Yes. Somewhere or other you've got your tabstop set to 4, and python treats literal tabs as being of equivalent indent to 8 spaces. As does my newsreader, so

Re: New development windows, IronPython or PythonWin

2006-03-28 Thread Magnus Lycka
Dan wrote: Just starting to do some windows Client / Server programming. Which would you recommend? I need to create a server to fire events and communicate with clients over a lan. Thanks There are plenty of Python solutions for this, most of them work with Windows, but aren't locked to it.

Re: Suggestion for Web App

2006-03-28 Thread Magnus Lycka
Harlin Seritt wrote: I want to make a recommendation to a group of internal customers where I work concerning a Python web framework. They are seeking to build a portal that can handle around 5000 total users but probably no more than 100-200 simultaneous users. This is supposed to serve

Re: embed notepad into a frame widget

2006-03-28 Thread Diez B. Roggisch
Matt wrote: all, trying to load an application (notepad for instance) and have it sit inside a Python application window. When the main window maximises or minimises, the (notepad) app follows. I am pretty sure I need to use a frame widget under tkinter (win32) but not exactly sure how

Re: Difference between 'is' and '=='

2006-03-28 Thread Peter Hansen
Joel Hedlund wrote: This does *not* also mean constants and such: snip a = 123456789 a == 123456789 True a is 123456789 False I didn't mean that kind of constant. I meant named constants with defined meaning, as in the example that I cooked up in my post. More

Re: What's the best way to learn perl for a python programmer?

2006-03-28 Thread Magnus Lycka
vj wrote: I've been given a project which requires writing scripts that need to be run on over 3000 servers. Only about 15% of them have python installed on them. While all/most of them will have perl. I'll try and do as much as possible in pexpect but am sure I'll have do some significant

in-place string reversal

2006-03-28 Thread Sathyaish
How would you reverse a string in place in python? I am seeing that there are a lot of operations around higher level data structures and less emphasis on primitive data. I am a little lost and can't find my way through seeing a rev() or a reverse() or a strRev() function around a string object.

Re: How to inplement Session in CGI

2006-03-28 Thread Peter Hansen
Sullivan WxPyQtKinter wrote: Python disappointly failed to provide a convinient cgi session management module. Not willing to use external modules, I would like to implement a simplest Session object on my own. The basic problem is: how could a python CGI program understand several requests

Re: in-place string reversal

2006-03-28 Thread Sathyaish
And that the extra-memory operation I've given above is expensive, I believe. Is there an efficient way to do it? -- http://mail.python.org/mailman/listinfo/python-list

String split

2006-03-28 Thread Michele Petrazzo
Hello ng, I don't understand why split (string split) doesn't work with the same method if I can't pass values or if I pass a whitespace value: .split() [] .split( ) [''] But into the doc I see: If sep is not specified or is None, any whitespace string is a separator. In this two cases,

Re: Nevow LivePage tutorial

2006-03-28 Thread Jean-Paul Calderone
On 27 Mar 2006 23:00:56 -0800, Mir Nazim [EMAIL PROTECTED] wrote: I really appriciate the help a lot, the but the problems is that i have already real those. What i was looking for was some kind of detailed tutorial, that explains the basic ideas about live page and formhandling etc. (my be it the

Re: in-place string reversal

2006-03-28 Thread Sybren Stuvel
Sathyaish enlightened us with: How would you reverse a string in place in python? You wouldn't, since strings are immutable. Forget it! I got the answer to my own question. Strings are immutable, *even* in python. Indeed :) Why not! The python compiler is written in C, right? Yup. But

Quick Question regarding Frames

2006-03-28 Thread Chris S
Hello All, Just starting out with Python and wxPython. I have two Frames, FrameA and FrameB. FrameA opens FrameB when a button on FrameA is clicked. I can get this. Now I want a button on FrameB to update a control on FrameA. I am having an issue with this. Can anyone point me in the right

Re: in-place string reversal

2006-03-28 Thread Jean-Paul Calderone
On 28 Mar 2006 06:08:51 -0800, Sathyaish [EMAIL PROTECTED] wrote: How would you reverse a string in place in python? I am seeing that there are a lot of operations around higher level data structures and less emphasis on primitive data. I am a little lost and can't find my way through seeing a

1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Math
Hello, I got a simple and probably stupid newby question.. When I compute: 1.090516455488E9 / 100 the result is 1090516455.49 Should be 1090516455.488 I know something with float and //... Anybody? How do I get correct number? -- http://mail.python.org/mailman/listinfo/python-list

Re: in-place string reversal

2006-03-28 Thread Martin P. Hellwig
Sathyaish wrote: And that the extra-memory operation I've given above is expensive, I believe. Is there an efficient way to do it? If i recall correctly a string is an immutable list. I would do it this way: strTXT = foo strREV = strTXT[::-1] strREV 'oof' -- mph --

Re: in-place string reversal

2006-03-28 Thread Sathyaish
But what's got that to do with it? Strings are very mutable in C. I realized after posting that I'd said something incorrect again. The concept of mutability itself is a high-level concept compared to C. Memory allocation for strings is expensive because of the way malloc() works to find a

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Math
Should be 1.090516455488E15 - Original Message - From: Math [EMAIL PROTECTED] To: python-list@python.org Sent: Tuesday, March 28, 2006 4:29 PM Subject: 1.090516455488E9 / 100.000 ??? Hello, I got a simple and probably stupid newby question.. When I compute: 1.090516455488E9

Re: Converting Time question

2006-03-28 Thread Nick Craig-Wood
Math [EMAIL PROTECTED] wrote: I measure a time at racing events.this tracktime is measures in the format hh:mm:ssDDD where DDD = thousands of a second...like 17:14:11.769 This format is being saved as a number of micro seconds since 1970.. like 1,090516451769E+15 How do I convert from

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread [EMAIL PROTECTED]
1.090516455488E9 / 100 1090.516455488 -- http://mail.python.org/mailman/listinfo/python-list

Re: Quick Question regarding Frames

2006-03-28 Thread Chris S
A little further clarification. FrameA and FrameB are in different modules. Thanks. Chris -- http://mail.python.org/mailman/listinfo/python-list

Threads and sys.excepthook

2006-03-28 Thread Jesus Rivero - (Neurogeek)
Hello guys, I have this problem and i don't know any workarounds yet. Im implementing a DB Connection pool, which initially creates 20 connections and keep them in a dictionary. It also implements a method for allowing external method/classes to get a connection from that pool. he main issue

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Georg Brandl
Math wrote: Hello, I got a simple and probably stupid newby question.. When I compute: 1.090516455488E9 / 100 the result is 1090516455.49 Should be 1090516455.488 I know something with float and //... Anybody? How do I get correct number? Python 2.4.2 (#1, Mar 12 2006,

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Fredrik Lundh
Math wrote: I got a simple and probably stupid newby question.. When I compute: 1.090516455488E9 / 100 the result is 1090516455.49 Should be 1090516455.488 assuming you meant ~1090, it is: 1.090516455488E9 / 100 1090.516455488 unless you round it off to 12 significant digits,

Re: String split

2006-03-28 Thread Peter Otten
Michele Petrazzo wrote: Hello ng, I don't understand why split (string split) doesn't work with the same method if I can't pass values or if I pass a whitespace value: .split() [] .split( ) [''] But into the doc I see: If sep is not specified or is None, any whitespace string is a

Re: in-place string reversal

2006-03-28 Thread Sion Arrowsmith
Sathyaish [EMAIL PROTECTED] wrote: How would you reverse a string in place in python? [ ... ] Forget it! I got the answer to my own question. Strings are immutable, *even* in python. I'm not sure what that *even* is about, but glad that You can't, strings are immutable is a satisfactory answer.

Problem with httplib and HEAD request

2006-03-28 Thread Mitch . Garnaat
Hi - I'm writing some Python code to interact with Amazon's S3 service. One feature of S3 is that it will allow you to use the HTTP HEAD request to retrieve metadata about an S3 object without actually retrieving the content of the object. In trying to use this feature, I'm running into what I

Re: in-place string reversal

2006-03-28 Thread Yu-Xi Lim
Sathyaish wrote: But what's got that to do with it? Strings are very mutable in C. I realized after posting that I'd said something incorrect again. The concept of mutability itself is a high-level concept compared to C. Memory allocation for strings is expensive because of the way malloc()

Re: To run a python script in all the machines from one server

2006-03-28 Thread Yu-Xi Lim
Nick Craig-Wood wrote: If these are unix machines then I would use ssh/scp. Even if they are Windows PCs, you could just install cygwin, openssh, and python. -- http://mail.python.org/mailman/listinfo/python-list

Re: String split

2006-03-28 Thread Fredrik Lundh
Michele Petrazzo wrote: I don't understand why split (string split) doesn't work with the same method if I can't pass values or if I pass a whitespace value: .split() [] .split( ) [''] But into the doc I see: If sep is not specified or is None, any whitespace string is a separator.

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

2006-03-28 Thread Peter Otten
QOTW: Testing real examples in doctstrings, or external documentation like tutorials, is important because it's very frustrating for people reading the docs if the examples don't work as advertised. - Marc Rintsch If you don't document what the sundry variables are FOR, you're really not

Re: Plone or TurboGears for Intranet

2006-03-28 Thread Yu-Xi Lim
[EMAIL PROTECTED] wrote: Hi all, Just wondering which technology would best suit the development of custom intranets in general, things that may be industry specific would need to be included (say for an industrial design company the addition of internal memos and even extrememly business

Re: What's the best way to learn perl for a python programmer?

2006-03-28 Thread Sion Arrowsmith
Magnus Lycka [EMAIL PROTECTED] wrote: The thing that really bit me when I tried to go back to Perl after years with Python was dereferencing. Completely obvious things in Python, such as extracting an element from a list inside a dict in another list felt like black magic. Not that long ago I

Looking for a language/framework

2006-03-28 Thread walterbyrd
Way back when, I got a lot of training and experience in highly structued software development. These days, I dabble with web-development, but I may become more serious. I consider php to be an abombination, the backward compatibility issues alone are reason enough to make me hate it. Rail looks

Re: doctest, unittest, or if __name__='__main__'

2006-03-28 Thread skip
Paul The unpythonicness stems from it being basically a Paul reimplementation of JUnit, which was designed for use with Java. I think there are a few modules in Python which suffer that affliction. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: To run a python script in all the machines from one server

2006-03-28 Thread skip
Yogi I want to run a python script in all the machines that are Yogi connected through local network and collect the information about Yogi that machine such as HDD size, RAM capacity(with number of slots) Yogi ,processer speed etc. Yogi But i want to run a script from just

Perforce p4c.run(print error - AttributeError: OutputBinary

2006-03-28 Thread kbperry
Hi all, I am getting an error message when trying to use the P4 print command via the python api for perforce. Anytime that I run p4c.run(print,-q, eachFile), I keep getting an error message: AttributeError: OutputBinary. Here is my code below: Please Help. import p4 #import perforce module

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Nick Craig-Wood
Math [EMAIL PROTECTED] wrote: I got a simple and probably stupid newby question.. When I compute: 1.090516455488E9 / 100 the result is 1090516455.49 Should be 1090516455.488 I know something with float and //...

Re: To run a python script in all the machines from one server

2006-03-28 Thread jao
Quoting [EMAIL PROTECTED]: Yogi I want to run a python script in all the machines that are Yogi connected through local network and collect the information about Yogi that machine such as HDD size, RAM capacity(with number of slots) Yogi ,processer speed etc. Yogi But i want

how to use ez_setup on a machine which does not have access to the internet

2006-03-28 Thread vj
I did the following: 1. Downloaded ez_setup.py 2. Downloaded the setuptools-0.6a10-py2.4.egg 3. Downloaded the pysqlite-2.0.6-py2.4-linux-i686(2).egg Transferred all the files to the computer which is behind a firewall (with no access to the internet). I then did the following: path_to_python

Re: in-place string reversal

2006-03-28 Thread Felipe Almeida Lessa
Em Ter, 2006-03-28 às 16:03 +0100, Sion Arrowsmith escreveu: Rather than writing your own reversing code, you might like to look at: .join(reversed(foo)) Or not: $ python2.4 Python 2.4.2 (#2, Nov 20 2005, 17:04:48) [GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2 Type

Re: Looking for a language/framework

2006-03-28 Thread Alex Martelli
walterbyrd [EMAIL PROTECTED] wrote: ... I consider php to be an abombination, the backward compatibility issues alone are reason enough to make me hate it. Rail looks promising, but it's difficult to find inexpensive hosting that supports rails. What's your budget? DreamHost offers Rails

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Felipe Almeida Lessa
Em Ter, 2006-03-28 às 16:59 +0200, Fredrik Lundh escreveu: and consider using http://www.python.org/doc/lib/module-decimal.html instead. $ python2.4 Python 2.4.2 (#2, Nov 20 2005, 17:04:48) [GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2 Type help, copyright, credits or

Re: in-place string reversal

2006-03-28 Thread Adam DePrince
On Tue, 2006-03-28 at 06:15 -0800, Sathyaish wrote: And that the extra-memory operation I've given above is expensive, I believe. Is there an efficient way to do it? How big is your string? For short strings (i.e. where large means you don't have enough RAM to hold one extra copy.)

Re: 1.090516455488E9 / 1000000.000 ???

2006-03-28 Thread Adam DePrince
On Tue, 2006-03-28 at 16:29 +0200, Math wrote: Hello, I got a simple and probably stupid newby question.. When I compute: 1.090516455488E9 / 100 the result is 1090516455.49 Should be 1090516455.488 repr( 1.090516455488E9/100 ) '1090.516455488' Works for me. Code snippet?

File objects and seek

2006-03-28 Thread Tommy Grav
I have a file object that contains a binary read in file. I would like to move to another position in the file to read in a record. seek seemsto work fine with a positive value, but not a negative one (moving back from the current relative position). Is this the intended behavior?How do I move

Re: freeze.py and GTK apps

2006-03-28 Thread Adam DePrince
On Mon, 2006-03-27 at 16:15 -0800, [EMAIL PROTECTED] wrote: After freezing a PYGTK app, I am unable to run it. It this a common problem, because I could not find any documentation on it at all. I tried freezing this example, which gets by the make as well, but running it results in a

Re: Looking for a language/framework

2006-03-28 Thread bruno at modulix
walterbyrd wrote: Way back when, I got a lot of training and experience in highly structued software development. These days, I dabble with web-development, but I may become more serious. I consider php to be an abombination, the backward compatibility issues alone are reason enough to

Seems like I want a pre-processor, but...

2006-03-28 Thread Russell Warren
After some digging it seems that python does not have any equivalent to C's #if directives, and I don't get it... For example, I've got a bit of python 2.3 code that uses collections.deque.pop(0) in order to pop the leftmost item. In python 2.4 this is no longer valid - there is no argument on

Re: Seems like I want a pre-processor, but...

2006-03-28 Thread Fredrik Lundh
Russell Warren wrote: For example, I've got a bit of python 2.3 code that uses collections.deque.pop(0) in order to pop the leftmost item. In python 2.4 this is no longer valid - there is no argument on pop (rightmost only now) and you call .popleft() instead. the collections module was

Re: String split

2006-03-28 Thread Michele Petrazzo
Peter Otten wrote: The documentation for Python 2.4 has a better explanation. -cut- Quoted after http://docs.python.org/lib/string-methods.html#l2h-202. Peter Thanks, I haven't see it. Just a question about that different algorithm, because it force the developer to do other work for

Re: in-place string reversal

2006-03-28 Thread Sion Arrowsmith
Felipe Almeida Lessa [EMAIL PROTECTED] wrote: Em Ter, 2006-03-28 às 16:03 +0100, Sion Arrowsmith escreveu: .join(reversed(foo)) $ python2.4 -mtimeit '.join(reversed(foo))' 10 loops, best of 3: 2.58 usec per loop But note that a significant chunk is the join(): $ python2.4 -mtimeit

Re: Seems like I want a pre-processor, but...

2006-03-28 Thread Kent Johnson
Russell Warren wrote: After some digging it seems that python does not have any equivalent to C's #if directives, and I don't get it... For example, I've got a bit of python 2.3 code that uses collections.deque.pop(0) in order to pop the leftmost item. In python 2.4 this is no longer valid

Re: Seems like I want a pre-processor, but...

2006-03-28 Thread Peter Otten
Russell Warren wrote: After some digging it seems that python does not have any equivalent to C's #if directives, and I don't get it... For example, I've got a bit of python 2.3 code that uses collections.deque.pop(0) in order to pop the leftmost item. In python 2.4 this is no longer

Re: How do clients(web browser) close a python CGI program that is not responding?

2006-03-28 Thread Sullivan WxPyQtKinter
Actually my project is converting certain specially costomized XML file to HTML to display and edit. Sometimes the XML file is too big, or the client upload a very huge file for the server to process, which exceeds the processing ability of my server.(after all, it is a small server on my poor

Re: How to inplement Session in CGI

2006-03-28 Thread Sullivan WxPyQtKinter
bruno at modulix 写道: Sullivan WxPyQtKinter wrote: Python disappointly failed to provide a convinient cgi session management module. Probably because there are much better options for web programming in Python ? Really? Then what is it? --

Re: Seems like I want a pre-processor, but...

2006-03-28 Thread Russell Warren
the collections module was added in 2.4 Ah... sorry about that. I should have checked my example more closely. What I'm actually doing is rebinding some Queue.Queue behaviour in a safe location like this: def _get(self): ret = self.queue.popleft() DoSomethingSimple() return ret And

Re: String split

2006-03-28 Thread Peter Otten
Michele Petrazzo wrote: Just a question about that different algorithm, because it force the developer to do other work for make the split result more logically compatible: S = # this can become from an external source like config parser for s n S.split(): do the work... # don't go 

Re: in-place string reversal

2006-03-28 Thread Fredrik Lundh
Sion Arrowsmith wrote: But note that a significant chunk is the join(): $ python2.4 -mtimeit '.join(reversed(foo))' 10 loops, best of 3: 2.72 usec per loop $ python2.4 -mtimeit 'reversed(foo)' 100 loops, best of 3: 1.69 usec per loop your second benchmark doesn't do any reversal,

Re: in-place string reversal

2006-03-28 Thread olsongt
Sathyaish wrote: How would you reverse a string in place in python? I am seeing that there are a lot of operations around higher level data structures and less emphasis on primitive data. I am a little lost and can't find my way through seeing a rev() or a reverse() or a strRev() function

Re: win32com: error 80004005

2006-03-28 Thread ago
I solved it. If someone else is in the same situation... It was due to a defective installation. I reinstalled python and pywin, re-registered the server and everything worked well. -- http://mail.python.org/mailman/listinfo/python-list

Re: Seems like I want a pre-processor, but...

2006-03-28 Thread Russell Warren
Thanks guys - all great responses that answered my question in a few different ways with the addition of some other useful tidbits! This is a nice summary: In general the idea is to move the test from 'every time I need to do something' to 'once when some name is defined'. Gotta love the

Re: Threads and sys.excepthook

2006-03-28 Thread Jonathan Ellis
Jesus Rivero - (Neurogeek) wrote: Original exception was: Unhandled exception in thread started by Error in sys.excepthook: Original exception was: And if put a time.sleep(1) after the thread.start_new(test, (name,)) #(1) part, then it does it all perfectly. Looks like the

Re: How to inplement Session in CGI

2006-03-28 Thread bruno at modulix
Sullivan WxPyQtKinter wrote: bruno at modulix 写道: Sullivan WxPyQtKinter wrote: Python disappointly failed to provide a convinient cgi session management module. Probably because there are much better options for web programming in Python ? Really? Then what is it? Please notice the 's'

values turning into object instances

2006-03-28 Thread Clayton Hablinski
I am trying to convert a tuple into a list using the list function. Before I do this I have this: print CurSht.Range(A2:A63) ((45666.0,), (45777.0,), (45888.0,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,), (None,),

Re: in-place string reversal

2006-03-28 Thread Felipe Almeida Lessa
Em Ter, 2006-03-28 às 17:32 +0100, Sion Arrowsmith escreveu: ride. And at some point reversed() will become a win: $ python2.4 -mtimeit 'reversed(range(200))' 10 loops, best of 3: 6.65 usec per loop $ python2.4 -mtimeit 'range(200)[::-1]' 10 loops, best of 3: 6.88 usec per loop Not

Re: Obtaining the remote ip address

2006-03-28 Thread EP
While on the subject of network identity, does anyone have a scheme to get the MAC address of the end device? I've never come up with a way to do it, but I haven't had it proven to me that it is impossible (yet). Justin Ezequiel wrote: os.environ['REMOTE_ADDR'] os.environ['REMOTE_HOST']

Re: CGI redirection: let us discuss it further

2006-03-28 Thread and-google
Sullivan WxPyQtKinter wrote: 1. Are there any method (in python of course) to redirect to a web page without causing a Back button trap... rather than the redirection page with a Location: url head What's wrong with the redirection page? If there's really a necessary reason for not using an

  1   2   3   >