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

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

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

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

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

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

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

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

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

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

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

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.

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

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

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

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

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

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

<    1   2