pty.spawn directs stderr to stdout

2008-04-10 Thread Wilbert Berendsen
Hi, using pty.spawn() it seems that stderr output of the spawned process is directed to stdout. Is there a way to keep stderr separate and only direct stdin and stdout to the pty? TIA, w best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ "You must be the change you wish to see

Re: email header decoding fails

2008-04-10 Thread ZeeGeek
On Apr 10, 5:18 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > 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]> > >> escri

Re: Pydev 1.3.15 Released

2008-04-10 Thread Aubrey Hutchison
Hi, I have tried Pydev as used in Python(x,y). I tend to like it but I miss a couple of things.. When viewing the code, Line numbers can be added for reference. This is a very good thing BUT if line numbers are useful in the monitor screen view they would of course be desirable in a hard copy. B

Re: Cannot understand the detailedly the following code

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 23:57:29 -0300, <[EMAIL PROTECTED]> escribió: > i.e. you give, the graph, the start and end vertices as inputs and you > get the output as a listing of all the paths. This is where I got to. > It would be very nice if you could kindly hint on how to proceed > further. Thank you

Re: Integer dicision

2008-04-10 Thread casevh
On Apr 10, 9:28 pm, bdsatish <[EMAIL PROTECTED]> wrote: > How does (a/b) work when both 'a' and 'b' are pure integers ? Python defines the quotient and remainder from integer division so that a = qb + r and 0<=r < abs(b). C/C++ lets the remainder be negative. >>> divmod(-9,2) (-5, 1) >>> divmod(9

Re: Integer dicision

2008-04-10 Thread jim
it rounds down. 4 is less than 4.5 and -5 is less than -4.5. On Thu, 2008-04-10 at 21:28 -0700, bdsatish wrote: > How does (a/b) work when both 'a' and 'b' are pure integers ? > > >> (9/2) > 4 > > >> (-9/2) > -5 > > Why is it -5 ? I expect it to be -4 ? Because, in C/C++, 9/2 is 4 and > so n

Re: Integer dicision

2008-04-10 Thread Steve Holden
bdsatish wrote: > How does (a/b) work when both 'a' and 'b' are pure integers ? > >>> (9/2) > 4 > >>> (-9/2) > -5 > > Why is it -5 ? I expect it to be -4 ? Because, in C/C++, 9/2 is 4 and > so negative of it, (-9/2) is -4. > > What should I do to get C-like behavior ? Use C? regards Steve -

Integer dicision

2008-04-10 Thread bdsatish
How does (a/b) work when both 'a' and 'b' are pure integers ? >> (9/2) 4 >> (-9/2) -5 Why is it -5 ? I expect it to be -4 ? Because, in C/C++, 9/2 is 4 and so negative of it, (-9/2) is -4. What should I do to get C-like behavior ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert PyIDispatch object to struct IDispatch*

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 18:45:04 -0300, Huayang Xia <[EMAIL PROTECTED]> escribió: > I am trying to use ctypes to call dll functions. One of the functions > requires argument "struct IDispatch* ". I do have a PyIDispatch object > in python. How can I convert this "PyIDispatch object" to "struct > IDi

Re: Module Conflicts

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 17:41:29 -0300, Ivan Illarionov <[EMAIL PROTECTED]> escribió: > On Apr 11, 12:31 am, Ivan Illarionov <[EMAIL PROTECTED]> > wrote: >> On Apr 10, 2:33 am, Jose <[EMAIL PROTECTED]> wrote: >> >> > I have a module named math.py in a package with some class >> > definitions. I am t

Re: Python conventions

2008-04-10 Thread John Nagle
Daniel Fetchinson wrote: > I'm sorry to disappoint you but this project has already been completed: > > http://www.python.org/dev/peps/pep-0008/ Good point. It's probably time for CPython to enforce the rule that you can indent with either tabs or spaces, but cannot mix them. Which to u

Re: Python conventions

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 16:52:11 -0300, <[EMAIL PROTECTED]> escribió: > Daniel Fetchinson wrote: >> I'm sorry to disappoint you but this project has already been completed: >> >> http://www.python.org/dev/peps/pep-0008/ > > Daniel, PEP 8 is anything but complete. How much of the following > simple ques

Re: How is GUI programming in Python?

2008-04-10 Thread David Cook
On 2008-04-10, Paul Rubin wrote: > Well, it's a trade-off, the person wanted a cross platform gui and the > #1 hurdle for something like PyQt4 is getting it to work on each of > the platforms you desire to run on. Installing Pyqt on windows involves a couple "click to install" EXEs. On Linux,

Re: How is GUI programming in Python?

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 20:01:43 -0300, Steve Holden <[EMAIL PROTECTED]> escribió: > Michel Bouwmans wrote: >> >> Mike Driscoll wrote: >>> I see a lot of people recommend using pyQt, but they never mention the >>> controversy that surrounds its licensing. There have been many posts >>> on the subjec

Re: Cannot understand the detailedly the following code

2008-04-10 Thread reachmsn
On Apr 9, 8:12 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > On 2008-04-09, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > On Apr 8, 5:45 pm, "A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: > > Ok following these instructions one gets > > > def find_all_paths(graph, start, end, path=[]): > >

Re: How to use my dynamic link libraries in python??

2008-04-10 Thread Benjamin
On Apr 10, 9:21 pm, "郭勇军" <[EMAIL PROTECTED]> wrote: > Hello: > My OS is Linux, I compile my dynamic link libraries , and > want to call the function of my dynamic library through python! > How can I realize the function? Please give me some advices! Thanks You have several opt

Re: mod_python and storing binary form data

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 15:43:23 -0300, <[EMAIL PROTECTED]> escribió: > Hi, I have a little python webservice that I created, and in one of > the methods I need to store some binary data that was "posted"... I > want to do something like this, but it doesn't work. > > username = form.get("username", "

How to use my dynamic link libraries in python??

2008-04-10 Thread 郭勇军
Hello: My OS is Linux, I compile my dynamic link libraries , and want to call the function of my dynamic library through python! How can I realize the function? Please give me some advices! Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: String Literal to Blob

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 14:04:43 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > 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

Re: text adventure game problem

2008-04-10 Thread Carl Banks
On Apr 10, 2:20 pm, Tommy Nordgren <[EMAIL PROTECTED]> wrote: > On 9 apr 2008, at 03.01, [EMAIL PROTECTED] wrote: > > > okay, I'm having this one problem with a text adventure game. It's > > kind of hard to explain, but I'll do my best. > > [code] > > > def prompt_kitchen(): > >global gold > >

Re: Adding classes to modules at runtime from outside that module

2008-04-10 Thread Andrew Warkentin
[EMAIL PROTECTED] wrote: > In Python, is it possible to add classes to a module at run-time? > > Say I have a module foo and a module bar. Foo has class A and B, and >bar has class C. I want to add class C to foo so I can access it as >foo.C, but i want to do it without modifying foo's source. >

Re: Adding classes to modules at runtime from outside that module

2008-04-10 Thread Jeffrey Froman
[EMAIL PROTECTED] wrote: > In Python, is it possible to add classes to a module at run-time? > > Say I have a module foo and a module bar. Foo has class A and B, and > bar has class C. I want to add class C to foo so I can access it as > foo.C, but i want to do it without modifying foo's source.

How to modify EVDEV.py to record ASCII characters instead of keystrokes ?

2008-04-10 Thread Dr. Colombes
I've used EVDEV.py successfully as a keystroke logger on Linux machines. How should EVDEV.py be modified to function as an ASCII character logger? That is, to record upper and lower case letters, lower case "5" and upper case "%" characters, etc. Shift and Caps Lock key press events are recorde

Adding classes to modules at runtime from outside that module

2008-04-10 Thread frambooz
Hey guys, In Python, is it possible to add classes to a module at run-time? Say I have a module foo and a module bar. Foo has class A and B, and bar has class C. I want to add class C to foo so I can access it as foo.C, but i want to do it without modifying foo's source. Is this at all pos

Re: String Literal to Blob

2008-04-10 Thread Steve Holden
Victor Subervi wrote: > 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 incrementin

Re: How is GUI programming in Python?

2008-04-10 Thread Steve Holden
Michel Bouwmans wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Mike Driscoll wrote: > >> On Apr 10, 12:05 pm, Michel Bouwmans <[EMAIL PROTECTED]> wrote: >>> -BEGIN PGP SIGNED MESSAGE- >>> Hash: SHA1 >>> >>> >>> >>> Paul Rubin wrote: Chris Stewart <[EMAIL PROTECTED]> wri

Re: problem with using gnuplot/demo.py

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 08:59:35 -0300, Paul Anton Letnes <[EMAIL PROTECTED]> escribió: > 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. And please include the error type and message too

Re: Module Conflicts

2008-04-10 Thread Steve Holden
Terry Reedy wrote: > "Jose" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > | 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 > | > > definition

Re: win-shortcuts, file associates and command-line parameters ?

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 16:03:28 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: > under windows I tried to make a shortcut to a py -file, to run a program. > So making a shortcut like this works perfect: > D:\PyLab_Works.py > > But the problem is that I need to give some commandline parameters

Re: Reading floats through Telnet object?

2008-04-10 Thread Gabriel Genellina
En Thu, 10 Apr 2008 15:58:44 -0300, Marlin Rowley <[EMAIL PROTECTED]> escribió: > Is there any function that allows reading a stream of floats through the > Telnet Object? There doesn't seem to be a way to control reading from > the socket accept read_until() and that requires a string. Th

Convert PyIDispatch object to struct IDispatch*

2008-04-10 Thread Huayang Xia
I am trying to use ctypes to call dll functions. One of the functions requires argument "struct IDispatch* ". I do have a PyIDispatch object in python. How can I convert this "PyIDispatch object" to "struct IDispatch* "? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: get array element

2008-04-10 Thread Robert Kern
[EMAIL PROTECTED] wrote: > 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 You will want to ask numpy questions on the numpy mailing list. If you don't mention that you ar

Re: get array element

2008-04-10 Thread Jason Scheirer
On Apr 10, 10:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 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 a.index(15) -- http://mail.python.org/mailman/listinfo/p

Re: Obtaining a callable class method object from a specific class

2008-04-10 Thread Nathan Duran
On Apr 10, 2008, at 1:25 PM, [EMAIL PROTECTED] wrote: > won't question why you want to do this... > Here is a solution base on a metaclass, but it feels wrong. > class MetaScore(type): >def __new__(meta, name, bases, attrs): >attrs.setdefault('score', score) >return type.__ne

Re: wrapping C functions in python

2008-04-10 Thread Robert Kern
Paul Anton Letnes wrote: > 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. Well, you will definitely want to use numpy arrays instead of lists or the standard library's arrays to c

Re: Graphs in Python

2008-04-10 Thread bearophileHUGS
Sanhita Mallick>where can I find more in depth info about how to express graphs in python, and how to use them in a code?< You can look here: https://networkx.lanl.gov/wiki My version: http://sourceforge.net/projects/pynetwork/ Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-l

Re: Python conventions

2008-04-10 Thread Daniel Fetchinson
> > I'm sorry to disappoint you but this project has already been completed: > > > > http://www.python.org/dev/peps/pep-0008/ > > Daniel, PEP 8 is anything but complete. How much of the following > simple question can you answer from there: > > Given that you can name things with UpperAndLower, low

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] > | 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 >

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

2008-04-10 Thread Thomas Dimson
On Apr 10, 3:05 pm, svensven <[EMAIL PROTECTED]> wrote: > Vinay Sajip wrote: > >  > On Apr 10, 1:11 pm, "sven _" <[EMAIL PROTECTED]> wrote: >  >> My goal is to have stdout and stderr written to a logginghandler. >  > >  > Thomas was almost right, but not quite - you can't call info on a >  > Handle

Re: Module Conflicts

2008-04-10 Thread Ivan Illarionov
On Apr 11, 12:31 am, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Apr 10, 2:33 am, 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 imp

Re: Module Conflicts

2008-04-10 Thread Ivan Illarionov
On Apr 10, 2:33 am, 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 itself. Is there any > way around this problem without renaming my

Re: win-shortcuts, file associates and command-line parameters ?

2008-04-10 Thread Mike Driscoll
On Apr 10, 2:03 pm, Stef Mientki <[EMAIL PROTECTED]> wrote: > hello, > > under windows I tried to make a shortcut to a py -file, to run a program. > So making a shortcut like this works perfect: > D:\PyLab_Works.py > > But the problem is that I need to give some commandline parameters to > the py

Re: Obtaining a callable class method object from a specific class

2008-04-10 Thread Arnaud Delobelle
On Apr 10, 7:47 pm, Nathan Duran <[EMAIL PROTECTED]> wrote: > This is a contrived pseudocode example which has been broken out of a   > larger problem, so it may seem like a strange thing to want to do,   > but... > > I have a group of objects which inherit (single) from a common base   > class lik

Re: Module Conflicts

2008-04-10 Thread Terry Reedy
"Jose" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | 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 st

Re: Python conventions

2008-04-10 Thread Jerry Hill
On Thu, Apr 10, 2008 at 3:52 PM, <[EMAIL PROTECTED]> wrote: > Daniel, PEP 8 is anything but complete. How much of the following > simple question can you answer from there: > > Given that you can name things with UpperAndLower, lowerAndUpper, > lower_and_underscore, etc., what is the conventio

Re: Graphs in Python

2008-04-10 Thread Sanhita Mallick
Hi Matthieu. I have looked at that, and other similar ones all of which are based on Graphviz. My problem is that I myself am creating some large graphs,contrary to an already created network, say, a social network of python-list or my-space, downloaded from somewhere as indicated in some of the

Re: Running a python code periodically

2008-04-10 Thread Robert.Spilleboudt
paul wrote: > Maryam Saeedi schrieb: >> Hi, >> >> I was wondering if you know how can I run a python code once every five >> minutes for a period of time either using python or some other program >> like >> a bash script. > > See the sched module in the standard library or here: > http://pypi.pyt

Re: Python conventions

2008-04-10 Thread MartinRinehart
Daniel Fetchinson wrote: > I'm sorry to disappoint you but this project has already been completed: > > http://www.python.org/dev/peps/pep-0008/ Daniel, PEP 8 is anything but complete. How much of the following simple question can you answer from there: Given that you can name things with Upper

Re: Graphs in Python

2008-04-10 Thread Matthieu Brucher
Hi, Did you try packages dedicated to graphs, like NetworkX ? Matthieu 2008/4/10, Sanhita Mallick <[EMAIL PROTECTED]>: > > 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 > gr

Re: Running a python code periodically

2008-04-10 Thread paul
Larry Bates schrieb: > paul wrote: >> Maryam Saeedi schrieb: >>> Hi, >>> >>> I was wondering if you know how can I run a python code once every five >>> minutes for a period of time either using python or some other program >>> like >>> a bash script. >> See the sched module in the standard librar

Re: How is GUI programming in Python?

2008-04-10 Thread John Henry
On Apr 9, 6: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 will work across Ma

Obtaining a callable class method object from a specific class

2008-04-10 Thread Nathan Duran
This is a contrived pseudocode example which has been broken out of a larger problem, so it may seem like a strange thing to want to do, but... I have a group of objects which inherit (single) from a common base class like so: --- class Root(object): @classmethod def CumulativeSco

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

2008-04-10 Thread svensven
Vinay Sajip wrote: > On Apr 10, 1:11 pm, "sven _" <[EMAIL PROTECTED]> wrote: >> My goal is to have stdout and stderr written to a logginghandler. > > Thomas was almost right, but not quite - you can't call info on a > Handler instance, only on a Logger instance. The following script: Yes, but

win-shortcuts, file associates and command-line parameters ?

2008-04-10 Thread Stef Mientki
hello, under windows I tried to make a shortcut to a py -file, to run a program. So making a shortcut like this works perfect: D:\PyLab_Works.py But the problem is that I need to give some commandline parameters to the py-file, and D:\PyLab_Works.py btc_test But the parameter doesn't seem

Re: How is GUI programming in Python?

2008-04-10 Thread Michel Bouwmans
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mike Driscoll wrote: > 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 i

Reading floats through Telnet object?

2008-04-10 Thread Marlin Rowley
Is there any function that allows reading a stream of floats through the Telnet Object? There doesn't seem to be a way to control reading from the socket accept read_until() and that requires a string. -M _ Use video conversation

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

2008-04-10 Thread svensven
Thomas Dimson wrote: > On Apr 10, 8:11 am, "sven _" <[EMAIL PROTECTED]> wrote: >> 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) >> subp

Re: class

2008-04-10 Thread darian schramm
Your import statement is wrong. Try: from Mysqldb import Mysqldb in your session.py On Thu, Apr 10, 2008 at 1:08 PM, Arun ragini <[EMAIL PROTECTED]> wrote: > Hi, > > I have create a class file named Mysqldb.py > > class Mysqldb: > def __init__(self, name): > #this where i

mod_python and storing binary form data

2008-04-10 Thread canistel
Hi, I have a little python webservice that I created, and in one of the methods I need to store some binary data that was "posted"... I want to do something like this, but it doesn't work. username = form.get("username", "") message = form.get("message", "") attachment = form.get("attachment", Non

Re: text adventure game problem

2008-04-10 Thread Tommy Nordgren
On 9 apr 2008, at 03.01, [EMAIL PROTECTED] wrote: > okay, I'm having this one problem with a text adventure game. It's > kind of hard to explain, but I'll do my best. > [code] > > def prompt_kitchen(): >global gold Python is not a suitable language for Text Adventure Development. You

Re: How is GUI programming in Python?

2008-04-10 Thread Bjoern Schliessmann
Chris Stewart 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 Mac, Windows, and Linux. How > painful

Re: get array element

2008-04-10 Thread Ivan Illarionov
On Apr 10, 9:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 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 >>> a = array('i', [13,14,15,16]) >>> a.index(15) 2 -- ht

Re: from __future__ import print

2008-04-10 Thread Andrii V. Mishkovskyi
2008/4/10, [EMAIL PROTECTED] <[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 transitionin

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

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: 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

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: 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

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: 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

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: 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: 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

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: 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

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

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: 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

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

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

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:

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

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

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

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: @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: 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: 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: > [...]

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: 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

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: 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: 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: 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: 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 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: 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

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: 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

  1   2   >