Re: argument to python cgi script

2008-04-10 Thread Gabriel Genellina
En Wed, 09 Apr 2008 11:14:33 -0300, syed mehdi <[EMAIL PROTECTED]> escribió: > Hi Guys, > If someone can help me in telling how can i pass arguments to python cgi > script then that will be good. > like if i want to pass "some argument" to my remote python script, by > calling something like: >

Re: wrapping C functions in python

2008-04-10 Thread Diez B. Roggisch
Paul Anton Letnes schrieb: > Brian and Diez: > > First of all, thanks for the advice. > > Brian: > > I have installed NumPy and SciPy, but I can't seem to find a wavelet > transform there. > > The main point of this was more to learn C wrapping than to actually get > a calculation done. I wil

SWIG/C++

2008-04-10 Thread Bill Davy
Is there a better place to post such questions? Anyway, in the hope it is something simple, I would appreciate some help. I am adding some C++ code to Python. From Python I want to be able to read data from a target device, over USB. My software does all the hard work and I have a class: cla

Re: new user needs help!

2008-04-10 Thread Chris
On Apr 9, 11:02 pm, drjekil <[EMAIL PROTECTED]> wrote: > I have done something so far about that problem,but its not the good way to > do it > > need ur comments about that > > from string import  *; > import sys > > myfile = open("/afs/pdc.kth.se/home/d/debnath/membrane/1a91A.txt") > a = myfil

questions about Exceptions?

2008-04-10 Thread skanemupp
is there a general philosophy as to when to use exceptions and when not to? like here: def Calc(): global nbr try: print eval(nbr) except: print "Not computable" nbr = "" i have a calculator and nbr is a string that contains '0123456789+-*/' if the string ends on

Re: new user needs help!

2008-04-10 Thread Chris
On Apr 10, 10:07 am, Chris <[EMAIL PROTECTED]> wrote: > On Apr 9, 11:02 pm, drjekil <[EMAIL PROTECTED]> wrote: > > > > > I have done something so far about that problem,but its not the good way to > > do it > > > need ur comments about that > > > from string import  *; > > import sys > > > myfi

Re: How to find documentation about methods etc. for iterators

2008-04-10 Thread tinnews
Terry Reedy <[EMAIL PROTECTED]> wrote: > > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | I'm not sure if I have even phrased that right but anyway > | > | How does one find (in the standard Python documentation) information > | about things like the iteritems() method and

urgent question, about filesystem-files

2008-04-10 Thread bvidinli
i started python programming a few months ago. now i need the code to understand if a file already opened in filesystem by another process ? i looked at docs, howtos, but did not find related info. note that normal file open/write operations in python, i know it. i specificly need to know that "

Re: email header decoding fails

2008-04-10 Thread Gabriel Genellina
En Wed, 09 Apr 2008 23:12:00 -0300, ZeeGeek <[EMAIL PROTECTED]> escribió: > It seems that the decode_header function in email.Header fails when > the string is in the following form, > > '=?gb2312?Q?=D0=C7=C8=FC?=(revised)' > > That's when a non-encoded string follows the encoded string without >

Re: urgent question, about filesystem-files

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 05:11:09 -0300, bvidinli <[EMAIL PROTECTED]> escribió: > i started python programming a few months ago. > > now i need the code to understand if a file already opened in > filesystem by another process ? > > i looked at docs, howtos, but did not find related info. > note that n

Re: I am worried about Python 3

2008-04-10 Thread Gerhard Häring
John Nagle wrote: > jmDesktop wrote: > >> If I continue in Python 2.5.x, am I making a mistake? Is it really >> that different? > >No. It may never happen, either. The Perl crowd tried > something like this, Perl 6, which was announced in 2000 and still > hasn't come out. The C++ standard

Re: urgent question, about filesystem-files

2008-04-10 Thread Gary Herron
bvidinli wrote: > i started python programming a few months ago. > > now i need the code to understand if a file already opened in > filesystem by another process ? > > i looked at docs, howtos, but did not find related info. > note that normal file open/write operations in python, i know it. > > i

Fwd: urgent question, about filesystem-files

2008-04-10 Thread bvidinli
Sory for lack of information, i use linux/unix i need to solve this for linux/unix i tested os.open with O_EXCL flag, and some other things, that did not solve. i need exacly: say example file testfile, check if testfile already open by some other process in linux, tahnks. 2008/4/10, G

Re: urgent question, about filesystem-files

2008-04-10 Thread bvidinli
The need/reason for this, i write a program that should perform some operation on files, only if the file is not being used this is for ensuring that file is not in use, ... by any process in system 10.04.2008 tarihinde bvidinli <[EMAIL PROTECTED]> yazmış: > Sory for lack of information

Re: what's the reasonale of loghelper() in mathmodule.c

2008-04-10 Thread rockins
On Apr 9, 9:11 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Apr 9, 4:38 am,rockins<[EMAIL PROTECTED]> wrote: > > > I cannot understand it well, can anyone explain me why and how > > loghelper() can compute any base logarithm? Or could anyone give me > > some reference(such as, books or papers

Re: questions about Exceptions?

2008-04-10 Thread cokofreedom
In general you should only catch the exceptions you want to catch, therefore avoiding the issue of catching "unexpected" ones, for instances the programming unexpectandly closing. Well, exception handling is expensive (when it catches one) so it really is up to you. If you are using eval and know

Re: How to find documentation about methods etc. for iterators

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 05:24:24 -0300, <[EMAIL PROTECTED]> escribió: > Terry Reedy <[EMAIL PROTECTED]> wrote: >> >> <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> | I'm not sure if I have even phrased that right but anyway >> | >> | How does one find (in the standard Python doc

Re: Sorting Directories from files in a os.listdir??

2008-04-10 Thread Giampaolo Rodola'
On 10 Apr, 11:55, Soren <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like to read the filenames in a directory, but not the > subdirectories, os.listdir() gives me everything... how do I separate > the directory names from the filenames? Is there another way of doing > this? > > Thanks! I guess you ha

Re: call python from c -> pass and return arrays/lists

2008-04-10 Thread Diez B. Roggisch
Pieter wrote: > Hi all, > > I'm trying to call a python function from c. I need to pass an > 2D-array to python and the python function returns a 2D-list back to > c. I googled arround and I found how to pass ints/strings/... back and > forth, but didn't find anything on passing arrays. > > For

Re: How is GUI programming in Python?

2008-04-10 Thread David Cook
On 2008-04-10, Chris Stewart <[EMAIL PROTECTED]> wrote: > I've always had an interest in Python and would like to dabble in it > further. I've worked on a few very small command line programs but > nothing of any complexity. I'd like to build a really simple GUI app > that will work across

Re: email header decoding fails

2008-04-10 Thread ZeeGeek
On Apr 10, 4:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 09 Apr 2008 23:12:00 -0300, ZeeGeek <[EMAIL PROTECTED]> escribió: > > > It seems that the decode_header function in email.Header fails when > > the string is in the following form, > > > '=?gb2312?Q?=D0=C7=C8=FC?=(revised)

Re: Sorting Directories from files in a os.listdir??

2008-04-10 Thread David Harrison
On 10/04/2008, Soren <[EMAIL PROTECTED]> wrote: > Hi, > > I'd like to read the filenames in a directory, but not the > subdirectories, os.listdir() gives me everything... how do I separate > the directory names from the filenames? Is there another way of doing > this? The only thing I can thin

Re: urgent question, about filesystem-files

2008-04-10 Thread Gerhard Häring
bvidinli wrote: > i started python programming a few months ago. > > now i need the code to understand if a file already opened in > filesystem by another process ? > > i looked at docs, howtos, but did not find related info. > note that normal file open/write operations in python, i know it. >

Re: email header decoding fails

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 05:45:41 -0300, ZeeGeek <[EMAIL PROTECTED]> escribió: > On Apr 10, 4:31 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Wed, 09 Apr 2008 23:12:00 -0300, ZeeGeek <[EMAIL PROTECTED]> >> escribió: >> >> > It seems that the decode_header function in email.Header fails

Sorting Directories from files in a os.listdir??

2008-04-10 Thread Soren
Hi, I'd like to read the filenames in a directory, but not the subdirectories, os.listdir() gives me everything... how do I separate the directory names from the filenames? Is there another way of doing this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting Directories from files in a os.listdir??

2008-04-10 Thread Soren
On Apr 10, 12:14 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 10 Apr 2008 06:55:13 -0300, Soren <[EMAIL PROTECTED]> > escribió: > > > I'd like to read the filenames in a directory, but not the > > subdirectories, os.listdir() gives me everything... how do I separate > > the director

Re: questions about Exceptions?

2008-04-10 Thread cokofreedom
> def Calc(): > global nbr > try: > print eval(nbr) > #a = Label(mygui, text=eval(nbr)) > #a.place(relx=0.4, rely=0.1, anchor=CENTER) > except: > print "Not computable" > nbr = "" > > def Erase(): > global nbr > nbr = "" Seems to me you could

Re: I am worried about Python 3

2008-04-10 Thread Carl Banks
On Apr 9, 11:53 am, John Nagle <[EMAIL PROTECTED]> wrote: > jmDesktop wrote: > > If I continue in Python 2.5.x, am I making a mistake? Is it really > > that different? > > No. It may never happen, either. The Perl crowd tried > something like this, Perl 6, which was announced in 2000 and sti

Re: urgent question, about filesystem-files

2008-04-10 Thread bvidinli
* i do not want to prevent other process access same file, i only want if a file being used as i acess it. * i am not interested if a process will access same file just after i access it... because in my case, this is not possible.. * i want some other way, other than linux lsof command. it is s

Re: questions about Exceptions?

2008-04-10 Thread skanemupp
On 10 Apr, 12:38, [EMAIL PROTECTED] wrote: > > def Calc(): > > global nbr > > try: > > print eval(nbr) > > #a = Label(mygui, text=eval(nbr)) > > #a.place(relx=0.4, rely=0.1, anchor=CENTER) > > except: > > print "Not computable" > > nbr = "" > > > def

call python from c -> pass and return arrays/lists

2008-04-10 Thread Pieter
Hi all, I'm trying to call a python function from c. I need to pass an 2D-array to python and the python function returns a 2D-list back to c. I googled arround and I found how to pass ints/strings/... back and forth, but didn't find anything on passing arrays. For an int it's as simple as this:

Re: urgent question, about filesystem-files

2008-04-10 Thread Diez B. Roggisch
bvidinli wrote: > this is for ensuring that file is not in use, ... > by any process  in system How do you prevent the other processes that *might* access that file from doing so while *you* work on it? unless they cooperate using file-locks, you might end up with garbage. Diez -- http://ma

Re: urgent question, about filesystem-files

2008-04-10 Thread Robert.Spilleboudt
bvidinli wrote: > i started python programming a few months ago. > > now i need the code to understand if a file already opened in > filesystem by another process ? > > i looked at docs, howtos, but did not find related info. > note that normal file open/write operations in python, i know it. >

Re: Sorting Directories from files in a os.listdir??

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 06:55:13 -0300, Soren <[EMAIL PROTECTED]> escribió: > I'd like to read the filenames in a directory, but not the > subdirectories, os.listdir() gives me everything... how do I separate > the directory names from the filenames? Is there another way of doing > this? Check each

Re: How to find documentation about methods etc. for iterators

2008-04-10 Thread Tim Chase
> First question, what sort of 'thing' is the file object, I need to > know that if I'm to look up ways of using it. you can always use type(thing) to find out what type it is. > Second question, even if I know what sort of thing a file object > is, how do I find methods appl

Re: questions about Exceptions?

2008-04-10 Thread skanemupp
On 10 Apr, 10:51, [EMAIL PROTECTED] wrote: > In general you should only catch the exceptions you want to catch, > therefore avoiding the issue of catching "unexpected" ones, for > instances the programming unexpectandly closing. > > Well, exception handling is expensive (when it catches one) so it

Re: wrapping C functions in python

2008-04-10 Thread Jaap Spies
Paul Anton Letnes wrote: > Hi, and thanks. > > > However, being a newbie, I now have to ask: What is SWIG? I have heard > the name before, but haven't understood what it is, why I need it, or > similar. Could you please supply some hints? > [...] >>> >>> I am a "scientific" user of Python, and

Re: questions about Exceptions?

2008-04-10 Thread skanemupp
here is the whole code: from __future__ import division import Tkinter from Tkinter import * mygui = Tkinter.Tk() mygui.title("Calculator") w = Label(mygui, text="Answer: ") w.place(relx=0.15, rely=0.1, anchor=CENTER) nbr = "" def Disp(nstr): global nbr nbr=nbr+nstr print "You need

Re: questions about Exceptions?

2008-04-10 Thread cokofreedom
> the erase() id alwys need if u wanna abort whilst u wrote something. But if it is meant to only evaluate once you've pressed the enter key (I take it?) you shouldn't need that. And if you are to abort while evaluating it will not do that. -- http://mail.python.org/mailman/listinfo/python-list

problem with using gnuplot/demo.py

2008-04-10 Thread diljeet kaur
hi i want to use gnuplot with python i installed it seemingly successfully but when i try to run demo.py it gives the following error Traceback (most recent call last): File "C:\Python23\Lib\site-packages\Gnuplot\demo.py", line 113, in ? demo() File "C:\Python23\Lib\site-packages\Gnuplot

Re: questions about Exceptions?

2008-04-10 Thread skanemupp
On 10 Apr, 13:15, [EMAIL PROTECTED] wrote: > > the erase() id alwys need if u wanna abort whilst u wrote something. > > But if it is meant to only evaluate once you've pressed the enter key > (I take it?) you shouldn't need that. And if you are to abort while > evaluating it will not do that. CHA

Re: [Python-Fr] Réflexions sur l'auto complétion dans les éditeurs Python...

2008-04-10 Thread Matthieu Brucher
Le 10/04/08, Jul <[EMAIL PROTECTED]> a écrit : > > Bonjour à tous, > > L'un des problèmes des éditeurs de code Python est qu'il ne proposent pas > d'autocomplétion "intelligente", c'est à dire en cohérence avec l'objet en > cours de frappe. La plupart des éditeurs se basent sur des fichiers texte >

Re: problem with using gnuplot/demo.py

2008-04-10 Thread Paul Anton Letnes
Could you include some code around line 39 in demo.py? Also, you could try to comment out the stuff before that point, and see if the demo runs that far. Paul. hi i want to use gnuplot with python i installed it seemingly successfully but when i try to run demo.py it gives the following e

Re: How to find documentation about methods etc. for iterators

2008-04-10 Thread cokofreedom
> > This for me is Python's chief selling point: dir()dir() and > help(). Python's two selling points are dir(), help(), and very > readable code. Python's *three* selling points are dir(), > help(), very readable code, and an almost fanatical devotion to > the BFDL. Amongst Python's sellin

subprocess.Popen() output to logging.StreamHandler()

2008-04-10 Thread sven _
Version: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) My goal is to have stdout and stderr written to a logging handler. This code does not work: # START import logging, subprocess ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) subprocess.call(['ls', '-la'], 0, None, None, ch, ch) #

Re: questions about Exceptions?

2008-04-10 Thread skanemupp
from __future__ import division import Tkinter from Tkinter import * mygui = Tkinter.Tk() mygui.title("Calculator") l = Label(mygui, text="Answer: ") l.place(relx=0.15, rely=0.2, anchor=CENTER) e = Entry(mygui) e.place(relx=0.4, rely=0.1, anchor=CENTER) def Disp(nstr): e.insert(END, nstr)

Re: Sorting Directories from files in a os.listdir??

2008-04-10 Thread Scott David Daniels
Soren wrote: > Hi, > > I'd like to read the filenames in a directory, but not the > subdirectories, os.listdir() gives me everything... how do I separate > the directory names from the filenames? Is there another way of doing > this? > > Thanks! import os base, files, dirs = iter(os.wa

Re: text adventure game problem

2008-04-10 Thread corvettecraz92
On Apr 10, 3:14 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Wed, 9 Apr 2008 05:25:19 -0700 (PDT), [EMAIL PROTECTED] > declaimed the following in comp.lang.python: > > > > > I can't even compile your code to see how it works, Dennis. I'm > > confused about what that does. > >         My ap

Re: Sorting Directories from files in a os.listdir??

2008-04-10 Thread Peter Otten
Scott David Daniels wrote: >> I'd like to read the filenames in a directory, but not the >> subdirectories, os.listdir() gives me everything... how do I separate >> the directory names from the filenames? Is there another way of doing >> this? >> >> Thanks! > > import os > base, files,

tkinter, overwrite Label-text?

2008-04-10 Thread skanemupp
using python And tkinter. i have a GUI that outputs a text among other things. after input form user i want this text to be *)cleared and/or *)overwritten. what is the best way to achieve that? also, how do i make Label-text expand to the right and not to the left? -- http://mail.python.org/mai

Re: questions about Exceptions?

2008-04-10 Thread skanemupp
On 10 Apr, 12:38, [EMAIL PROTECTED] wrote: > > def Calc(): > > global nbr > > try: > > print eval(nbr) > > #a = Label(mygui, text=eval(nbr)) > > #a.place(relx=0.4, rely=0.1, anchor=CENTER) > > except: > > print "Not computable" > > nbr = "" > > > def

Re: call python from c -> pass and return arrays/lists

2008-04-10 Thread Pieter
Thanks, this did the trick: PyArg_Parse(ret,"O", &the_list); if (PySequence_Check(the_list)) { int size = PySequence_Size(the_list); int *result = malloc(sizeof(int) * size); int i; for (i = 0; i < size; i++) {

Re: I am worried about Python 3

2008-04-10 Thread Roy Smith
Gerhard Häring <[EMAIL PROTECTED]> wrote: > The difference is that Guido learnt from the mistakes of Perl 6 and set > much more realistic (moderate) goals for Python 3.0. Another difference is that by the time Perl 6 was being worked on, there were other new things on the horizon. People wanti

Re: tkinter, overwrite Label-text?

2008-04-10 Thread [EMAIL PROTECTED]
On Apr 10, 2:35 pm, [EMAIL PROTECTED] wrote: > using python And tkinter. > > i have a GUI that outputs a text among other things. after input form > user i want this text to be *)cleared and/or > *)overwritten. > > what is the best way to achieve that? > [...] Which widget do you use? Some widget

Re: tkinter, overwrite Label-text?

2008-04-10 Thread skanemupp
On 10 Apr, 15:28, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Apr 10, 2:35 pm, [EMAIL PROTECTED] wrote: > > > using python And tkinter. > > > i have a GUI that outputs a text among other things. after input form > > user i want this text to be *)cleared and/or > > *)overwritten. > > > what

Code-convention checker and possibly reformatter

2008-04-10 Thread Diez B. Roggisch
Hi, my new company requires me to adhere to some coding conventions - order of imports, amount of whitespace between method definitions and such stuff. Because I'm a lazy a**, I'd like to have some automatic checker that will ensure that I'm following the conventions. Now I know & use pylint - b

Re: subprocess.Popen() output to logging.StreamHandler()

2008-04-10 Thread Thomas Dimson
On Apr 10, 8:11 am, "sven _" <[EMAIL PROTECTED]> wrote: > Version: Python 2.5.1 (r251:54863, Mar  7 2008, 04:10:12) > > My goal is to have stdout and stderr written to a logging handler. > This code does not work: > > # START > import logging, subprocess > ch = logging.StreamHandler() > ch.setLevel

Re: tkinter, overwrite Label-text?

2008-04-10 Thread [EMAIL PROTECTED]
On Apr 10, 3:47 pm, [EMAIL PROTECTED] wrote: > [...] > i use the Label-widget. Then you should be able to connect a variable to your widget like I wrote in my previous post. Just try out the example from the Python documentation. Of course in your case entrythingy would be the Label-widget. Take c

https and POST method

2008-04-10 Thread Lorenzo Stella
Hi all, I'm trying to write a simple script for sending sms via vyke... I have to make a https connection and pass some data with the POST method, like this perl script does: http://www.nutella.org/vyke.sms.txt I tried to make the same, but it simply doesn't work! Any request gives a 200 OK resul

Re: tkinter, overwrite Label-text?

2008-04-10 Thread skanemupp
On 10 Apr, 16:29, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Apr 10, 3:47 pm, [EMAIL PROTECTED] wrote: > > > [...] > > i use the Label-widget. > > Then you should be able to connect a variable to your widget like I > wrote in my previous post. > Just try out the example from the Python doc

Re: @x.setter property implementation

2008-04-10 Thread Floris Bruynooghe
On Apr 7, 2:19 pm, "Andrii V. Mishkovskyi" <[EMAIL PROTECTED]> wrote: > 2008/4/7, Floris Bruynooghe <[EMAIL PROTECTED]>: > > > > > Have been grepping all over the place and failed to find it. I found > > the test module for them, but that doesn't get me very far... > > I think you should take a

Re: urgent question, about filesystem-files

2008-04-10 Thread Rick King
Could you first find out if it exists with isfile(..) and then try to open it? If it fails I *think* it would have to be open by another process. -Rick King Southfield MI bvidinli wrote: i started python programming a few months ago. now i need the code to understand if a file already o

Re: String Literal to Blob

2008-04-10 Thread Victor Subervi
Okay, here is where we find the fly in the ointment. If I run this code: #! /usr/bin/python import MySQLdb print "Content-type: image/jpeg\r\n" host = 'mysqldb2.ehost-services.com' db = 'benobeno_bre' user = 'benobeno' passwd = '21122112' connection = MySQLdb.connect(host=host, user=user, passwd=p

Re: tkinter, overwrite Label-text?

2008-04-10 Thread [EMAIL PROTECTED]
On Apr 10, 4:37 pm, [EMAIL PROTECTED] wrote: > [...] > i know how to do this already. the problem is i want the text to stay > in the windowa nd not start overwriting "Answer:". > i have solved this by using an Entry for the answer as well but id > prefer using a Label. > [...] You can set the wid

Python(x,y) - Free Python distribution for Scientists

2008-04-10 Thread Python(x,y) - Python for Scientists
Dear all, The scientists among you may be interested in Python(x,y), a new scientific-oriented Python distribution. This Python/Eclipse distribution is freely available as a one-click Windows installer (a release for GNU/Linux with similar features will follow soon): http://www.pythonxy.com Pleas

Re: PyArg_ParseTuple for structs or binary data

2008-04-10 Thread Alvin Delagon
Hello Gabriel, I just recently discovered that struct.pack does return a string. Everything works fine now. Thanks for the heads up! static PyObject * sendMessage(PyObject *self, PyObject *args) { char *msg = ""; int len; if (!PyArg_ParseTuple(args, "s#", &msg, &len)) return NULL; ret

Re: Stripping scripts from HTML with regular expressions

2008-04-10 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:python- > > [EMAIL PROTECTED] On Behalf Of Michel Bouwmans > > Sent: Wednesday, April 09, 2008 3:38 PM > > To: python-list@python.org > > Subject: Stripp

Re: SWIG/C++

2008-04-10 Thread Matthieu Brucher
Hi, The error is generated because you are asking for a u8*, but the buffer is not a u8*, perhaps a char* or even a void*. If you change the method signature to either char* or void*, it may work like you want it to ;) Matthieu 2008/4/10, Bill Davy <[EMAIL PROTECTED]>: > > Is there a better plac

Re: Stripping scripts from HTML with regular expressions

2008-04-10 Thread Paul McGuire
On Apr 9, 2:38 pm, Michel Bouwmans <[EMAIL PROTECTED]> wrote: > Hey everyone, > > I'm trying to strip all script-blocks from a HTML-file using regex. > > I tried the following in Python: > > testfile = open('testfile') > testhtml = testfile.read() > regex = re.compile(']*>(.*?)', re.DOTALL) > resul

Re: PyArg_ParseTuple for structs or binary data

2008-04-10 Thread Alvin Delagon
Hello Gabriel, I just recently discovered that struct.pack does return a string. Everything works fine now. Thanks for the heads up! static PyObject * sendMessage(PyObject *self, PyObject *args) { char *msg = ""; int len; if (!PyArg_ParseTuple(args, "s#", &msg, &len)) return NULL; ret

Re: is Pylons alive?

2008-04-10 Thread Ville Vainio
On Apr 9, 2:25 pm, Mage <[EMAIL PROTECTED]> wrote: > Before spending much time for investigating, I would like to ask you: is > Pylons the framework I look for if I want to come back to Python and > develop MVC web apps? Why not play with Django and the Google App Engine that everyone is raving a

Re: Can C.L.P.handle the load?

2008-04-10 Thread Berco Beute
On Apr 9, 12:24 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Berco Beute <[EMAIL PROTECTED]> wrote: > > On Apr 9, 7:54 am, Paddy <[EMAIL PROTECTED]> wrote: > >> What else could we do to make c.l.p. of more use to the newbie whp may > >> also be new to usenet whilst keeping c.l.p a usefull place fo

Re: subprocess.Popen() output to logging.StreamHandler()

2008-04-10 Thread Gerard Flanagan
On Apr 10, 2:11 pm, "sven _" <[EMAIL PROTECTED]> wrote: > Version: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) > > My goal is to have stdout and stderr written to a logging handler. > This code does not work: > > # START > import logging, subprocess > ch = logging.StreamHandler() > ch.setLevel

RE: Stripping scripts from HTML with regular expressions

2008-04-10 Thread Reedick, Andrew
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Michel Bouwmans > Sent: Wednesday, April 09, 2008 5:44 PM > To: python-list@python.org > Subject: RE: Stripping scripts from HTML with regular expressions > > > Thanks! That did the trick. :) I

Python conventions

2008-04-10 Thread MartinRinehart
I assembled a good conventions set for Java. View it at http://www.martinrinehart.com/articles/code-conventions.html (is that better, Steve?) It followed a logical organization; it was built from four other extensive (if not well-organized) convention sets and it scrupulously avoided injecting my

Re: subprocess.Popen() output to logging.StreamHandler()

2008-04-10 Thread Gerard Flanagan
On Apr 10, 5:34 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > On Apr 10, 2:11 pm, "sven _" <[EMAIL PROTECTED]> wrote: > > > > > Version: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) > > > My goal is to have stdout and stderr written to a logging handler. > > This code does not work: > [...]

Re: tkinter, overwrite Label-text?

2008-04-10 Thread Marc 'BlackJack' Rintsch
On Thu, 10 Apr 2008 07:37:08 -0700, skanemupp wrote: > i know how to do this already. the problem is i want the text to stay > in the windowa nd not start overwriting "Answer:". Then don't use `place()` but let Tkinter handle the layout with the pack and/or grid layout manager. GUIs with `place(

Re: @x.setter property implementation

2008-04-10 Thread Arnaud Delobelle
On Apr 10, 3:37 pm, Floris Bruynooghe <[EMAIL PROTECTED]> wrote: > On Apr 7, 2:19 pm, "Andrii V. Mishkovskyi" <[EMAIL PROTECTED]> wrote: > > > 2008/4/7, Floris Bruynooghe <[EMAIL PROTECTED]>: > > > >  Have been grepping all over the place and failed to find it.  I found > > >  the test module for t

Re: How to find documentation about methods etc. for iterators

2008-04-10 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Terry Reedy <[EMAIL PROTECTED]> wrote: | > | > <[EMAIL PROTECTED]> wrote in message | > news:[EMAIL PROTECTED] | > | I'm not sure if I have even phrased that right but anyway | > | | > | How does one find (in the standard Python do

Re: wrapping C functions in python

2008-04-10 Thread Ivan Illarionov
On Apr 10, 9:57 am, Paul Anton Letnes <[EMAIL PROTECTED]> wrote: [...] > , but as I mentioned, it seems to be a bit complicated to wrap heavy > data structures like arrays. Hello, I suggest that you might take a look at how other people solved the same problems. The great example is path.c insi

Tkinter: Entry, how to get INSERTpos?

2008-04-10 Thread skanemupp
in this function i want to be able to use the cursor and delete in the middle of a number. how do i get the value of anchor or insert? i want to write: e.delete(pos-1,pos) def Backspace(): a=len(e.get()) e.delete(a-1,END) #e.delete(INSERT, END) #e.delete(ANCHOR,END) the complete p

Tkinter, resize window, keep widgets relative placements?

2008-04-10 Thread skanemupp
the code is down below. when i click maximize window it looks terrible since the widgets are not keeping their relative size. i guess i could use pack or grid to do that instead of place? but i tried with pack and grid before and had trouble making it looking good. is it possible to have the minim

Cyclic relative imports don't work

2008-04-10 Thread Torsten Bronger
Hallöchen! Assume the follwing package structure: main.py package/ __init__.py [empty] moduleX.py moduleY.py main.py says: from package import moduleX moduleX.py says: from . import moduleY and moduleY.py says: from . import moduleX However, this doesn't work:

Re: How is GUI programming in Python?

2008-04-10 Thread Peter Decker
On Wed, Apr 9, 2008 at 8:54 PM, Chris Stewart <[EMAIL PROTECTED]> wrote: > I've always had an interest in Python and would like to dabble in it > further. I've worked on a few very small command line programs but > nothing of any complexity. I'd like to build a really simple GUI app > that wi

Re: String Literal to Blob

2008-04-10 Thread Steve Holden
Victor Subervi wrote: > Okay, here is where we find the fly in the ointment. If I run this code: > > #! /usr/bin/python > import MySQLdb > print "Content-type: image/jpeg\r\n" > host = 'mysqldb2.ehost-services.com ' > db = 'benobeno_bre' > user = 'benobeno' > p

class

2008-04-10 Thread Arun ragini
Hi, I have create a class file named Mysqldb.py class Mysqldb: def __init__(self, name): #this where it tries to connect to database self.ip = ip print "Inializing session for name" def test(self): print "worked" --

Re: How is GUI programming in Python?

2008-04-10 Thread Michel Bouwmans
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Paul Rubin wrote: > Chris Stewart <[EMAIL PROTECTED]> writes: >> I've always had an interest in Python and would like to dabble in it >> further. I've worked on a few very small command line programs but >> nothing of any complexity. I'd like to bui

Re: Data structure recommendation?

2008-04-10 Thread Jochen Schulz
* [EMAIL PROTECTED]: > > Please plug such good things. It seems the Python community is an > endless source of interesting modules I didn't know about. Your > (single) module looks very nice. I'll take a better look later. Could you please send me an email with an existing From: address? I tried

Graphs in Python

2008-04-10 Thread Sanhita Mallick
Hi. I am a newbie to Python. I am trying to implement a Python code for graph manipulation. My graphs are about 200-500 nodes big. Excepting for the short basic graph implementation info on Python.org, where can I find more in depth info about how to express graphs in python, and how to use them i

Re: Python conventions

2008-04-10 Thread Daniel Fetchinson
> I assembled a good conventions set for Java. View it at > http://www.martinrinehart.com/articles/code-conventions.html (is that > better, Steve?) > > It followed a logical organization; it was built from four other > extensive (if not well-organized) convention sets and it scrupulously > avoided

Re: subprocess.Popen() output to logging.StreamHandler()

2008-04-10 Thread Vinay Sajip
On Apr 10, 1:11 pm, "sven _" <[EMAIL PROTECTED]> wrote: > Version: Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) > > My goal is to have stdout and stderr written to alogginghandler. > This code does not work: > > # START > importlogging, subprocess > ch =logging.StreamHandler() > ch.setLevel(log

Re: How is GUI programming in Python?

2008-04-10 Thread Paul Rubin
Michel Bouwmans <[EMAIL PROTECTED]> writes: > > If by "best" you mean "easiest", that is probably tkinter, > I don't quite agree with you on this. Tkinter may be easy because it is > available by standard in Python, but that's about it in my opinion. The > API, look and performance hit is horribl

RE: Stripping scripts from HTML with regular expressions

2008-04-10 Thread Michel Bouwmans
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Reedick, Andrew wrote: >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:python- >> [EMAIL PROTECTED] On Behalf Of Michel Bouwmans >> Sent: Wednesday, April 09, 2008 5:44 PM >> To: python-list@python.org >> Subject: RE: Stripping script

get array element

2008-04-10 Thread [EMAIL PROTECTED]
I have an array, and I would like to get the indice value. a = array([13,14,15,16]) I would like something like a.getindice(15) If I want 15 it would return 2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, resize window, keep widgets relative placements?

2008-04-10 Thread skanemupp
here i didi it with pack() but when i try to use the answerwidget it gtes all f* up. any suggestions? from __future__ import division import Tkinter from Tkinter import * mygui = Tkinter.Tk() mygui.title("Calculator") ##l = Label(mygui, text="Answer: ") ##l.grid(row=2, column=1, columnspan

Re: How is GUI programming in Python?

2008-04-10 Thread Mike Driscoll
On Apr 10, 12:05 pm, Michel Bouwmans <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > > Paul Rubin wrote: > > Chris Stewart <[EMAIL PROTECTED]> writes: > >> I've always had an interest in Python and would like to dabble in it > >> further. I've worked on a few ver

Re: Module Conflicts

2008-04-10 Thread Jose
On Apr 9, 10:36 pm, Benjamin <[EMAIL PROTECTED]> wrote: > On Apr 9, 5:33 pm, Jose <[EMAIL PROTECTED]> wrote: > > > I have a module named math.py in a package with some class > > definitions. I am trying to import the standard python math module > > inside of math.py but It seems to be importing it

from __future__ import print

2008-04-10 Thread [EMAIL PROTECTED]
Am I the only one that thinks this would be useful? :) I'd really like to be able to use python 3.0's print statement in 2.x. Is this at least being considered as an option for 2.6? It seems like it would be helpful with transitioning. -- http://mail.python.org/mailman/listinfo/python-list

Re: PROBLEMS WITH PYTHON IN SOME VARIABLE,FUNCTIONS,ETC.

2008-04-10 Thread John Nagle
[EMAIL PROTECTED] wrote: > I am using Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v. > 1310 32 bit (Intel)] on win32 with IDLE 1.2.1 > My O/S is Windows XP SP2 I use 512 MB RAM. > I am encountering the following problems: > (i) a1=1 > a2=2 > a3=a1+a2 > print a3 > # The result

Re: String Literal to Blob

2008-04-10 Thread Victor Subervi
Well, what I did was this: content = col_fields[0][14].tostring() pic = "tmp" + str(i) + ".jpg" img = open(pic, "w") img.write(content) print '' % pic img.close() where I am incrementing i. Ugly. Stupid. But if it is the only

  1   2   >