Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Stephan Kuhagen
Always prefer to use env over a hardcoded path, because that hardcoded path will invariably be wrong. (Yes, for those about to nitpick, it's conceivable that env might be somewhere other than /usr/bin. However, that is very rare and results in a no-win situations regardless of the issue of

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Michał Bartoszkiewicz
On 2006-08-09 at 08:02:03 (+0200), Stephan Kuhagen wrote: Don't yell at me for bringing in another language, but I really like the trick, Tcl does: #!/bin/sh # The next line starts Tcl \ exec tclsh $0 $@ This works by the somewhat weird feature of Tcl, that allows comments to

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Stephan Kuhagen
Michał Bartoszkiewicz wrote: #!/bin/sh exec python $0 $@ Wow, cool... I like that! Stephan -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
Stephan Kuhagen wrote: Michał Bartoszkiewicz wrote: #!/bin/sh exec python $0 $@ Wow, cool... I like that! Only someone genuinely fond of the Tcl hack could ... -- Erik Max Francis [EMAIL PROTECTED] http://www.alcyone.com/max/ San Jose, CA, USA 37 20 N 121 53 W AIM erikmaxfrancis

Re: Unicode/utf-8 data in SQL Server

2006-08-09 Thread Laurent Pointal
John Machin a écrit : The customer should be very happy if you do text.decode('utf-8').encode('cp1252') -- not only should the file import into Excel OK, he should be able to view it in Word/Notepad/whatever. + text.decode('utf-8').encode('cp1252',errors='replace') As cp1252 may not cover

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Stephan Kuhagen
Erik Max Francis wrote: #!/bin/sh exec python $0 $@ Wow, cool... I like that! Only someone genuinely fond of the Tcl hack could ... True, I admit, I'm a Tcl-Addict... But I really love Python too for many reasons. But I miss features and tricks in both languages that I have in the

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread ZeD
Stephan Kuhagen wrote: #!/bin/sh exec python $0 $@ Wow, cool... I like that! yeah, but... $ cat test.py #!/bin/sh exec python $0 $@ print Hello, world $ file test.py test.py: Bourne shell script text executable -- Under construction --

Re: import logging fails on MacPython 2.4.3

2006-08-09 Thread Diez B. Roggisch
Tod Olson schrieb: Anyone have advice for importing the logging module using MacPython 2.4.3? MacPython installs the logging module in: /Library/Frameworks/Python.framework/Versions/2.4/lib/logging/ On my machine, that is

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Stephan Kuhagen
ZeD wrote: print Hello, world $ file test.py test.py: Bourne shell script text executable Yes, the same happens with all Tcl-Scripts. I like to see this as a bug in file, not in the scripting... Stephan -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
Stephan Kuhagen wrote: Yes, the same happens with all Tcl-Scripts. I like to see this as a bug in file, not in the scripting... How does that make sense? `file` cannot possibly understand the semantics of files at that level, at least not without executing them. And that's exactly what you

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Tobias Brox
[Erik Max Francis How does that make sense? `file` cannot possibly understand the semantics of files at that level, at least not without executing them. And that's exactly what you _don't_ want to do when you're using `file` ... This is very off-topic, but if it's fairly common to begin

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Erik Max Francis
Tobias Brox wrote: This is very off-topic, but if it's fairly common to begin tcl-scripts as a /bin/sh-file with exec tcl at one of the first lines, I think file ought to be able to recognize it. exec python is clearly an obscure hack not used by many, so I don't see why file should ever

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Stephan Kuhagen
Tobias Brox wrote: This is very off-topic, Sorry for starting that... but if it's fairly common to begin tcl-scripts as a /bin/sh-file with exec tcl at one of the first lines, I think file ought to be able to recognize it. exec python is clearly an obscure hack not used by many, so I

Re: Unicode/utf-8 data in SQL Server

2006-08-09 Thread John Machin
Laurent Pointal wrote: John Machin a écrit : The customer should be very happy if you do text.decode('utf-8').encode('cp1252') -- not only should the file import into Excel OK, he should be able to view it in Word/Notepad/whatever. +

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread ZeD
Erik Max Francis wrote: The file _is_ a /bin/sh executable. You're just having that /bin/sh executable run something else -- how could `file` figure that out without a ridiculously complicated set of rules that rise to the level of a sh interpreter -- thereby, defeating the purpose? but...

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Tobias Brox
[Erik Max Francis] The point is, they're all part of the same tactic -- the particulars of sh. Special casing each one is a task without an end. People will come up with variants that will do the right thing but foil `file`, intentionally or unintentionally -- just as we've seen in this

Re: Newbie - How to iterate list or scalar ?

2006-08-09 Thread Bruno Desthuilliers
Terry Reedy wrote: Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] FWIW, the iterator protocol appeared with Python 2.2. Before this version, the above solution was the only one that allowed iteration over a container type. Now if you wonder why string,

Re: Class data being zapped by method

2006-08-09 Thread Bruno Desthuilliers
Simon Forman wrote: (snip) Not that this has anything to do with your actual question, but there are a number of small details that I noticed while reading your code: 2.) Reading lines from a file is better done like so: arrLines = open('datafiles/'+filename+'.tabdata').readlines()

ALLAH

2006-08-09 Thread faruk . nur
Kader; soru:madem,herşey bir kader defterinde yazılı ve herşey ona göre oluyor.o halde insanlar niçin cehenneme gidiyor? cevap:evet herşey bir kader defterinde yazılı ve herşey ona göre oluyor.ama,defterde yazılı olduğu için o şey olmuyor. mesela;meteroloji uzmanı,uydudan gelen fotoğraflara

Best way to construct an email - attach a html file and send

2006-08-09 Thread a
What is the best way to construct an email in python and also attach a html file the html file to be attached is not on disk, but should be dynamically constructed in the python script I want to attach the django debug error to an email and mail it to myself whenever there is an error in the

Re: Looking for an intellisense with good help IDE for Python

2006-08-09 Thread Marco Aschwanden
The best code completion you can get for Python is delivered by WingIDE: http://wingware.com/ I have seen, PyDev, Kommodo, Spe and when it comes to code completion for Python than nothing beats WingIDE. Maybe anyone can proof the contrary. WingIDE is not for free though (Personal: 35 USD upto

Re: do people really complain about significant whitespace?

2006-08-09 Thread Slawomir Nowaczyk
On Mon, 07 Aug 2006 16:47:57 -0700 Jason [EMAIL PROTECTED] wrote: # It is annoying that certain communication channels do not respect # white-space. I dislike using braces because I have to indicate my # intentions twice: once for the compiler and once for humans. I must admit I do not get this

Re: Nested function scope problem

2006-08-09 Thread Slawomir Nowaczyk
On Fri, 04 Aug 2006 14:09:15 -0300 Gerhard Fiedler [EMAIL PROTECTED] wrote: # # I disagree. At least in my understanding, which, up to now, was # # perfectly enough to explain everything about how Python variables # # behave: # # # # The address operator in C is what textual

Re: Nested function scope problem

2006-08-09 Thread Slawomir Nowaczyk
On Sun, 06 Aug 2006 11:37:46 -0300 Gerhard Fiedler [EMAIL PROTECTED] wrote: # On 2006-08-06 06:41:27, Slawomir Nowaczyk wrote: # # Since Python doesn't (supposedly) have variables, it couldn't have come # from Python. # # The idea (of this part of the thread) was to find the analogy between

setup.py when you can't write to site-packages?

2006-08-09 Thread andybak
There are several gaps in my Python knowledge, one of which is the what exactly setuptools does and how it works. I'm on a shared host so can't write to site-packages therefore most setup.py's fail. My strategy for pure python packages is to run setup.py locally and copy anything that gets put

Re: setup.py when you can't write to site-packages?

2006-08-09 Thread Diez B. Roggisch
andybak wrote: There are several gaps in my Python knowledge, one of which is the what exactly setuptools does and how it works. I'm on a shared host so can't write to site-packages therefore most setup.py's fail. My strategy for pure python packages is to run setup.py locally and copy

Session implementation for Python

2006-08-09 Thread Vlad Dogaru
Hello, is there any PHP-like implementation for sessions in Python? I fear that writing my own would be seriously insecure, besides I could actually learn a lot by inspecting the code. The reason I am asking is that I would like to implement simple scripts which require login with CGI (no

Re: Looking for an intellisense with good help IDE for Python

2006-08-09 Thread taleinat
Miki miki.tebeka at gmail.com writes: The IDLE that will come (soon) with Python 2.5 with have some intellisense. Not all that you requested but some of it. On the same note, IDLE's completion module has received some serious upgrades recently (such as dictionary key completion and

Re: Session implementation for Python

2006-08-09 Thread _max
Flup does sessions, in the form of a WSGI middleware: http://www.saddi.com/software/flup/ Vlad Dogaru wrote: Hello, is there any PHP-like implementation for sessions in Python? I fear that writing my own would be seriously insecure, besides I could actually learn a lot by inspecting the

Re: import logging fails on MacPython 2.4.3

2006-08-09 Thread Tod Olson
Diez B. Roggisch wrote: Tod Olson schrieb: Anyone have advice for importing the logging module using MacPython 2.4.3? MacPython installs the logging module in: /Library/Frameworks/Python.framework/Versions/2.4/lib/logging/ On my machine, that is

Re: Session implementation for Python

2006-08-09 Thread Bruno Desthuilliers
Vlad Dogaru wrote: Hello, is there any PHP-like implementation for sessions in Python? I fear that writing my own would be seriously insecure, besides I could actually learn a lot by inspecting the code. The reason I am asking is that I would like to implement simple scripts which

Re: setup.py when you can't write to site-packages?

2006-08-09 Thread andybak
Thanks Diez. For one thing I was getting setuptools mixed up with distutils. Then it occurred to me that this might be covered in the standard distutils docs (obvious I know but before I was thinking of it as a general Python problem and therefore wasn't sure where it might be documented) The

Re: do people really complain about significant whitespace?

2006-08-09 Thread [EMAIL PROTECTED]
Slawomir Nowaczyk wrote: I must admit I do not get this indicate intentions twice argument, even though I heard it a number of times now... It's not that braces require more work or more typing or something, after all -- at least not if one is using a decent editor. Its not the typing, its

Re: Question about using python as a scripting language

2006-08-09 Thread Wildemar Wildenburger
Steve Lianoglou wrote: Delaney, Timothy (Tim) wrote: This is just asking for trouble. my_list = eval('import shutil; shutil.rmtree('/')') Hah .. wow. And in related news: you still shouldn't be taking candy from strangers. Point well taken. Thanks for flagging that one. Heck,

Re: singleton decorator

2006-08-09 Thread Wildemar Wildenburger
Pedro Werneck wrote: class Singleton(object): ... def __new__(cls, *args, **kwds): ... try: ... return cls._it ... except AttributeError: ... cls._it = object.__new__(cls, *args, **kwds) ... return

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread msoulier
John Salerno wrote: I understand the difference, but I'm just curious if anyone has any strong feelings toward using one over the other? I personally prefer being explicit over implicit, but then, that is in the Zen of Python. I work on machines with multiple interpreters installed. I find

Re: singleton decorator

2006-08-09 Thread Pedro Werneck
On Tue, 08 Aug 2006 14:50:39 +0200 Wildemar Wildenburger [EMAIL PROTECTED] wrote: Or you could always just use the __new__() method instead of __init__(), putting all your initialization into the above except-block. If you replace 'cls._it = ...' with 'self = cls_it = ...' you'll feel right

Re: do people really complain about significant whitespace?

2006-08-09 Thread Pierre Barbier de Reuille
Carl Banks wrote: Michiel Sikma wrote: Op 8-aug-2006, om 1:49 heeft Ben Finney het volgende geschreven: As others have pointed out, these people really do exist, and they each believe their preconception -- that significant whitespace is intrinsically wrong -- is valid, and automatically

Re: do people really complain about significant whitespace?

2006-08-09 Thread Jean-Paul Calderone
On Wed, 09 Aug 2006 13:47:03 +0100, Pierre Barbier de Reuille [EMAIL PROTECTED] wrote: Carl Banks wrote: Michiel Sikma wrote: Op 8-aug-2006, om 1:49 heeft Ben Finney het volgende geschreven: As others have pointed out, these people really do exist, and they each believe their preconception

need hint for refactoring

2006-08-09 Thread GHUM
I have a bunch of function like: def p2neufrage(_): create new element anfrage,ergebnis=getanfrage() if ergebnis.get(status,ok) == ok: wert=anfrage[feld] # do something # unique here ergebnis[innerHTML]=. something # return

Re: need hint for refactoring

2006-08-09 Thread Diez B. Roggisch
GHUM wrote: I have a bunch of function like: def p2neufrage(_): create new element anfrage,ergebnis=getanfrage() if ergebnis.get(status,ok) == ok: wert=anfrage[feld] # do something # unique here ergebnis[innerHTML]=. something

Re: Regd:Video Converter Programming

2006-08-09 Thread Grant Edwards
On 2006-08-09, placid [EMAIL PROTECTED] wrote: I want to write an avi to flv converter in php but i am a complete newbie to it. via a Google search for python video convert i found the following http://pymedia.org/ Except he wants to write it in PHP. Not sure why he's asking us about it

Re: Question about using python as a scripting language

2006-08-09 Thread Slawomir Nowaczyk
On Tue, 08 Aug 2006 14:32:32 +0200 Wildemar Wildenburger [EMAIL PROTECTED] wrote: # Steve Lianoglou wrote: # Delaney, Timothy (Tim) wrote: # This is just asking for trouble. # # my_list = eval('import shutil; shutil.rmtree('/')') # # Hah .. wow. # # And in related news: you still

Re: Best way to construct an email - attach a html file and send

2006-08-09 Thread Larry Bates
a wrote: What is the best way to construct an email in python and also attach a html file the html file to be attached is not on disk, but should be dynamically constructed in the python script I want to attach the django debug error to an email and mail it to myself whenever there is an

Re: do people really complain about significant whitespace?

2006-08-09 Thread Brett g Porter
[EMAIL PROTECTED] wrote: Its not the typing, its the fact that when you say the same thing twice, there is the potential for them to get out of sync. If the method the compiler uses (braces) and the method the human uses (indentation) to determine what the code does don't agree, then a

Re: Best way to construct an email - attach a html file and send

2006-08-09 Thread skip
py What is the best way to construct an email in python and also attach py a html file ... Check out the email package. Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: setup.py when you can't write to site-packages?

2006-08-09 Thread skip
andy What's the best approach for situations when you can't tamper with andy the Python install? python setup.py install --prefix=/some/where/else The arg to --prefix is analogous to /usr or /usr/local. For example, if you are running Python 2.4, your files will wind up in

Re: Question about using python as a scripting language

2006-08-09 Thread skip
Wildemar Heck, whenever *is* it OK to use eval() then? When you're sure of the validity of the string you are feeding it. Unfortunately, the more you know about the string (and thus how valid it is in your current context), the less you need eval. For example, if I know a string s only

Re: do people really complain about significant whitespace?

2006-08-09 Thread Stephen Kellett
In message [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] writes of the driving principles behind Python is that, because code will be read more often than written, readability is more important. In which case, for long functions with multiple levels of indentation Python fails compared

Re: do people really complain about significant whitespace?

2006-08-09 Thread skip
of the driving principles behind Python is that, because code will be read more often than written, readability is more important. Stephen In which case, for long functions with multiple levels of Stephen indentation Python fails compared to languages that use braces

Re: How to reverse tuples in a list?

2006-08-09 Thread Sion Arrowsmith
Robert Kern [EMAIL PROTECTED] wrote: Python 2.4+: y = [tuple(reversed(t)) for t in y] Python 2.3: y = [ t[::-1] for t in y ] Obviously works in 2.4 as well, where I make it faster than using tuple(reversed(t)). Which isn't surprising, as it's not constructing the intermediate list. --

Re: do people really complain about significant whitespace?

2006-08-09 Thread Stephen Kellett
In message [EMAIL PROTECTED], Gerhard Fiedler [EMAIL PROTECTED] writes But there is well-written code that is as much as reasonably possible self-documenting, meaning easy to read and understand, with a clear structure, helpful names, appropriate types (where applicable) etc etc. But that code

Re: do people really complain about significant whitespace?

2006-08-09 Thread Slawomir Nowaczyk
On Wed, 09 Aug 2006 05:00:20 -0700 [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: # Slawomir Nowaczyk wrote: # # I must admit I do not get this indicate intentions twice argument, # even though I heard it a number of times now... It's not that braces # require more work or more typing or

Re: do people really complain about significant whitespace?

2006-08-09 Thread Slawomir Nowaczyk
On Wed, 09 Aug 2006 09:13:21 -0500 [EMAIL PROTECTED] wrote: # # of the driving principles behind Python is that, because code will be # read more often than written, readability is more important. # # Stephen In which case, for long functions with multiple levels of # Stephen

Re: Best way to construct an email - attach a html file and send

2006-08-09 Thread Grant Edwards
On 2006-08-09, a [EMAIL PROTECTED] wrote: What is the best way to construct an email in python and also attach a html file the html file to be attached is not on disk, but should be dynamically constructed in the python script Sounds like a job for MimeWriter to me. -- Grant Edwards

Re: Class data being zapped by method

2006-08-09 Thread Sion Arrowsmith
Bruno Desthuilliers [EMAIL PROTECTED] wrote: fpath = os.path.join('datafiles', filename + .tabdata) fpath = os.path.join('datafiles', filename + os.path.extsep + tabdata) 8-) I'm a bit bemused by extsep -- it didn't appear until 2.2, by which time there can't have been many people with an OS

Re: do people really complain about significant whitespace?

2006-08-09 Thread Carl Banks
Stephen Kellett wrote: In message [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] writes of the driving principles behind Python is that, because code will be read more often than written, readability is more important. In which case, for long functions with multiple levels of

Re: do people really complain about significant whitespace?

2006-08-09 Thread skip
Slawomir # No. In that case Python makes it more readily apparent Slawomir # that your code is too complex. With C, Java, C++, Perl or Slawomir # FORTRAN you just smush everything over to the left and Slawomir # pretend it's not. ;-) Slawomir Well, one space is sufficient

Re: do people really complain about significant whitespace?

2006-08-09 Thread Rob Wolfe
Slawomir Nowaczyk wrote: Really, typing brace after function/if/etc should add newlines and indent code as required -- automatically. Actually, for me, it is even *less* typing in C and similar languages... I probably should teach my Emacs to automatically add newline after colon in Python,

Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread Brendon Towle
Slawomir Nowaczyk noted:# Heck, whenever *is* it OK to use eval() then?eval is like optimisation. There are two rules:Rule 1: Do not use it.Rule 2 (for experts only): Do not use it (yet).So, that brings up a question I have. I have some code that goes out to a website, grabs stock data, and sends

Re: ALLAH

2006-08-09 Thread Skip Montanaro
Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination writes: You might want to try in English. Given the subject of the message, I suspect he wasn't trying to reach an English-speaking audience... ;-) Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-09 Thread Carl Banks
Pierre Barbier de Reuille wrote: Problem being : grouping by indentation do *not* imply good indentation. By itself, it doesn't. But with grouping by indentation, bad indentation no longer results from mere carelessness, which is no small thing. Although Python doesn't do this, it is possible

Re: beginner questions on embedding/extending python with C++

2006-08-09 Thread Hoop
Hi All, I am in the process also of trying to call Python script from a C++ windows app. I have looked at the Boost site and am currently reading over the Embedding portion of the tutorial. A question I have is that there appear to be about 4 or 5 Boost items avaiable for download. Which one

using python with tar files and compressed files

2006-08-09 Thread John Salerno
Here's the name of a file I have: wxPython-newdocs-2.6.3.3.tar.bz2 Now, I tried this: import tarfile tar = tarfile.open('wxPython-newdocs-2.6.3.3.tar.bz2', 'r:bz2') but got this: Traceback (most recent call last): File pyshell#5, line 1, in -toplevel- tar =

Re: do people really complain about significant whitespace?

2006-08-09 Thread Michiel Sikma
Op 9-aug-2006, om 16:48 heeft Carl Banks het volgende geschreven: Even if this were legal code (it isn't), it's still more transparent than some of the C code I've seen. Carl Banks Still kind of too bad that means there won't ever be an International Obfuscated Python Code Contest.

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread skip
Brendon Turns out that the website in question stores its data in the Brendon format of a Python list Brendon (http://quotes.nasdaq.com/quote.dll?page=nasdaq100, search the Brendon source for var table_body). So, the part of my code that Brendon extracts the data looks

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread Chris Lambacher
How is your data stored? (site was not loading for me). test = 'blah = [1,2,3,4,5]' var,val = test.split('=') print var,val blah [1,2,3,4,5] val = val.strip('[] ') print val 1,2,3,4,5 vals = [int(x) for x in val.split(',')] print vals [1, 2, 3, 4, 5] More sophisiticated situations (like

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread skip
skip import re skip symbolinfo = [] skip sympat = re.compile( skip r'\[', Make that r',?\[' Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Open file handles?

2006-08-09 Thread Thomas Bartkus
Jon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Perhaps using os you could work with lsof [http://www.linuxcommand.org/man_pages/lsof8.html] Jon Of course! That's perfect. Thank you! How silly of me not to have noticed that lsof means ListOpenFiles ;-) Thomas Bartkus --

Re: Question about using python as a scripting language

2006-08-09 Thread Carl Banks
Wildemar Wildenburger wrote: Steve Lianoglou wrote: Delaney, Timothy (Tim) wrote: This is just asking for trouble. my_list = eval('import shutil; shutil.rmtree('/')') Hah .. wow. And in related news: you still shouldn't be taking candy from strangers. Point well taken.

Re: Question about using python as a scripting language

2006-08-09 Thread Carl Banks
Delaney, Timothy (Tim) wrote: Steve Lianoglou wrote: One thing you could do is use the eval or compile methods. These functions let you run arbitray code passed into them as a string. So, for instance, you can write: my_list = eval('[1,2,3,4]') This is just asking for trouble.

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread Chris Lambacher
There were some mistakes in here. Thats what I get for repurposing existing code for an example. The uncommented lines are changed. On Wed, Aug 09, 2006 at 11:04:32AM -0400, Chris Lambacher wrote: from pyparsing import Suppress, Regex, delimitedList, Forward, QuotedString, Group stringValue

Re: timeout calling local sendmail

2006-08-09 Thread [EMAIL PROTECTED]
that's timeout calling local sendmail not timeout calling local se [EMAIL PROTECTED] wrote: (Environment: RedHat Linux recent, Python 2.3.5) We have a batch processing script that on occasion needs to send out an email. We have a sendmail running locally. Sometimes we get a socket timeout

Embedding Python in C/C++

2006-08-09 Thread kingcrustybun
Not a Python newb but a bit out of my depth here... We are trying to use the Python interpreter from within a C/C++ aplication to execute Python code which is in an external file. The idea is to share a dictionary between the C app and the python script. After Py_Initialize() we do something

ChiPy Chicago Python User Group Meeting Tomorrow

2006-08-09 Thread bray
This will be our best meeting yet! ChiPy's Monthly meeting this Thurs. August 10, 2006. 7pm. (except for folks who want to help setup at 6:30 and get first dibs on pizza-compliments of Uncle Roy (Singham)) Topics -- * Adrian Holovaty's new Django Add-on for quickly publishing websites. *

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread Brendon Towle
On 9 Aug 2006, at 11:04 AM, Chris Lambacher wrote:How is your data stored? (site was not loading for me).In the original source HTML, it's like this (I've deleted all but the beginning and the end of the list for clarity):var table_body = [["ATVI", "Activision,

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread skip
Brendon I could do that, or I could do something like the re.* trick Brendon mentioned by another poster. But, doesn't it offend anyone else Brendon that the only clean way to access functionality that's already Brendon in Python is to write long complicated Python code? Python

Re: Class data being zapped by method

2006-08-09 Thread Bruno Desthuilliers
Sion Arrowsmith wrote: Bruno Desthuilliers [EMAIL PROTECTED] wrote: fpath = os.path.join('datafiles', filename + .tabdata) fpath = os.path.join('datafiles', filename + os.path.extsep + tabdata) 8-) I'm a bit bemused by extsep -- it didn't appear until 2.2, by which time there can't have

knowing when file is flushed to disk

2006-08-09 Thread John Pote
Hello, I'm using a Python CGI script on a web server to log data from a remote site every few minutes. I do not want to lose any data for whatever rare reason - power outage/os crash just at the wrong moment etc. So I would like to know when the data is actually written to disk and the file

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Christophe
Stephan Kuhagen a écrit : Always prefer to use env over a hardcoded path, because that hardcoded path will invariably be wrong. (Yes, for those about to nitpick, it's conceivable that env might be somewhere other than /usr/bin. However, that is very rare and results in a no-win situations

Re: threading.Event usage causing intermitent exception

2006-08-09 Thread [EMAIL PROTECTED]
Tim Peters wrote: [EMAIL PROTECTED] Admittedly this problem causes no actual functional issues aside from an occasional error message when the program exits. The error is: Unhandled exception in thread started by Error in sys.excepthook: Original exception was: Yes all that info

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread Chris Lambacher
On Wed, Aug 09, 2006 at 11:51:19AM -0400, Brendon Towle wrote: On 9 Aug 2006, at 11:04 AM, Chris Lambacher wrote: How is your data stored? (site was not loading for me). In the original source HTML, it's like this (I've deleted all but the beginning and the end of the list

Re: Eval (was Re: Question about using python as a scripting language)

2006-08-09 Thread Brendon Towle
On 9 Aug 2006, at 12:03 PM, [EMAIL PROTECTED] wrote:    Brendon I could do that, or I could do something like the re.* trick    Brendon mentioned by another poster. But, doesn't it offend anyone else    Brendon that the only clean way to access functionality that's already    Brendon in Python is

__contains__ vs. __getitem__

2006-08-09 Thread David Isaac
I have a subclass of dict where __getitem__ returns None rather than raising KeyError for missing keys. (The why of that is not important for this question.) I was delighted to find that __contains__ still works as before after overriding __getitem__.So even though instance['key'] does not

Re: __contains__ vs. __getitem__

2006-08-09 Thread Bruno Desthuilliers
David Isaac wrote: I have a subclass of dict where __getitem__ returns None rather than raising KeyError for missing keys. (The why of that is not important for this question.) Well, actually it may be important... What's so wrong with d.get('key') that you need this behaviour ? --

Re: using python with tar files and compressed files

2006-08-09 Thread enigmadude
This syntax works on other bzipped tar files. But it's not unheard of that large tarballs will get corrupted from a download mirror. Use a download manager and try redownloading the file. Usually a mirror will include an md5sum text file so that you can compare the checksum to your downloaded file

Re: paramter passing question

2006-08-09 Thread diffuser78
It partly works but I get error printed out on the console. Traceback (most recent call last): File NewProject.py, line 87, in OnEdit win = MyFrame4(self, -1, ,sim_name=sim_name) File NewProject.py, line 1098, in __init__ wx.Frame.__init__(self, *args, **kwds) File

Re: Class data being zapped by method

2006-08-09 Thread Kevin M
Good news. I've fixed it up and all seems to be well. Thanks, all. I've learned a lot from this :) John Machin wrote: Kevin M wrote: Inline 1.) Why are you removing the .pyc file? After I had run the script once and subsequently changed the class file, I would run the script

Escape sequences (colour) and padding with %8s%

2006-08-09 Thread Anton81
Hi all! I used escape sequences to produce colour output, but a construct like print %8s % str_with_escape doesn't do the right thing. I suppose the padding counts the escape characters, too. What could be a solution? Anton -- http://mail.python.org/mailman/listinfo/python-list

Status of Epydoc

2006-08-09 Thread Kent Tenney
Howdy, I would very like to use Epydoc 3.0, however I've found a couple bugs and the mailing list; http://sourceforge.net/mailarchive/forum.php?forum_id=39919 doesn't seem to be working, the last couple messages I've posted haven't shown up. Does anyone know the status of Epydoc 3.0

Re: #!/usr/bin/python or #!/usr/bin/env python?

2006-08-09 Thread Aahz
In article [EMAIL PROTECTED], John Salerno [EMAIL PROTECTED] wrote: I understand the difference, but I'm just curious if anyone has any strong feelings toward using one over the other? I was reading that a disadvantage to the more general usage (i.e. env) is that it finds the first python on

Python share CPU time?

2006-08-09 Thread Yannick
Hi, I would like to program a small game in Python, kind of like robocode (http://robocode.sourceforge.net/). Problem is that I would have to share the CPU between all the robots, and thus allocate a time period to each robot. However I couldn't find any way to start a thread (robot), and

Re: __contains__ vs. __getitem__

2006-08-09 Thread enigmadude
That's a vague question, so the obligatory it depends response applies here. If you want to guard against the unexpected, perhaps it's a good idea to write unit tests rather than to take someone's word that it *should* work okay every time, in every case, no matter what you're doing with the

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:21, Slawomir Nowaczyk wrote: Nope. Equivalence table can look like this: Python C variable:a variable: a textual representation: a address operator: a id of object: id(a)

Re: Info on continuations?

2006-08-09 Thread vasudevram
Michael wrote: vasudevram wrote: Hi, I am Googling and will do more, found some stuff, but interested to get viewpoints of list members on: Continuations in Python. Saw a few URLs which had some info, some of which I understood. But like I said, personal viewpoints are good

What's the cleanest way to compare 2 dictionary?

2006-08-09 Thread John Henry
Hi list, I am sure there are many ways of doing comparision but I like to see what you would do if you have 2 dictionary sets (containing lots of data - like 2 keys and each key contains a dozen or so of records) and you want to build a list of differences about these two sets. I like to end

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:22, Slawomir Nowaczyk wrote: It was never my goal to show that Python and C variables behave the same way or anything. So it seems like we misunderstood each others intents. That seems to be the case :) I never really meant to say that I think that Python does not have

Re: Python share CPU time?

2006-08-09 Thread Grant Edwards
On 2006-08-09, Yannick [EMAIL PROTECTED] wrote: Hi, I would like to program a small game in Python, kind of like robocode (http://robocode.sourceforge.net/). Problem is that I would have to share the CPU between all the robots, and thus allocate a time period to each robot. However I

Re: Nested function scope problem

2006-08-09 Thread Gerhard Fiedler
On 2006-08-09 07:54:22, Slawomir Nowaczyk wrote: But I do not believe there is any identity of a variable which corresponds to id(). Still, you used such term -- repeatedly. I do not know what do you mean by it. In C, the identity of anything is usually the memory location. Same location

Re: Python share CPU time?

2006-08-09 Thread enigmadude
There's several ways of doing concurrency in Python. Other than the threading module, have you tried FibraNet? It's designed with simple games in mind. You can download it at http://cheeseshop.python.org/pypi/FibraNet. Specifically the nanothreads module from FibraNet uses generators to simulate

  1   2   >