Re: Cpoying a PyList to a C string array

2006-12-19 Thread Klaas
Sheldon wrote: > The code below is a rookie attempt to copy a python list of strings to > a string array in C. It works to some extent but results in memory > problems when trying to free the C string array. Does anyone know how > to do this properly? You have numerous problems in this code. The

Re: Core dump revisited

2006-12-19 Thread Duncan Booth
"Sheldon" <[EMAIL PROTECTED]> wrote: > > Duncan Booth skrev: > >> "Sheldon" <[EMAIL PROTECTED]> wrote: >> >> > I am new to this and copied this code from a colleague. So, it >> > corrupts the pointer. How do I do this properly? >> > >> Here is at least part of your problem: >> >> msgop = PyL

Star-P Anyone?

2006-12-19 Thread MohF1
I was wondering if some power users of Python would be willing to pay money to benefit from doing a lot of their scientific/engineering/financial modeling and simulation from running their programs on high powered computing HPC. HPC would essentially mean that you run on a cluster or group of compu

regexp

2006-12-19 Thread vertigo
Hello I need to use some regular expressions for more than one line. And i would like to use some modificators like: /m or /s in perl. For example: re.sub(".*","",data) will not cut out all javascript code if it's spread on many lines. I could use something like /s from perl which treats . as all

Re: regexp

2006-12-19 Thread Fredrik Lundh
vertigo wrote: > I need to use some regular expressions for more than one line. > And i would like to use some modificators like: /m or /s in perl. > For example: > re.sub(".*","",data) > > will not cut out all javascript code if it's spread on many lines. that won't cut out all javascript code p

Re: When Closure get external variable's value?

2006-12-19 Thread Huayang Xia
I'm confused. What is the definition of closure. I'm not sure if it's correct, I get the definition from wikipedia: "A closure typically comes about when one function is declared entirely within the body of another, and the inner function refers to local variables of the outer function. At runtim

Re: Core dump revisited

2006-12-19 Thread Nick Craig-Wood
Sheldon <[EMAIL PROTECTED]> wrote: > Man. You are good. This is most insight I have had from anyone. :-) > I did initialize the arrays with PyObjects and today, after hours of > debugging and now with your insight, I think the problem lies here: Good! You need to release some python references

Re: regexp

2006-12-19 Thread Jonathan Curran
On Tuesday 19 December 2006 13:15, vertigo wrote: > Hello > > I need to use some regular expressions for more than one line. > And i would like to use some modificators like: /m or /s in perl. > For example: > re.sub(".*","",data) > > will not cut out all javascript code if it's spread on many line

Re: regexp

2006-12-19 Thread vertigo
> vertigo wrote: >> I need to use some regular expressions for more than one line. >> And i would like to use some modificators like: /m or /s in perl. >> For example: >> re.sub(".*","",data) >> will not cut out all javascript code if it's spread on many lines. > > that won't cut out all javascr

Re: tuple.index()

2006-12-19 Thread J. Clifford Dyer
Nick Maclaren wrote: > In article <[EMAIL PROTECTED]>, > "J. Clifford Dyer" <[EMAIL PROTECTED]> writes: > |> > |> On the contrary, I think that example fits perfectly with my definition > |> of homogenous. If there is no constraint on position, then what is the > |> position determinative of? Or

Re: Is htmlGen still alive?

2006-12-19 Thread Gabriel Genellina
At Monday 18/12/2006 17:37, [EMAIL PROTECTED] wrote: Does anybody know whether htmlGen, the Python-class library for generating HTML, is still being maintained? Or from where it can be downloaded? The Starship site where it used to be hosted is dead. *active* in what sense? HTML std doesn't ch

RE: Can a Tkinter GUI check for abort script:

2006-12-19 Thread Michael Yanowitz
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of hg Sent: Tuesday, December 19, 2006 9:44 AM To: python-list@python.org Subject: Re: Can a Tkinter GUI check for abort script: Michael Yanowitz wrote: > Hello: > >I have successfully implemented a Tkinter

Http server

2006-12-19 Thread Gert Cuykens
so far this works import cherrypy import os.path class Http: def index(self): f = open(os.path.join(os.path.dirname(__file__), '../htm/index.htm')) xml = f.read() f.close() return xml index.exposed = True cherrypy.tree.mount(Http()) if __name__ == '__ma

What am I supposed to do with an egg?!

2006-12-19 Thread Morpheus
On Windows I'm used to install packages by setup.py install. So did I with Fibranet nanothreads - a few seconds and it was installed. On Linux (ubuntu 6.06) all I could get at is an egg file. I found out that I have to exec easy_install, which didn't much help here (seems to me, at least - sorry,

Lisp/Python programmers (among others) wanted

2006-12-19 Thread Tech HR
Smart Charter Inc. is a dynamic new startup company whose goal is to revolutionize the charter jet industry. If you are looking for a stable 9-5 job, look elsewhere. If you are ready for a challenging ground-floor opportunity with significant upside potential you've come to the right place. We a

Newbie: What are the rules wrt constructing PYDOC keywords

2006-12-19 Thread paulsendave
Still learning python (2.4) and have instructions that all of our python scripts should be SelfDoc'ing via pydoc standards. One thing that isn't clear to me is how pydoc searches for keywords. I believe that there might be certain rules for putting keywords together under the SYNOPSIS and search

Re: When Closure get external variable's value?

2006-12-19 Thread Bruno Desthuilliers
Huayang Xia a écrit : > I'm confused. What is the definition of closure. > > I'm not sure if it's correct, I get the definition from wikipedia: > > "A closure typically comes about when one function is declared entirely > within the body of another, and the inner function refers to local > variab

Re: urllib.unquote and unicode

2006-12-19 Thread Martin v. Löwis
Duncan Booth schrieb: > The way that uri encoding is supposed to work is that first the input > string in unicode is encoded to UTF-8 and then each byte which is not in > the permitted range for characters is encoded as % followed by two hex > characters. Can you back up this claim ("is supposed

Re: regexp

2006-12-19 Thread vertigo
Hello > On Tuesday 19 December 2006 13:15, vertigo wrote: >> Hello >> >> I need to use some regular expressions for more than one line. >> And i would like to use some modificators like: /m or /s in perl. >> For example: >> re.sub(".*","",data) >> >> will not cut out all javascript code if it's sp

Re: What am I supposed to do with an egg?!

2006-12-19 Thread johnzenger
Type "sudo easy_install myeggfile.egg." If that gives you an error, then you don't have easy_install installed. Install it this way: sudo apt-get install python-setuptools On Dec 19, 3:44 pm, Morpheus <[EMAIL PROTECTED]> wrote: > On Windows I'm used to install packages by setup.py install. So d

Re: regexp

2006-12-19 Thread johnzenger
You want re.sub("(?s)", "", htmldata) Explanation: To make the dot match all characters, including newlines, you need to set the DOTALL flag. You can set the flag using the (?_) syntax, which is explained in section 4.2.1 of the Python Library Reference. A more readable way to do this is: obj

Re: python-hosting.com projects: dead?

2006-12-19 Thread Richard Jones
Remi wrote: > We had to do some serious cleanup and we disabled a lot of Trac sites > that looked abandoned (people left their Trac sites open to spammers > and our server was crawling under the load caused by these spammers). Actually, to clarify the DEFAULT configuration for Trac is to leave it

Re: regexp

2006-12-19 Thread johnzenger
Oops, I mean obj.sub("", htmldata) On Dec 19, 4:15 pm, [EMAIL PROTECTED] wrote: > You want re.sub("(?s)", "", htmldata) > > Explanation: To make the dot match all characters, including newlines, > you need to set the DOTALL flag. You can set the flag using the (?_) > syntax, which is explained i

Re: Http server

2006-12-19 Thread fumanchu
Gert Cuykens wrote: > so far this works > > > import cherrypy > import os.path > > class Http: > > def index(self): > f = open(os.path.join(os.path.dirname(__file__), '../htm/index.htm')) > xml = f.read() > f.close() > return xml > index.exposed = True > > c

Re: When Closure get external variable's value?

2006-12-19 Thread Fredrik Lundh
Bruno Desthuilliers wrote: >> You skipped the first and most important sentence: > "In programming languages, a closure is a function that refers to free > variables in its lexical context." > > IOW, a closure is a function that carry it's own environment. in contrast to functions that don't k

Page layouts in mod_python?

2006-12-19 Thread Michael
Hey everyone, Is it possible to automatically insert headers/footers using mod_python? I will be not be using PSP's, so I cannot use the PSP/include solution. Furthermore, the header will be dynamic; it won't be a static HTML page. In short, I've been looking for a page layout facility using mod_

Re: Core dump revisited

2006-12-19 Thread Sheldon
Nick Craig-Wood skrev: > Sheldon <[EMAIL PROTECTED]> wrote: > > Man. You are good. This is most insight I have had from anyone. > > :-) > > > I did initialize the arrays with PyObjects and today, after hours of > > debugging and now with your insight, I think the problem lies here: > > Good! > >

Re: regexp

2006-12-19 Thread vertigo
Hello Thanx for help, i have one more question: i noticed that while matching regexp python tries to match as wide as it's possible, for example: re.sub("","",htmldata) would cut out everything before first "" in the document. Can i force re to math as narrow as possible ? (to match first ""

Re: Http server

2006-12-19 Thread Gert Cuykens
> The cute secretary's name is "cherrypy.tools.staticdir". > Check out her resume at http://www.cherrypy.org/wiki/StaticContent I think i am in love :) -- http://mail.python.org/mailman/listinfo/python-list

Re: regexp

2006-12-19 Thread skip
vertigo> i noticed that while matching regexp python tries to match as wide as it's vertigo> possible, vertigo> for example: vertigo> re.sub("","",htmldata) vertigo> would cut out everything before first "" in the vertigo> document. vertigo> Can i force re to math

Re: When Closure get external variable's value?

2006-12-19 Thread Huayang Xia
My understanding was: Closure is a nested function first. If it refers free variable, then it is closure. If it doesn't refer free variable, it doesn't have to be nested. That is probably the reason, the free variable is emphasized. Normally it makes sense to return a closure, but not a non-closur

[ANN]: 'twander' 3.210 Released And Available

2006-12-19 Thread Tim Daneliuk
(Apologies for two releases in less than a week. It was, um... necessary. This should be it for quite a while barring any notable bug reports.) 'twander' Version 3.210 is now released and available for download at: http://www.tundraware.com/Software/twander The last public release wa

Re: Page layouts in mod_python?

2006-12-19 Thread Bruno Desthuilliers
Michael a écrit : > Hey everyone, > > Is it possible to automatically insert headers/footers using > mod_python? > I will be not be using PSP's, so I cannot use the PSP/include solution. > Furthermore, the header will be dynamic; it won't be a static HTML > page. > > In short, I've been looking f

Re: permutations - fast & with low memory consumption?

2006-12-19 Thread Alan Isaac
>From pytrix: http://www.american.edu/econ/pytrix/pytrix.py def permutationsg(lst): '''Return generator of all permutations of a list. ''' if len(lst)>1: for i in range(len(lst)): for x in permutationsg(lst[:i]+lst[i+1:]): yield [lst[i]]+x else:

Re: Http server

2006-12-19 Thread Gert Cuykens
> > The cute secretary's name is "cherrypy.tools.staticdir". > > Check out her resume at http://www.cherrypy.org/wiki/StaticContent > > I think i am in love :) Cant believe this just works out import os.path import cherrypy pwd = os.path.dirname(os.path.abspath(__file__)) class Http: _cp_c

Re: When Closure get external variable's value?

2006-12-19 Thread Fredrik Lundh
Huayang Xia wrote: > I don't understand why while a nested function perfectly matches the > definition of closure, it is not closure simply because it is not used > by external world. Like so many other computing terms, the word "closure" is used in different ways by different people. Strictly

Re: Cpoying a PyList to a C string array

2006-12-19 Thread Sheldon
Klaas skrev: > Sheldon wrote: > > The code below is a rookie attempt to copy a python list of strings to > > a string array in C. It works to some extent but results in memory > > problems when trying to free the C string array. Does anyone know how > > to do this properly? > > You have numerous

Re: Class property with value and class

2006-12-19 Thread Ben Finney
"manstey" <[EMAIL PROTECTED]> writes: > Is is possible to have two classes, ClassA and ClassB, and > setattr(ClassA, 'xx',ClassB), AND to then have ClassA.xx store an > integer value as well, which is not part of ClassB? You seem somewhat confused over classes and instances. There's little need t

Re: Http server

2006-12-19 Thread Gert Cuykens
Does anybody know how to redirect a post request ? i have a js file that does a post request to a /php/action.php file and i would like for the secretary to just do the action method instead that is defined in her python Http class book, so i can run both php and python without changing the static

Re: Cpoying a PyList to a C string array

2006-12-19 Thread Klaas
Sheldon wrote: > Thanks Mike, > > I am rewriting the code but I don't understand the part about the c > struct variable called work. The function I posted is a part of a > larger script and I just posted that part that was problamatic. I was > under the impression that if I declared the structure

Re: Page layouts in mod_python?

2006-12-19 Thread Graham Dumpleton
Bruno Desthuilliers wrote: > Michael a écrit : > > Hey everyone, > > > > Is it possible to automatically insert headers/footers using > > mod_python? > > I will be not be using PSP's, so I cannot use the PSP/include solution. > > Furthermore, the header will be dynamic; it won't be a static HTML >

Re: trouble getting google through urllib

2006-12-19 Thread Dr. Locke Z2A
I looked at those APIs and it would appear that SOAP isn't around anymore and there are no APIs for google translate :( Can anyone tell me how to set the user-agent string in the HTTP header? -- http://mail.python.org/mailman/listinfo/python-list

MySQLdb, lots of columns and newb-ness

2006-12-19 Thread Andrew Sackville-West
Hi list, I've tried, lots of interpreter testing and google grepping to figure this out and I think I'm missing something fundamental. I have an ascii data dump from a POS system that has 131 fields in a single column in a flat file. I can easily open the file, read in the data and assemble it i

tricky(?) win32com question - Mark Hammond or other experts please.

2006-12-19 Thread cfriedalek
OK, I've asked this earlier this week with no response. Since then I've also received a suggestion from the app developers but that failed with the same type error problem. Hopefully Mark Hammond or other experts can offer a suggestion as to how to get around this problem. I'm foolish enough to thi

Re: Tkdnd--does anyone use it?

2006-12-19 Thread klappnase
> I use it in phonoripper > (http://klappnase.zexxo.net/phonoripper.index.html) to drag files from > Oops, wrong link address, should be: http://klappnase.zexxo.net/phonoripper/index.html Apologies Michael -- http://mail.python.org/mailman/listinfo/python-list

Re: tricky(?) win32com question - Mark Hammond or other experts please.

2006-12-19 Thread John Machin
[EMAIL PROTECTED] wrote: > OK, I've asked this earlier this week with no response. Since then I've > also received a suggestion from the app developers but that failed with > the same type error problem. Hopefully Mark Hammond or other experts > can offer a suggestion as to how to get around this

Re: regexp

2006-12-19 Thread Jonathan Curran
On Tuesday 19 December 2006 15:32, Paul Arthur wrote: > On 2006-12-19, vertigo <[EMAIL PROTECTED]> wrote: > > Hello > > > >> Take a look at Chapter 8 of 'Dive Into Python.' > >> http://diveintopython.org/toc/index.html > > > > i read whole regexp chapter - > > Did you read Chapter 8? Regexes are 7

RE: regexp

2006-12-19 Thread Mark Schoonover
Jonathan Curran wrote: > On Tuesday 19 December 2006 15:32, Paul Arthur wrote: >> On 2006-12-19, vertigo <[EMAIL PROTECTED]> wrote: >>> Hello >>> Take a look at Chapter 8 of 'Dive Into Python.' http://diveintopython.org/toc/index.html >>> >>> i read whole regexp chapter - >> >> Did you

Re: MySQLdb, lots of columns and newb-ness

2006-12-19 Thread Todd Neal
Andrew Sackville-West wrote: > > I can successfully connect to mysql and do stuff to my tables my > specific problem is how to efficiently put those 132 fields into the > thing. All I have been able to figure out is really ugly stuff like: > build the mysql statement out of various pieces with appr

Re: regexp

2006-12-19 Thread johnzenger
Not just Python, but every Regex engine works this way. You want a ? after your *, as in <--(.*?)--> if you want it to catch the first available "-->". At this point in your adventure, you might be wondering whether regular expressions are more trouble than they are worth. They are. There are t

Simplest way to do Python/Ajax with server and client on same machine?

2006-12-19 Thread Kenneth McDonald
I'm doing some work with a Python program that works hand-in-hand with the DOM on a local client (processing DOM events, issuing DOM modification commands, etc.) I'm currently using cherrypy as the Python server for this communication, and simple AJAX on the client browser end. This works just

Re: Can a Tkinter GUI check for abort script:

2006-12-19 Thread Hendrik van Rooyen
Michael Yanowitz top posted (again): >No. test3.py (for example) is just plain Python code that sends and receives socket data >from another machine. It does (or could) contain loops that last a long time, repeating >the read or write operations to and from the socket. This grabs the CPU. > Wh

Re: MySQLdb, lots of columns and newb-ness

2006-12-19 Thread Andrew Sackville-West
On Tue, Dec 19, 2006 at 07:34:58PM -0800, Todd Neal wrote: > Andrew Sackville-West wrote: > > > > I can successfully connect to mysql and do stuff to my tables my > > specific problem is how to efficiently put those 132 fields into the > > thing. All I have been able to figure out is really ugly s

Re: Simplest way to do Python/Ajax with server and client on same machine?

2006-12-19 Thread Adonis Vargas
Kenneth McDonald wrote: > I'm doing some work with a Python program that works hand-in-hand with > the DOM on a local client (processing DOM events, issuing DOM > modification commands, etc.) I'm currently using cherrypy as the Python > server for this communication, and simple AJAX on the clien

Working with unsigned/signed types

2006-12-19 Thread brian
Hi everyone- I've been away from coding for a while (I turned into a professional photographer)... So now I've taken up a project involving working with EXIF and XMP metadata in image files (mainly JPEG and TIFF), and am having some trouble figuring out how to handle some of the data... Here's w

Re: def index(self):

2006-12-19 Thread Tim Roberts
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >Gert Cuykens a écrit : >>> FWIW, the first version raises an exception (unless of course the name >>> 'index' is already bound in the enclosing scope). And the second won't >>> probably work as expected with CherryPy. >> >> >> class HelloWorld: >>

Re: MySQLdb, lots of columns and newb-ness

2006-12-19 Thread Felix Benner
Andrew Sackville-West schrieb: > I have an ascii data dump from a POS system that has 131 fields in a > single column in a flat file. I can easily open the file, read in the > data and assemble it into various formats. okay. what I *want* to do > is insert each of these fields into a mysql databas

using methods base64 module in conjunction with Crypto.Hash.SHA256

2006-12-19 Thread mirandacascade
I am attempting to implement a process, and I'm pretty sure that a major roadblock is that I do not understand the nomenclature. The specs indicate that the goal is to calculate a message digest using an SHA-256 algorithm. There are 2 examples included with the specs. The label on the 2 examples

python script terminating

2006-12-19 Thread Aditya Vaish
Using perl

Re: Working with unsigned/signed types

2006-12-19 Thread Ben Finney
<[EMAIL PROTECTED]> writes: > The first part of the question is fairly basic - in C, working with > signed integers, the MSB (is that still the right term?) is used to > denote positive and negative, and the following bits increase > towards positive infinity, correct? Such that in C, adding one

Re: trouble getting google through urllib

2006-12-19 Thread Amit Khemka
On 19 Dec 2006 16:12:59 -0800, Dr. Locke Z2A <[EMAIL PROTECTED]> wrote: > I looked at those APIs and it would appear that SOAP isn't around > anymore and there are no APIs for google translate :( Can anyone tell > me how to set the user-agent string in the HTTP header? import urllib2 req = urllib

Fall of Roman Empire

2006-12-19 Thread John Machin
Ben Finney wrote: > \ "...one of the main causes of the fall of the Roman Empire was | > `\that, lacking zero, they had no way to indicate successful | > _o__) termination of their C programs." -- Robert Firth | An amusing .sig, but it doesn't address the root cau

Re: Working with unsigned/signed types

2006-12-19 Thread brian
That seems like it'll do the trick quite well. As far as the future generations go, there's no question as to whether it would last if it were on my site - there are always changes being made to it and I'm not expecting it to be very stable over the course of time, especially since it would confus

Re: Fall of Roman Empire

2006-12-19 Thread Ben Finney
"John Machin" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > > \ "...one of the main causes of the fall of the Roman Empire was | > > `\that, lacking zero, they had no way to indicate successful | > > _o__) termination of their C programs." -- Robert Firth | > >

<    1   2