Building PIL under Cygwin & Python 2.5

2009-05-28 Thread Erik Johnson
This has apparently been a problematic thing for a while now, as the following article indicates. I first ran into the error message about not being able to remap C:\cygwin\bin\tk84.dll to be the same address as it's parent. Using that information, Google helped me find this article: http://blog.

Re: array{uint32}

2007-04-18 Thread Erik Johnson
"Daniel Nogradi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I have a function that returns a array{uint32}, is there any way to output > > that to screen in a more user friendly format? At the moment when I print it > > by itself it appears as [65541L], which isn't much used t

Re: subprocess "handle is invalid" error

2007-04-18 Thread Erik Johnson
"Grant Edwards" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How does one troubleshoot errors that happen three layers deep > in the subprocess module? I think the problem is more likely in how your py2exe is getting bundled, rather than any real problem with the subprocess

Re: Python editor/IDE on Linux?

2007-04-13 Thread Erik Johnson
"7stud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Jack wrote: > > I wonder what everybody uses for Python editor/IDE on Linux? > > I use PyScripter on Windows, which is very good. Not sure if > > there's something handy like that on Linux. I need to do some > > development work

Re: rexec & Bastion ?

2007-04-11 Thread Erik Johnson
I mean, of course, rexec (not recec) and Bastion -- http://mail.python.org/mailman/listinfo/python-list

recec & Bastion ?

2007-04-11 Thread Erik Johnson
The documentation for these two modules says that they were disabled in Python 2.3 due to security holes not easily fixable. I have not worked with them, but I can still import them under Python 2.4, so I'm not clear on whether the security problems were fixed in Python itself, or whether the

Re: SimpleXMLRPCServer and Threading

2007-03-28 Thread Erik Johnson
"Achim Domma" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > is SimpleXMLRPCServer multithreaded or how does it handle multiple > clients? I want to implement a simple server which will be queried by > multiple processes for work to be done. The server will simply hold a > q

Re: Numeric Soup

2007-03-27 Thread Erik Johnson
"Robert Kern" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > http://www.scipy.org/History_of_SciPy > > numpy is the current array package and supercedes Numeric and numarray. scipy > provides a bunch of computational routines (linear algebra, optimization, > statistics, signal proc

Re: Fortran vs Python - Newbie Question

2007-03-27 Thread Erik Johnson
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sheesh. Do Java developers go around telling everybody that Java is an > interpreted language? I don't think so. > > What do you think the "c" in ".pyc" files stands for? "Cheese"? On the contrary... Sun is very care

Numeric Soup

2007-03-27 Thread Erik Johnson
I am just starting to explore doing some scientific type data analysis using Python, and am a little confused by the different incarnations of modules (e.g., try Google("Python numeric"). There is SciPy, NumPy, NumArray, Numeric... I know some of these are related and some are separate,

Re: Help in Placing Object in Memory

2007-03-27 Thread Erik Johnson
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What do you mean by that? They can both load a pickled object, yes. But they > can't share it as a at-runtime object, where changes in one script are > immediately are known to the other. > > To do such a thing, look

Re: Fortran vs Python - Newbie Question

2007-03-26 Thread Erik Johnson
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > OK... > I've been told that Both Fortran and Python are easy to read, and are > quite useful in creating scientific apps for the number crunching, but > then Python is a tad slower than Fortran because of its a high level > language nat

Re: calling class instances and their methods

2007-03-26 Thread Erik Johnson
"spohle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi, > > i created an instance of a my own class which has methods and all. now > i get an outside function called, which is unfortunatly not aware of > the instace at all (i don't control how this outside function is > called).

Re: Been a while...

2007-03-23 Thread Erik Johnson
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hawk this list and try to pick off easy answers before anyone else. > That's what I do. The pressure is to be right, because if you're not, > you hear about it in a hurry. That is actually an excellent suggestion.

Re: Been a while...

2007-03-22 Thread Erik Johnson
"Michael Bentley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > On Mar 22, 2007, at 10:34 AM, John Salerno wrote: > > > Hi guys. It's been a while since I've used Python, so I got a little > > rusty, but I really want to start using it again, just out of habit > > and > > for fun

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Erik Johnson
Actually, after studying this a bit more: http://docs.python.org/ref/assignment.html I guess that makes sense. Sorry if I muddied the water for anyone else in my boat: n1 = n1.next = n2 The first thing that happens is the expression list is evaluated which is the thing on the far right, n2. That

Re: Python 3000 idea: reversing the order of chained assignments

2007-03-22 Thread Erik Johnson
"Virgil Dupras" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > class Node: > > > ... pass > > > ... > > node = Node() > > nextnode = Node() > > backup_node = node > > node = node.next = nextnode > > node.next is node > > > True > > hasattr(ba

tracking memory usage

2007-03-19 Thread Erik Johnson
Sort of two questions here: The first is about the internal view: are there Python introspection functions that can be called such that a running script can keep tabs on how much memory is being used? And the second is about using either os or system calls on Windows such that a Python

Re: Tools for GUI/graphics

2007-03-13 Thread Erik Johnson
> You can use ReportLab Graphics to generate the > graphs as .JPG files and display them in a > browser window with simple HTML. That is one option. As best as I recall, CherryPy is a simple but fully functional web framework. If your primary focus is programmatically generating graphs from d

Re: struct.pack oddity

2007-03-13 Thread Erik Johnson
"Dave Opstad" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is the lack of a struct.error when the byte-order mark is at the start > of the format intentional? This seems like a bug to me, but maybe > there's a subtlety here I'm not seeing. I am by no means any sort of expert

Re: Newbie Question : "grep"

2007-03-12 Thread Erik Johnson
Sorry, I forgot to paste the modified version of my code in the post:. I think this is the same behaviour: for line in lines: if "placed" in line: if "i_a/i_b/ROM/" in line: pos = (line.split()[4]).split("_")[1] found = False for (tag, (start, end))

Re: Newbie Question : "grep"

2007-03-12 Thread Erik Johnson
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > - If I increase number of elements I am searching for, then I have > more elif...elif. Is there a cleaner solution? I'm not sure exactly what your lines look like, but this script implies that every line that matches 'i_a/i_b/ROM' is

Re: Tell me the truth

2007-03-08 Thread Erik Johnson
"Duncan Booth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: > > > After much head scrating and experimenting with dis.dis() I have found > > that chaining comparisons (with is or ==) a == b == c in Python is > > never a good idea. It is interpreted as > >

subclassing a module: misleading(?) error message

2007-01-04 Thread Erik Johnson
I ran into a problem I didn't understand at first. I got part of it figured out. Let me first demonstrate the original problem: > cat Super.py class Super(object): def __init__(self): self._class = 'Super' def hello(self): print "%s says 'Hello'" % self._class > cat Sub.py

Re: Reverse of SendKeys??

2006-12-28 Thread Erik Johnson
Aside from the obvious security issues such a program would represent (and your name and signature are curious in that respect as well), you are basically asking for functionality (i.e., a key logger) I believe to be outside what is offered by Python and/or the API of most operating systems. P

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
"Ben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yes- I can see that my_list and mops, being outside def __init__() > only get created once, hence the confusion. > > Surely def __init__() gets called each time an instance is created > however? But the snag is that if they have

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
"Ben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > class record: > my_list =[] > mops=[] > > def __init__(self,mops): > self.mops=mops Similar to the example I gave, the lists my_list and mops shown above are executed just once: when your

Re: xml bug?

2006-12-28 Thread Erik Johnson
"Imbaud Pierre" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Now my points are: > - how do I spot the version of a given library? There is a __version__ >attribute of the module, is that it? Yes, the module maintainer should be incrementing this version for each new release a

Re: dictionary containing instances of classes behaving oddly

2006-12-28 Thread Erik Johnson
"Ben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This seems to work without any errors. But bizzarely I find that > whatever my record number, the instance of "my_class" is appended to > every list. So in this case > > self.mop_list[0].my_list.append(my_class(Some data for th

Re: DOS, UNIX and tabs

2006-12-27 Thread Erik Johnson
"Ben Finney" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Sebastian 'lunar' Wiesner" <[EMAIL PROTECTED]> writes: > > > Just a tip for you: In python you never use tabs for indentation. > > For some value of "you". > > > The python style guide [1] recommends four spaces per indent

Re: persistant gloabl vars (very newbie) ?

2006-12-27 Thread Erik Johnson
> but it's still not quit handy > > # initialization file (init1.py) > import time; > xx = 44 > > # main file was > print xx > x=time.time() > > # main file should become > print init1.xx > x=init1.time.time() > > so even for the "standard" functions like "time" I've to include the > preceeding mo

Re: Iterating over several lists at once

2006-12-27 Thread Erik Johnson
"Gal Diskin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > On Dec 13, 3:47 pm, "Gal Diskin" <[EMAIL PROTECTED]> wrote: > > Hi, > > I am writing a code that needs to iterate over 3 lists at the same > > time, i.e something like this: > > > > for x1 in l1: > > for x2 in l2: >

Re: getting a process's PID

2006-12-27 Thread Erik Johnson
"eldorado" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >>> g = os.popen("ps -ef | grep HUB | grep -v grep | awk '{ print $2 }'") > >>> h = g.readlines() > >>> g.close() > >>> h > ['87334\012'] > >>> h = h[:-1] > >>> h > [] Oh, sorry... h is a list here because you are using rea

Re: persistant gloabl vars (very newbie) ?

2006-12-27 Thread Erik Johnson
"Stef Mientki" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there a way to run the initialization code from a script(file) once, > to achieve the same effect ? Certainly. This is what Python modules are all about. You should probably read up on those a bit here: http://docs.p

Re: getting a process's PID

2006-12-27 Thread Erik Johnson
"eldorado" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I am trying to get python to give me the PID of a process (in this case > HUB). I have it working, except for the fact that the output includes > \012 (newline). Is there a way to ask python not to give me a newli

Re: One module per class, bad idea?

2006-12-22 Thread Erik Johnson
There are arguments of preference to be made on both sides. I think the question largely comes down to what is "workable" and "maintainable". To answer the original question, I think it is not necessarily a bad idea to have one class per file. But if your classes are small, or certain classes a

Re: preemptive OOP?

2006-09-28 Thread Erik Johnson
> class MyNotebook(wx.Notebook): > def __init__(self, parent): > wx.Notebook.__init__(self, parent) > So my question in general is, is it a good idea to default to an OOP > design like my second example when you aren't even sure you will need > it? I know it won't hurt, and is proba

Re: how do you know if open failed?

2006-09-28 Thread Erik Johnson
"tobiah" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > SpreadTooThin wrote: > > f = open('myfile.bin', 'rb') > > > > How do I know if there was an error opening my file? > > > try: > open('noexist') > except: > print "Didn't open" That's a way to trap any exc

Re: using the email module

2006-09-28 Thread Erik Johnson
"Sybren Stuvel" wrote: > If the HTML document should really be attached, give it a > Content-Disposition: Attachment > header. Check out the accompanying headers as well, by simply emailing > yourself an attached HTML file and examining the email source. html = """\ ... """ attachment = MI

Re: help tranlating perl expressions

2006-09-28 Thread \&quot;Erik Johnson\" wellkeeper dot
"David Bear" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > my $klen = length($key); > my $blen = 64; > my $ipad = chr(0x36)x$blen; > my $opad = chr(0x5c)x$blen; > > I don't know if I ever seen any way in python of created a fixed size > string. Can anyone show me how to implem

using the email module

2006-09-28 Thread \&quot;Erik Johnson\" wellkeeper dot
THE GOAL: I need to send an email with a simple ASCII text body and an attached HTML file. I have scripts that send basic emails via the smtplib module that don't have any attachements and that seems to work fine. I first looked at the mimetools modules but it says it is depreceated sinc

Re: __getattr__ and functions that don't exist

2006-05-25 Thread Erik Johnson
follow the error above though. Can you explain exactly what happens with just the evaluation of f? Thanks, -ej "Nick Smallbone" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Erik Johnson wrote: > > Maybe I just don't know the right special functio

__getattr__ and functions that don't exist

2006-05-25 Thread Erik Johnson
Maybe I just don't know the right special function, but what I am wanting to do is write something akin to a __getattr__ function so that when you try to call an object method that doesn't exist, it get's intercepted *along with it's argument*, in the same manner as __getattr__ intercepts attribut

cgi: getting at raw POST data?

2005-02-25 Thread Erik Johnson
I am trying to work with a program that is trying make an HTTP POST of text data without any named form parameter. (I don't know - is that a normal thing to do?) I need to write a CGI program that accepts and processes that data. I'm not seeing how to get at data that's not a named form parameter.

Re: exception handling for a function returning several values

2005-02-12 Thread Erik Johnson
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I try to use y or z inappropriately when they are None, the program > will stop. An alternative is to return an error flag in addition to y > and z from function foo and check the value of the error flag in the > calling program. Thi

PHP session equivalent?

2005-02-12 Thread Erik Johnson
There are a lot of things about PHP I was not too keen on and hence why my company is primarily doing Python these days, but one thing I was quite impressed with was the ease with which it provided session functionality... And then in another CGI script do basically the same thing and g

Re: Commerical graphing packages?

2005-02-12 Thread Erik Johnson
Thank you both for your input. I will check them out. :) -ej -- http://mail.python.org/mailman/listinfo/python-list

Commerical graphing packages?

2005-02-11 Thread Erik Johnson
I am wanting to generate dynamic graphs for our website and would rather not invest the time in developing the code to draw these starting from graphics primitives. I am looking for something that is... "fairly robust" but our needs are relatively modest: X-Y scatter plots w/ data point symbol

Tkinter.Canvas saved as JPEG?

2005-02-10 Thread Erik Johnson
I want to draw some simple (dynamic) graphs and get these saved as a JPEG file to reference in a web link. I am aware of PIL (Python Image Library), but unfortunatley my system does not have it built. After looking at the README for it and seeing it depends on two separate packages to suppor

Re: Easy Q: dealing with object type

2005-02-03 Thread Erik Johnson
> Steven Bethard <[EMAIL PROTECTED]> wrote: > > py> class A: > > ... pass > > ... > > py> class B: > > ... pass > > ... > > py> a = A() > > py> a.__class__ == A > > True > > py> a.__class__ == B > > False "Just" <[EMAIL PROTECTED]> wrote > Uh, isinstance(a, A) works for both new-style

Re: streaming a file object through re.finditer

2005-02-02 Thread Erik Johnson
Is it not possible to wrap your loop below within a loop doing file.read([size]) (or readline() or readlines([size]), reading the file a chunk at a time then running your re on a per-chunk basis? -ej "Erick" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ack, typo. What I mea

Re: Easy Q: dealing with object type

2005-02-02 Thread Erik Johnson
"Erick" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ah, you're running into the "old-style classes vs. new style classes". > Try subclassing from "object". > > For example: > > >>> class A(object): That works! :) I guess I am fortunate to be running 2.2 - looks kinda ugly prior

Easy Q: dealing with object type

2005-02-02 Thread Erik Johnson
I quickly browsed through section 9 of the Tutorial, tried some simple Google searches: I'm not readily seeing how to test class type. Given some object (might be an instance of a user-created class, might be None, might be list, might be some other "standard" type object instance), how do yo

SUCCESS!

2005-01-28 Thread Erik Johnson
- Original Message - From: "Peter Otten" <[EMAIL PROTECTED]> > According to http://cnswww.cns.cwru.edu/php/chet/readline/CHANGES the > features you missed were introduced in readline 4.0 and 4.2, so version 4.3 > should be sufficient. So let me ask you again, you have both the readline > a

Re: building Python: up arrow broken on SuSE Linux 8.2

2005-01-27 Thread Erik Johnson
"Peter Otten" <[EMAIL PROTECTED]> wrote... > Have you ensured (with yast) that readline-devel is actually installed? I had not previously, but (not surprisingly) version 4.3 is installed. :) Good idea - I thought maybe I would be able to do an online update (YOU) to it, but it is taking fore

Re: building Python: up arrow broken on SuSE Linux 8.2

2005-01-26 Thread Erik Johnson
"Erik Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > So I downloaded & built libreadline version 5.0. I have libreadline.a > and shlib/libreadline.so.5.0 files. Having done Python & other scripting > languages for a while, I have sort

Re: Where can I find Mk4py.dll for python24 ?

2005-01-26 Thread Erik Johnson
I don't know what metakit or the file you are looking for is, but a simple search on google turns up the following article where a guy built it for Python 2.2 and was willing to mail that to people. Try contacting him: http://www.equi4.com/pipermail/metakit/2002-March/000560.html HTH, -ej "

Re: building Python: up arrow broken on SuSE Linux 8.2

2005-01-26 Thread Erik Johnson
advice on how to statically link in this library so the Python build is happy? Thanks, -ej - Original Message - From: "Peter Maas" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python Sent: Wednesday, January 26, 2005 3:22 AM Subject: Re: building Python: up arrow b

Re: python without OO

2005-01-25 Thread Erik Johnson
"Davor" <[EMAIL PROTECTED]> wrote > I do not hate OO - I just do not need it for the project size I'm > dealing with - and the project will eventually become open-source and > have additional developers... If you think your project is valuable enough to eventually be "Open Source", you can b

building Python: up arrow broken on SuSE Linux 8.2

2005-01-25 Thread Erik Johnson
I am trying to upgrade my Python installation. After downloading sources and building Python 2.3.4, I am unable to use the command history editing feature in the interactive interpreter (where the up-arrow would previously give you the last command line to edit, it now just prints "^[[A".) Thi

Re: newbie questions

2004-12-10 Thread Erik Johnson
> do yo have any idea of what is causing this problem? > is it possible to do self.SortiesAnimeTitreLabel = [] to reset the var? (it > seems to work outside of the sub, but I believe that the var I'm erasing is > not the one I want but a local copy. Yeah. I'm no Python guru, but I have a pre

GUIs: wxPython vs. Tkinter (and others)

2004-12-10 Thread Erik Johnson
I am looking for some input on GUI libraries. I want to build a Python-driven GUI, but don't really understand the playing field very well. I have generally heard good things about wxPython. I happen to already own John Grayson's book about Tkinter programming, so that is rather handy if I dec