Re: Good Python IDE

2013-01-06 Thread Almar Klein
t; > -- > http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list> > -- Almar Klein, PhD Science Applied phone: +31 6 19268652 e-mail: a.kl...@science-applied.nl -- http://mail.python.org/mailman/listinfo/python-list

Re: Naming future objects and their methods

2012-04-15 Thread Almar Klein
Hi Stefan, What do you think would be a "natural" way to name the > future returned by `put_bytes` and possibly the `was_sent` > method attached to it? Can you even come up with nice naming > rules for futures and their methods? :-) > I think the intended way to get notified when a future is done

Re: No such file or directory: 'c:\\windows\\temp\\test'

2012-04-15 Thread Almar Klein
> IOError: [Errno 2] No such file or directory: 'c:\\windows\\temp\\test.txt' > would you mind telling me what's wrong ? > I think the file that you try to open does not exists :) Please be more specific. What are you trying to achieve, and are you absolutely sure that such a file exist? Almar

Re: interactive plots

2011-07-06 Thread Almar Klein
On 7 July 2011 00:00, Almar Klein wrote: > > > On 6 July 2011 17:04, Mihai Badoiu wrote: > >> How do I do interactive plots in python? Say I have to plot f(x) and g(x) >> and I want in the plot to be able to click on f and make it disappear. Any >> python librar

Re: interactive plots

2011-07-06 Thread Almar Klein
On 6 July 2011 17:04, Mihai Badoiu wrote: > How do I do interactive plots in python? Say I have to plot f(x) and g(x) > and I want in the plot to be able to click on f and make it disappear. Any > python library that does this? Visvis is a plotting toolkit that has good support for interactiv

Re: Tkinter: The good, the bad, and the ugly!

2010-12-29 Thread Almar Klein
On 30 December 2010 00:58, rantingrick wrote: > > Tkinter: The good, the bad, and the ugly! > - > An expose by rantingrick > > > -- > The Good > -- > Back in the early days of Python --when this simplistic beauty of

Re: UTF-8 problem encoding and decoding in Python3

2010-10-12 Thread Almar Klein
>So if you can, you could make sure to send the file as just bytes, >>or if it must be a string, base64 encoded. If this is not possible >>you can try the code below to obtain the bytes, not a very fast >>solution, but it should work (Python 3): >> >> >>MAP = {} >>for i in r

Re: UTF-8 problem encoding and decoding in Python3

2010-10-11 Thread Almar Klein
On 10 October 2010 23:01, Hidura wrote: > I try to encode a binary file what was upload to a server and is > extract from the wsgi.input of the environ and comes as an unicode > string. > Firstly, UTF-8 is not meant to encode arbitrary binary data. But I guess you could have a Unicode string in

Re: UTF-8 problem encoding and decoding in Python3

2010-10-10 Thread Almar Klein
Hi, please tell us what you are trying to do. Encoding (with UTF-8) is a method to convert a Unicode string to a sequence of bytes. Decoding does the reverse. When i open > directly and try to decode the file the error is this: `UnicodeDecodeError: > 'utf8' codec can't decode byte 0xff in positi

Re: help removing pyQt dll from dist created with py2exe

2010-09-14 Thread Almar Klein
Hi, Have you tried adding "PyQt4", "PyQt4.QtGui" and "PyQt4.QtCore" to your list of excludes? (Maybe only "PyQt4.QtGui" is sufficient.) Almar On 14 September 2010 13:02, Carlos Grohmann wrote: > Hello all, > > i've been trying to build an .exe with py2exe. After many tentatives, > it worked,

Re: analysis of algoritms

2010-09-09 Thread Almar Klein
On 9 September 2010 23:39, Baba wrote: > Hi > > In below code "the outer loop test in step 4 will execute ( n + 1 ) > times (note that an extra step is required to terminate the for loop, > hence n + 1 and not n executions), which will consume T4( n + 1 ) > time." (from http://en.wikipedia.org/wi

Re: Python script for repairing .mov file ?

2010-09-05 Thread Almar Klein
On 5 September 2010 14:54, ctops.legal wrote: > Trying to learn Python for a specific purpose to repair a quicktime > file that's corrupted, is it even possible to create a proof-of- > concept python script that generates a valid 'moov' atom from a > corrupt .mov video ?, "file size 1.3gb" (Koda

Re: Save/load like matlab?

2010-08-24 Thread Almar Klein
On 24 August 2010 11:46, Mark Leander wrote: > Almar Klein gmail.com> writes: > > A year ago or so I designed a simple file format that could do that and > is also > > human readable (binary data is compressed and then base64 encoded). I use > it > > extensively t

Re: Save/load like matlab?

2010-08-23 Thread Almar Klein
On 23 August 2010 19:37, Sang-Ho Yun wrote: > I wonder if there is a way to save and load all python variables just like > matlab does, so I can build a code step by step by loading previous states. > > I am handling a python processing code for very large files and multiple > processing steps. E

Re: 79 chars or more?

2010-08-17 Thread Almar Klein
> If the display is limited to 80 characters then after printing the 80th > the cursor will be at the start of the next line and the newline will > cause the display to leave a blank line (unless the display has some > intelligence and supports pending newlines, of course). Ahah! So Windows users

Re: 79 chars or more?

2010-08-17 Thread Almar Klein
> > A reason not mentioned much is that some people have trouble following > packed lines that are too much longer. Wide-page textbooks routinely put > text in two columns for easier reading. This is less of a factor with jagged > edge text, but if the limit were increased to say 150, there would b

Re: 79 chars or more?

2010-08-17 Thread Almar Klein
On 17 August 2010 18:43, AK wrote: > On 08/17/2010 12:21 PM, Stefan Schwarzer wrote: > >> On 2010-08-17 17:44, AK wrote: >> >>> On 08/17/2010 10:28 AM, Stefan Schwarzer wrote: >>> I'd probably reformat this to self.expiration_date = translate_date( find

Re: Numpy now supports Python3, Scipy to follow soon

2010-07-12 Thread Almar Klein
On 12 July 2010 10:05, Steven D'Aprano wrote: > Pardon me if this has already been mentioned, but I didn't see it, and > this is big big news. > I haven't heard it yet, this is great news! Almar -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check what is holding reference to object

2010-04-28 Thread Almar Klein
On 27 April 2010 23:08, Chris Rebert wrote: > On Tue, Apr 27, 2010 at 1:45 PM, Michal M > wrote: > > I've just found out that one of objects is not destroyed when it > > should be. This means that something was holding reference to this > > object or part of it (i.e. method). Is there any way to

Re: How to check what is holding reference to object

2010-04-27 Thread Almar Klein
> I've just found out that one of objects is not destroyed when it > should be. This means that something was holding reference to this > object or part of it (i.e. method). Is there any way to check what > holds that reference? I am unable to do that just looking to the code > or debugging it beca

Re: Python database of plain text editable by notepad or vi

2010-03-26 Thread Almar Klein
Hi, On 25 March 2010 23:40, James Harris wrote: > I am looking to store named pieces of text in a form that can be > edited by a standard editor such as notepad (under Windows) or vi > (under Unix) and then pulled into Python as needed. The usual record > locking and transactions of databases ar

Re: python to exe

2010-03-13 Thread Almar Klein
>Does anyone know of a good python to stand alone exe compiler? > > >Thanks, > >-Robin > I tried several such tools and found the easiest one: Pyinstaller ( > http://www.pyinstaller.org/ ) > Don't forget cx_freeze! I found it to work pretty easy, and it also works for py3k. Almar -- http://mail

ANN: visvis v1.1

2010-02-10 Thread Almar Klein
Hi all, I am pleased to announce version 1.1 of visvis, a Python visualization library for of 1D to 4D data. Website: http://code.google.com/p/visvis/ Discussion group: http://groups.google.com/group/visvis/ Documentation: http://code.google.com/p/visvis/wiki/Visvis_basics === Description === V

Re: A null program - what is it doing?

2010-01-05 Thread Almar Klein
2010/1/5 r0g > Gib Bogle wrote: > > No doubt a dumb question from a noob: > > > > The following program (a cut down version of some test code) uses no > > CPU, and does not terminate: > > > > import sys > > from PyQt4.QtCore import * > > > > if __name__=="__main__": > > app = QCoreApplication

Re: freeze in python3

2009-12-10 Thread Almar Klein
Hi Patrick, It's not exactly what you asked, but I've been able to freeze a Python 3 project using cx_Freeze. Almar 2009/12/10 Patrick Stinson : > NOTE: This is related but is not a duplicate of my post from yesterday. > > Has anyone used Tools/freeze/freeze.py in python3? I tried it with a > c

Re: multithreading in python

2009-05-12 Thread Almar Klein
See the standard help on the threading and thread module. Almar 2009/5/12 shruti surve : > hi, >  how to do multithreading in python??? Like running dialog box and running > xml rpc calls simultaneously??? > > > regards > shruti > > -- > http://mail.python.org/mailman/listinfo/python-list > > --

Re: Supply a plugin interface

2009-04-23 Thread Almar Klein
Hi, I did this a few times and put the code that loads the plugins in the __init__.py of the plugin directory. You then do not have to do the path stuff. You can also make a rule that the class defined in each plugin module should be a certain name, for example the same name as the module (but st

Re: 3D plotting in a GUI

2009-04-15 Thread Almar Klein
Hi, I'm actually busy writing a visualization package based on OpenGL. The interface is similar to matplotlib and Matlab. You can do regular plotting with it, but is also aimed at 3D visualization, including volume rendering. It's not quite finished yet, so I'm not sure if it'll help you right now

Re: wxPython fast and slow

2009-03-06 Thread Almar Klein
That's weird. It might have to do with the main loop. I am not familiar with pyscripter, but it might supply a wx mainloop. However, if that is the case, I would expect the app to run slower in pyscripter, not when run without it... So can you use wx interactively from pyscripter? In other words,

OpenGL in TK

2009-01-27 Thread Almar Klein
Hi list! I am using pyOpenGL to do some 3D rendering. For now I am quite happy with the GLCanvas of wx, but I may want to publish some stuff later, and it would be nice if people would not need wx. I found that there used to be a TK widget called Togl, but it is not (anymore?) included in the TK

VTK in python

2009-01-12 Thread Almar Klein
Hi all, I want to use the Visualisation ToolKit from python. However, I cannot find an easy way to install it. Of course, I could download the source, use CMake to build and VS to compile it, but... yeah, that takes a lot of time and will probably not work the first time... I noticed that with V

Re: image recogniton?

2009-01-07 Thread Almar Klein
2009/1/7 Li Han > On 1月7日, 上午4时14分, J Kenneth King wrote: > > I'm curious as to what application the solution to this problem is > > practical for all of its difficulty? > Sorry, I oversimplified the question because of my poor english. It is > an analog compass whose value we need to read into

Re: Mathematica 7 compares to other languages

2008-12-10 Thread Almar Klein
2008/12/10 Xah Lee <[EMAIL PROTECTED]> > Jon Harrop moron wrote: > > Only for trivial input and not for the challenge you were given. > > what challenge? > > > That code is evaluated once to build the scene. There is no point in > > optimizing it. > > The point is optimizing your incompetence. > >

Re: Guido's new method definition idea

2008-12-08 Thread Almar Klein
I like the transparancy and clearity of python, and the explicit self fits beautifully. Allowing a second way of defining your methods would only confuse newbies more I would think. I was a newby only half a year ago (or maybe I still am). The explicit self seems weird the very first time you see

Re: Multiple equates

2008-12-03 Thread Almar Klein
Hi, what about numpy? import numpy a = numpy.ones((10,),dtype=numpy.bool) I = [1,3,8] a[I]=False print a gives: [ True False True False True True True True False True] Almar -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-01 Thread Almar Klein
I did some image processing in Mathematica once. It allocated 2GB of memory to do display a normal size image. The professor (not of my university) who gave the course I was following then, was a big Mathematica fan. He also used lots of sentences containing "quite striking", "highly efficient", "e

Re: functions

2008-11-28 Thread Almar Klein
You could pass it as an argument: c:\script1.py foo(whatever_arguments_you_need, caller=None): c:\script2.py import script1 script1.foo(blabla, caller=__file__) Other than that I would not know. Maybe the inspect module can help you but as far as I can see, it doesn't. I'm als

Re: Dynamic features used

2008-11-21 Thread Almar Klein
> > - Is it good for Python to become two languages in one, a fast > statically typed one and a dynamically one, like pypy shows to like > with RPython, or is it better to go the way of the Boo language, that > (while being mostly static) is mixing dynamic and static typing in the > same code, but

Re: Dynamic features used

2008-11-21 Thread Almar Klein
You're right (I think), but I fail to see the point you're trying to make or the question you're asking... :) I use python for scientific research too, and for me speed can be an issue too sometimes. By using numpy and scipy I have an environment similar to Matlab in terms of speed and functiona

Re: special editor support for indentation needed.

2008-11-14 Thread Almar Klein
Hi Eric, First of all, I like your initiative. I'm not sure if I undestand you correctly, but can't you just increase indentation after each line that ends with a colon? That's how I do it in my editor. The user would then only need to specify when to decrease indentation. Cheers, Almar 2008/

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Almar Klein
> It works when the program you are executing is in the current working > directory, because Python always puts the directory containing the > program you are executing (not the current working directory) on the path. Aha, that makes sense. I also found with a quick test that importing a module fr

Re: Project layout / Import files from different subdirectories

2008-11-11 Thread Almar Klein
If your main file is in the root of the project, you can just use absolute imports. So you can use gui.anotherwindow or project.important from all files. I'm not sure this is good practice though... I was first under the impression that you can always import modules that are in your current worki

Re: Which was the best Lib of GUI for python

2008-11-04 Thread Almar Klein
Hi, If you search the newsgroup you'll find loads of similar posts. There is not really an agreement on which GUI library is "the one". Tkinter is a bit limited. Personally, I only have experience with wxpython and like it a lot. But there are others like GTK, FLTK, QT. Cheers, Almar 2008/11

Re: Question related to wx and dynamically updating windows

2008-10-20 Thread Almar Klein
just to be sure, did you try ".Update()"? Almar 2008/10/20 Mike Driscoll <[EMAIL PROTECTED]>: > On Oct 20, 5:43 am, Andy <[EMAIL PROTECTED]> wrote: >> I want to dynamically update a list of elements shown as a checkbox >> list. A file is used to store the elements, and elements can be added >> an

Re: class point in python

2008-10-13 Thread Almar Klein
I made a class to store sets of points a few months ago.I don't consider it finished enough to release it somewhere, but I'm happy to share it if you're interested. Send me an e-mail if you are. Almar 2008/10/12 [EMAIL PROTECTED] <[EMAIL PROTECTED]> > i am looking for a python implementation of

Re: Debugging suggestions, efficiency - handling modules

2008-10-10 Thread Almar Klein
You might like IPython, it is an interactive python shell and you caneasily run scripts from it. That way, the active session remains, as well as all the imports. Personally, I don't like the "from pylab import *", the python philosophy says: "Namespaces are one honking great idea -- let's do more

Re: On the indexing order in (numpy) arrays

2008-10-09 Thread Almar Klein
> Basically, we want a[i][j] == a[i,j]. Since there is no literal syntax for > numpy arrays, we need to be able to convert from a sequence of sequences to > an array. The indexing needs to correspond between the two. > Thanks for the reply. I guess that explains the *why*... Adopt the numpy orde

On the indexing order in (numpy) arrays

2008-10-09 Thread Almar Klein
Hi, I was wondering... Say we have a np.ndarray A of two dimensions (a grayscale image for example). If we want to access x:2, y:3, we have to do A[3,2]. Why is the order of x and y reversed? This is reversed in Matlab too, because Matlab is a matrix package and matrix are often used this way. (I

Re: distributing apps without the Python source?

2008-10-08 Thread Almar Klein
You could encrypt the sensitive pieces of source code. I'm not an expert in that field, but I know Matlab allows encryption of source code files. Almar 2008/10/8 Bruno Desthuilliers <[EMAIL PROTECTED]> > Marc 'BlackJack' Rintsch a écrit : > >> On Wed, 08 Oct 2008 10:59:44 -0500, skip wrote: >> >

Re: Reading from stdin

2008-10-08 Thread Almar Klein
> > I guess the phrasing "hidden read-ahead buffer" implies that buffering > cannot be turned off (or at least it is not intended to even if it's > somehow possible). > I think it can be done, but you would have to use a different approach on linux than on windows. Linux requires fcntl (I dont kno

Re: equivalent of py2exe in other os

2008-10-07 Thread Almar Klein
Hi, I was going to say "try google", but it seems quite hard to find indeed. Use "freeze" for linux and "py2app" for osx. I know of a program called gui2exe which is a gui which uses the three to compile executables of your os of choise (but I think only py2exe was implemented thus far). Almar 2

Re: execute a function before and after any method of a parent class

2008-10-03 Thread Almar Klein
Maybe you can use __getattribute__. I tried it, but got stuck trying to let __getattribute__ work normal without calling itself. class A(object): def foo(self): print "hi" class B(A): def __getattribute__(self,name): try: fun = A.__dict__[name] except K

Re: what does "python -i" use as input stream (stdin)?

2008-10-02 Thread Almar Klein
> > I did not understand completely what you want, and rereading previous posts > I got even more confused... > Could you provide a complete description of what you want to do? > Is it a single process, or two separate processes? Running on the same > machine or remotely? All python or there is ano

Re: what does "python -i" use as input stream (stdin)?

2008-10-01 Thread Almar Klein
the feeling this is impossible, but I thought that the last time too :) Almar 2008/9/30 Almar Klein <[EMAIL PROTECTED]> > Wow, > it's that easy... > thanks! > > 2008/9/29 Gabriel Genellina <[EMAIL PROTECTED]> > > En Fri, 26 Sep 2008 04:29:42 -0300, Almar Klein

Re: change line with columns when print

2008-10-01 Thread Almar Klein
Hi, probably not the best solution, but this should work: L1 = [] L2 = [] for i in file: tmp = i.split(" ") L1.append(tmp[0]) L2.append(tmp[1]) for i in L1: print i, print # new line for i in L2: print i, print # new line Almar 2008/10/1 sandric ionut <[EMAIL PROTECTED]>

Re: what does "python -i" use as input stream (stdin)?

2008-09-30 Thread Almar Klein
Wow, it's that easy... thanks! 2008/9/29 Gabriel Genellina <[EMAIL PROTECTED]> > En Fri, 26 Sep 2008 04:29:42 -0300, Almar Klein <[EMAIL PROTECTED]> > escribió: > > I would still like to hear if anyone knows how I can change the input >> stream >> that &

Re: Weirdness comparing strings

2008-09-30 Thread Almar Klein
Hi, Better post complete code. I don't see where self.note_name is defined, and what are these accidentals? you write: def has_the_same_name(self, note): return self == note but this does not implicitly convert self to a string. You'll have to do in explicitly: use "return str(self) == note"

Re: can someone explain why this happens- newbie question

2008-09-30 Thread Almar Klein
change: for score in scores: print scores to: for score in scores: print score that should do the trick :) Almar 2008/9/30 garywood <[EMAIL PROTECTED]> > Hi > can someone tell me why it prints the high score table multiple times? > > #high scores program > scores =[] > choice = None > >

Re: what does "python -i" use as input stream (stdin)?

2008-09-26 Thread Almar Klein
> > Use subprocess.PIPE > Usually the tricky part is to figure out exactly whether there is more > input or not. With Python it's easy, use the ps1 prompt. Thanks, but that is not exactly what I meant. (Maybe my question was a bit vague). I want to replace the input stream of the *remote* process

Re: matplotlib in interactive mode locks when run from subprocess

2008-09-25 Thread Almar Klein
I have now solved my problem, and interactivity works! Almar 2008/9/20 Almar Klein <[EMAIL PROTECTED]> > I think my question was not very clear. I narrowed the problem down to > a reconstructable small example, consisting of a python script (a very > simple

what does "python -i" use as input stream (stdin)?

2008-09-25 Thread Almar Klein
Hi, I want to start "python -i" from a subprocess and change its stdin stream, so I get control over the commands I feed the interpreter. I thought just changing sys.stdin to my custom file-like object would suffice, but this does not work. Neither does changing sys.__stdin__. I guess the interpr

Re: python 3.x third party modules

2008-09-24 Thread Almar Klein
Hi, I would like to look at third party modules which are python 3.0 ready. > I think that until the release version of python 3.0 is out, no one will release something. Python 3k is due in October this year, so only a few weeks from now. I would also like to know when we can expect the major 3

Re: matplotlib in interactive mode locks when run from subprocess

2008-09-20 Thread Almar Klein
y this does not work. Any thoughts anyone? I've been busy all day trying to get this right, with hardly any progress... :( Almar PS: I run windows xp, my matplotlibrc file has the backend: TkAgg, interactive: True 2008/9/18 Almar Klein <[EMAIL PROTECTED]> > Hi, > > In wxpytho

Re: Launching a subprocess without waiting around for the result?

2008-09-19 Thread Almar Klein
> > Ah, no, that's a different thing. If the parent exits, the child will > also be killed I believe. Not if it's stuck in some endless loop... If you want to spawn a process and have it live on independent of the > parent, you want to make the child process a "daemon", detatching > itself from

matplotlib in interactive mode locks when run from subprocess

2008-09-18 Thread Almar Klein
Hi, In wxpython, I made an interactive shell, which creates a remote python subprocess to do the interpreting. Communication is done via a pipe. The idea is that the python session is an actual process separate from the GUI, which has some advantages, like I can have multiple such shells in my app

Re: SSH using PEXPECT

2008-09-18 Thread Almar Klein
Hi, Wanting to use pexpect on windows too, I ran into wexpect. http://sage.math.washington.edu/home/goreckc/sage/wexpect/ I haven't given it a try yet. Does anyone have experience with that? Almar 2008/9/13 nntpman68 <[EMAIL PROTECTED]> > Hi, > > [EMAIL PROTECTED] wrote: > >> On Sep 10, 7:01 pm,

Re: PLEASE HELP ME WITH THIS ASSIGNMENT...PLEASE....

2008-09-12 Thread Almar Klein
> > I find it impossible to take anyone asking others to do their school > work for them seriously no matter how or what they are willing to pay. > Exactly, and writing the subject of the post in all capitals doesn't help either... Almar -- http://mail.python.org/mailman/listinfo/python-list

python 3k, when will it be mainstream?

2008-09-02 Thread Almar Klein
Hi, I read that python 3k is now in its final beta version. I was wondering when we can expect the major packages to make a 3.0 branch. I am myself quite new to python, and would like to make the transition as soon as possible, simply because it would save me porting code later, and I can focus o

Re: Freesoftware for auto/intelligent code completing in Python

2008-07-02 Thread Almar Klein
> The free Python editors/IDEs really do need work as far as code completion goes but I am hopeful. I agree, I'm quite new to python and just had my period of searching for the best IDE/editor. Wing wins for me, but it is not free (at least not te versions which do have code completion). Pype (a f