matplotlib & mod_python

2007-10-26 Thread kenneth
Hi all.

I would like to use a "combination" of matplotlib and mod_python to
create a
PNG figure on the fly in my web site.
The mod_python handler code should be something like this:


def handler(req):

fig = Figure()
...
... figure creation stuff
...
canvas = FigureCanvasAgg(fig)
canvas.print_figure(req, dpi=72)

   return apache.OK


This code gives me an error as req is not a file-like instance (as
sys.stdout):

TyperError: Could not convert object to file pointer

Is there a way to to this thing ?

Thank you very much for any suggestion,
Paolo

-- 
http://mail.python.org/mailman/listinfo/python-list


default value in __init__

2008-10-09 Thread kenneth
Dear all,

I have encountered this weird problem.

I have a class definition with an __init__ argument 'd'
which defaults to {}. This argument is put in the 'self.d'
attribute at initialization

I create two independent instances of this class; the code
is as follows.

class C:
  def __init__(self, i=10, d = {}):
self.d = d
self.i = i
  def get(self):
print
print self.d
  def set(self, dval, ival):
self.d.update(dval)
self.i+=ival

c1=C()
c1.set({'one':1},3)
c1.get()

del c1

c2=C()
c2.set({'two':2},4)
c2.get()


If I run the code I obtain:

{'one': 1}

{'two': 2, 'one': 1}

It seems that the 'self.d' argument of the second instance is the
same of the 'self.d' of the first (deleted!) instance.

Running the code in a debugger I discovered that, when I enter the
__init__ at the second initialization, before doing

self.d = d

the 'd' variable already contains the 'self.d' value of the first
instance and not the default argument {}.

Am I doing some stupid error, or this is a problem ?

Thanks in advance for any help,
Paolo
--
http://mail.python.org/mailman/listinfo/python-list


Re: default value in __init__

2008-10-09 Thread kenneth
On Oct 9, 10:14 am, Christian Heimes <[EMAIL PROTECTED]> wrote:
> kenneth wrote:
> > the 'd' variable already contains the 'self.d' value of the first
> > instance and not the default argument {}.
>
> > Am I doing some stupid error, or this is a problem ?
>
> No, it always contains the default argument because default values are
> created just ONE 
> TIME.http://effbot.org/pyfaq/why-are-default-values-shared-between-objects...


Wow, it's a very "dangerous" behavior ...

Just to know, is this written somewhere in the python documentation or
one has to discover it when his programs fails to work ;-) ?

Paolo
--
http://mail.python.org/mailman/listinfo/python-list


Backend Python Developer need in NYC ASAP!

2019-05-13 Thread Kenneth Partyka
I have an immediate need for a Backend Python Developer in New York City (SoHo) 
paying from $70-100/hour. This is an onsite position lasting 3-6 months on a 
W-2 (no sponsorship, C2C or 1099 is available). Remote work is not an option.

What you’ll do:
• design, develop, and deploy innovative solutions for challenging problems in 
our Supply Chain, Merchandise and Planning, and Talent domains
• Improve our business systems by building new features and adapting existing 
ones
• Participate in code reviews and help maintain high standards of code quality
• Deliver limited defect products through ubiquitous test automation
Who you are:
• Equipped with 2+ years of professional programming experience
• Backed by a strong understanding of software engineering principles and 
fundamentals, as well as data structures and algorithms
• Proficient in Python
• Knowledgeable about modern relational databases, such as PostgreSQL
• A quick learner and problem solver
• Experienced in Agile development and continuous delivery
• An excellent, empathetic communicator (in writing and in person!)
Extra credit:
• Experience with business management systems and modules pertaining to supply 
chain, merchandising, and enterprise resource planning

If you are interested, please send a resume to me (kenn...@c-rec.com) ASAP as 
we are interviewing this week!
-- 
https://mail.python.org/mailman/listinfo/python-list


What tools are used to write and generate Python Library documentation.

2005-09-26 Thread Kenneth McDonald
I have a module I'd like to document using the same style...

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What tools are used to write and generate Python Library documentation.

2005-09-27 Thread Kenneth McDonald
Unfortunately, none of the documentation tools that use documentation  
strings are suitable for full, serious documentation. There are a  
number of reasons for this, and I'll touch on a few.

The obvious one is that there is no standard format for docstrings,  
and this creates problems when trying to achieve a uniform look  
across python documentation.

More seriously, there is a major problem with docstrings in that they  
can only document something that has a docstring; classes, functions,  
methods, and modules. But what if I have constants that are  
important? The only place to document them is in the module  
docstring, and everything else--examples, concepts, and so on--must  
be thrown in there as well. But there are no agreed on formats and  
processing pipelines that then allow such a large module docstring,  
plus other docstrings, to produce a good final document.

I do tech writing for a living, so I have some idea of what I'm  
talking about, I think :-)

It's too bad that there is no equivalent of d'oxygen for Python. That  
is a _nice_ program.


Thanks for the advice,
Ken


On Sep 27, 2005, at 1:21 AM, beza1e1 wrote:

> Do you think of pydoc? Just make comments in your code this way:
>
> def add10(x):
> """this function adds ten to the given variable"""
>
> Then save this into add.py and now (in the same directory):
>
> pydoc add
>
> Voila, your documentation.
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: epydoc, variables and encoding

2005-10-05 Thread Kenneth Pronovici
>   I found a "problem" on epydoc. If I specify an encoding, epydoc not find 
>   my global variables, and if I remove it, it work well.
>
>   code.py:
>
>  #!/usr/bin/env python
>  # -*- coding: utf-8 -*-
>
>  MY_VAR = None
>
>  class foo(object):
> def __init__(self, foo):
> """
> Some text
> @param foo: Pass me what you want
> @type foo: A type
> @return: The object
> """
> return foo
>
>   This not work (MY_VAR is silently skipped), but if I remove:
>   # -*- coding: utf-8 -*-
>
>   it see MY_VAR and put it to my html file.
>
>   Is it normal?

No, it's not normal, and I'm fairly sure it's a bug.  The problem is
that the extra encoding statement at the top of the file changes the AST
parse tree that epydoc uses, which confuses epydoc.

There seem to be two solutions.  The first is easy.  Just add a @var
entry to the module docstring, listing MY_VAR.  Epydoc seems to notice
the variable if you do that.

   #!/usr/bin/env python
   # -*- coding: utf-8 -*-
   """
   @var MY_VAR: Is a variable
   """

Otherwise, you can try applying the following patch:

Index: objdoc.py
===
RCS file: /cvsroot/epydoc/epydoc/src/epydoc/objdoc.py,v
retrieving revision 1.93
diff -u -r1.93 objdoc.py
--- objdoc.py   12 Jan 2005 16:11:02 -  1.93
+++ objdoc.py   5 Oct 2005 19:56:00 -
@@ -1345,9 +1345,15 @@

 # Construct a list of defined variables.  To do this, we search
 # the parse tree for statements of the form "a=b" or "a=b=c" or
-# "a,b=c" or "(a,b)=c" or "[a,b]=c".
+# "a,b=c" or "(a,b)=c" or "[a,b]=c".  We have to make sure to
+# strip any encoding statement off the front first, though.
 defined_variables = {}
-for stmt in ast.totuple()[1:]:
+stmts = ast.totuple()
+if symbol.sym_name[stmts[0]] == "encoding_decl":
+stmts = stmts[1:][0][1:]
+else:
+stmts = stmts[1:]
+for stmt in stmts:
 dict = {}
 if _ast_match(self._EXPR_STMT_PATTERN, stmt, dict)[0]:
 expr_stmt = dict['expr_stmt']

Maybe Edward won't like this patch, but since he seems to be unreachable
for the last six months , you'll have to settle for my
less-than-educated guess at a fix. :)

KEN

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
http://www.cedar-solutions.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What documentation "standard" to use

2005-10-05 Thread Kenneth McDonald
This is, as far as I'm concerned, one of the great weaknesses of  
Python. (One of a
relatively few, to be honest--I'm still an enthusiast after all!)

There are numerous docstring-oriented tools; in my opinion, none of  
them are satisfactory,
because docstrings only apply to certain entities, and there are many  
other entities one
might wish to document.

Fred Lundh pointed out just a day or two ago a program of his called  
PythonDoc where
documentation is put into comments, and from the brief look I had at  
it, I may start
using it, it looks pretty nice.

ReStructuredText (now called ReST, I believe) looks like it's finally  
become a quite
good text markup language, and if there were a non-docstring system  
that used it, I
think that also would be good.

But what I'd really like is for Guido et al to declare a standard  
documentation system and
include in the standard Python distro. That way we would have _some_  
standard, and
people could concentrate their energy on improving it, rather than on  
continually
coming up with their own, non-interoperable, solutions.

Cheers,
Ken

On 5-Oct-05, at 3:26 PM, Kalle Anke wrote:

> I'm confused of how I should document my code, I've always liked  
> being able
> to document my code directly in my source file and then to use some  
> tool to
> extract the documentation to some other format.
>
> My problem with Python is that there are so many tools and  
> formats ... I
> don't know which one I should use. I've tried to figure out if  
> there is one
> that is the "de-facto standard" but ...
>
> Could someone advice me on what format/tool I should use?
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: So far (about editing tools)

2005-10-06 Thread Kenneth McDonald
This is something I fought with for a long time. My overwhelming vote  
is Eclipse with the PyDev plugin. (Google search should reveal this).  
Here are the pros and cons.

1) Eclipse is a _big_ system, with a strong emphasis on Java. So  
there's a lot of functionality you need to learn to ignore, and  
finding all of the different settings you're interested in can be a  
chore. And you'll need to learn the "Eclipse Way" (eg using  
repositories.)

2) Also, some of the eclipse dialogs are not the most intuitive,  
IMHO. Though to be fair, almost no programs do a good job of this.

3) But, given its weight, Eclipse is surprisingly fast.

4) Also, Eclipse has _very_ flexible (including multistroke)  
keybindings. It comes with predefined emacs keybindings.

5) And, PyDev is really _quite_ nice. It can also use PyLint, which  
is a big plus. (It was the first time I'd used PyLint, and it caught  
a _lot_ of potential errors.)

6) Finally, the eclipse layout is very flexible, and can be set up to  
be almost entirely keyboard-navigable.

The only _real_ problem is the eclipse learning curve. But, given  
that eclipse will be around for a _long_ time, and given how nicely  
PyDev is coming along, I actually expect this to become the de facto  
standard Python editor (though it will take a while).

Oh yeah, installation is (pretty) simple.


Ken



On 6-Oct-05, at 2:36 PM, CppNewB wrote:

> I am absolutely loving my experience with Python.  Even vs. Ruby,  
> the syntax
> feels very clean with an emphasis on simplification.
>
> My only complaint is that there doesn't appear to be a great  
> commercial IDE
> for the language.  I've tried Komodo, etc and they are nice  
> applications,
> but they don't feel like they give me the "power" like a Visual  
> Studio or
> Delphi (I wish I could articulate better the differences). 
> Finding a
> descent GUI builder has been a challenge as well.  Most of them  
> have support
> for Dialogs, but what about more complex UI's?  I may need a  
> resizable frame
> within a resizable frame? I haven''t found a GUI builder with a  
> great feel
> yet.
>
> Other than that, my experience has been wonderful.  Even after my
> complaints, I plan on sticking with Python for a while.
>
>
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: So far (about editing tools)

2005-10-06 Thread Kenneth McDonald
As I did mention in my original post, Eclipse is indeed bloated.  
However, in spite of that, I've found it both fast and reliable (much  
to surprise). The only real problem is learning what functionality  
(the majority) to ignore.

PyDev offers nice integration with Python. If I run a python program  
from within PyDev, errors are reported on the console, and clicking  
on an error takes me to the offending line number. Jython is also  
supported, though I haven't tried it.

I personally gave up on Emacs after spending four hours trying to get  
a perfectly simple keybinding working, and receiving no response from  
the emacs mailing list--they were apparently as mystified as I.

I don't mean to push Eclipse, but I looked at it several times before  
trying it, and backed off due to the concerns mentioned here. Once I  
actually sat down with it for about four hours to _concentrate_ on  
it, though, it rapidly became obvious that it with PyDev really was  
the best Python solution I'd found. If you do a lot of Python work,  
it's worth the effort to learn.

Ken
On 6-Oct-05, at 3:24 PM, Paul Rubin wrote:

> Micah Elliott <[EMAIL PROTECTED]> writes:
>
>> Furthermore, Eclipse requires java and is thusly not provided on any
>> linux distro I'm familiar with, which I consider a huge  
>> roadblock.  And
>> as mentioned, it's bloated.
>>
>
> It comes with Fedora Core 4 and is compiled with gcj.
>
>
>> I would suspect that the majority of Python programmers write in  
>> one of
>> vim or emacs. Anyone got stats?
>>
>
> I'm a long time emacs bigot but lately I've been editing Python with
> IDLE.  IDLE leaves a lot to be desired but its integration is very
> convenient.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
http://mail.python.org/mailman/listinfo/python-list


Python enjoyment (was Re: Python's Performance)

2005-10-10 Thread Kenneth McDonald
Ditto to the below! I quite literally considered leaving the CS field until I found Python. Now my main job description is 'technical writing', but I get to use python at work (MoinMoin) and for all of my own computing needs.Cheers,KenOn 10-Oct-05, at 2:03 AM, Ron Adam wrote:If I was forced to go back to MS C++ again, I think I would take up  painting instead of programing as my main hobby.  ;-)  Cheers,     Ron  -- 
http://mail.python.org/mailman/listinfo/python-list

UI toolkits for Python

2005-10-13 Thread Kenneth McDonald
Is there any emerging consensus on the "best" UI for toolkit.  Tk  
never quite made it but from what I can see, both qt and wxWin are  
both doing fairly well in general. I'm already aware of the licensing  
issues surrounding qt (fwiw, I think their license fee for commercial  
use is eminently reasonable), so aside from that, I was wondering if  
there was any feedback readers could provide on the following:

1) Which plays best with Python? Ideally, it would already have some  
higher-level python libraries to hide the grotty stuff that is almost  
never needed when actually implementing apps.

2) Reliability of each?

3) Useful external libraries for each?

4) Ease of installation/use on OS X?

Something with a genuinely useful text widget would be nice, but I  
know that's too much to expect...ah, TkText widget, where are you  
when I need you.


Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-13 Thread Kenneth McDonald
For unfortunate reasons, I'm considering switching back to Win XP  
(from OS X) as my "main" system. Windows has so many annoyances that  
I can only compare it to driving in the Bay Area at rush hour (OS X  
is like driving in Portland at rush hour--not as bad, but getting  
there), but there are really only a couple of things that are really,  
absolutely preventing me from making the switch. Number one is the  
lack of a decent command line and command-line environment, and I'm  
wondering (hoping) if perhaps someone has written a "Python shell"-- 
something that will look like a regular shell, let users type in  
commands, maybe have some of the nice features of bash etc. like tab  
completion, etc, and will then execute an underlying python script  
when the command is entered. I'm not thinking of IDLE, but something  
that is really aimed more at being a system terminal, not a Python- 
specific terminal.

Yes, I know that Cygwin is out there, but last I looked, they still  
went through the Win command-line window, which imposes a lot of  
restrictions.

More generally, has anyone written any python programs to administer  
various Win settings for which one must otherwise delve deep into  
mazes of twisty little dialogs, all alike? Or to help out with other  
annoyances? I know there are a lot of general utilities, but if  
they're in Python, I can also use them as a starting base for my own  
needs.

Finally, a significant incentive in doing this is that I could avoid  
a lot of installation hassle, since virtually everything has at least  
a decent installation package for Win. (I'd hoped this would happen  
for OS X, but it never has). Can anyone think of important python- 
related packages (release level, not cutting edge alphas) for which  
this might not be the case?

Many thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UI toolkits for Python

2005-10-13 Thread Kenneth McDonald
Thanks for reminding me of Gtk. OK, add that to the list.

The Web Browser interface is good for simple things, and will get better
with CSS2's adoption, but they still don't have a good way for important
things like interactive styled text, key bindings, etc. Good for  
simple things
(for which I use them), not for more complex stuff.

As for Tkinter, well, sigh, I have to go into a semi-rant, semi- 
eulogy right now.

Tk was, IMHO, the hands-down award winner for UI toolkit farthest  
ahead of
its time. I used it for years and years and years.

Tcl, on the other had, wasn't the _worst_ scripting language of all  
time, but it
was sure down in the bottom ten percent. How John Ousterhout could  
come up
with Tk on one hand and the other at the same Tcl boggles my mind.

Unfortunately, while Tkinter did provide in theory full access to Tk,  
it was in
practice never finished. I wrote quite a bit of code to try to add a  
true pythonic
interface to Tk via Tkinter (I'm happy to give it away if anyone  
wants--some of
it is actually in pretty good shape). But it's a big job, and it  
became clear to me
that Tk is going the way of the dinosaurs, so I abandoned it.

Ddevelopment on the advanced features of Tk--what really made it worth
using--has languished. Both marks and tags in the Text widget have been
fundamentally broken forever (not buggy, I mean broken in the sense that
their semantics destroys a great deal of their real potential), and I  
don't see
they'll ever be fixed. Same thing with tags in the Canvas widget.  
Plus the
lack of well-thought-out new widgets, and various other sins of omission
and comission, and I decided that Tkinter was clearly in the last of  
its days.

That said, if I was one of the founders of Google, Tk would be one of  
the
projects I'd hire a lot of people to get on to and actually realize  
its potential.
But I don't even buy lottery tickets :-)

Now I'm just waiting until one of the other kits becomes mature enough
(if ever) to start using it. So this is a query about that :-)
On 13-Oct-05, at 3:21 PM, Paul Rubin wrote:

> Kenneth McDonald <[EMAIL PROTECTED]> writes:
>
>> 1) Which plays best with Python? Ideally, it would already have some
>> higher-level python libraries to hide the grotty stuff that is almost
>> never needed when actually implementing apps.
>>
>> 2) Reliability of each?
>>
>> 3) Useful external libraries for each?
>>
>> 4) Ease of installation/use on OS X?
>>
>
> The answer to each of those questions points to Tkinter.  It comes
> with Python by default (the least installation hassles of any
> toolkit), is pretty reliable, has a reasonably Pythonic interface, and
> I don't understand the question about external libraries.
>
> However, Tkinter not most people's favorite, because the widgets look
> crude, they don't resemble the native widgets of any popular platform,
> and the widget set is somewhat limited.
>
> That suggests you're not asking the right questions.
>
> I use Tkinter because the Python gui's I've built so far have been for
> straightforward functionality purposes without being fancy.  However,
> if I were doing something for wide distribution and wanted it to look
> sharp, at this point I think I'd go for PyGtk despite the preference
> of many for wxpython.
>
> Finally, don't overlook the possibility of embedding a basic web
> server in your app, and having the user communicate with it through a
> web browser.  That turns HTML into your gui, which is very easy to
> program.  It also lets you easily handle remote clients, multiple
> concurrent clients, etc, and gives users a familiar and intuitive
> interface.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UI toolkits for Python

2005-10-13 Thread Kenneth McDonald
This improved appearance has been a nice thing to see, but looks were never really the reason I decided to leave Tkinter. It's much more the fundamental issues of Tk, plus the fact that Tkinter was never really "completed" (not a comment on the original author--there's only so much one person can do) that has made me decide to leave Tk behind.As an example of the worst Tk issues (at least for what I was doing):1) Marks screw up when they come to occupy the position. For example, let's say { symbolizes a text mark with right gravity, and } a text mark with left gravity. Remember that marks all have names, so they can all be referred to uniquely. Now construct some text like this: {here} is {some}  marked {text}. Delete all the text. The marks still exist. Now, try to recreate the original text by inserting the appropriate words at the appropriate marks. It won't work for two reasons, the worst of which is that marks that come to occupy the same index in the text can actually change their relative order.2) There are no abstract references; everything is referred to by its string name. This causes serious problems with name clashes and code abstraction. Tkinter hides some of this, but not enough.3) Window nesting is completely determined by window naming, which only compounds the problem mentioned in (2).I don't really mean to diss Tk, I just get so frustrated when I think of what it could have been...Thanks,KenOn 13-Oct-05, at 4:02 PM, Mark Roseman wrote:People should probably be more aware of work that has been going on with  Tk recently (after a fairly long hiatus) in terms of greatly improving  its appearance, adding theming, and more.  It's worth checking out, and  of course, if there's a way to help get some of these changes into  Tkinter, the Tk folks would I'm sure be helpful.   Here's a portion of a note that Jeff Hobbs posted to the Ruby group  recently, on a similar topic:  -- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python's Performance

2005-10-14 Thread Kenneth McDonald
Um, sorry, but this isn't correct.Although there might be a slight bit of gray area, the simple difference between compiled and interpreted languages is that compiled languages produce a binary consisting of bytes that mean something specific to the CPU of the computer the program is running on. The program is executed pretty much by just sending those bytes to the CPU.In an interpreted language, the "binary" (whether it be a straight text file or a bytecode file that has been produced from a text file) is, at runtime, processed by another program which _does_ consist of the bytes the CPU understands directly. Interpreted languages put an extra layer of software between the executable and the program.In practical terms, there are three differences:1) Interpreted language programs are typically much easier to transfer between machines (not necessarily between operating systems).2) Compiled languages typically have the potential (depending how much work goes into the compiler, amongst other things) to be _far_ faster than interpreted languages.3) Compiled languages require an often very painful, ugly compilation step to produce a binary. In interpreted languages (that produce bytecode), this phase is usually quite a bit easier, if not invisible.Yes, a language can have both an interpreter and a compiler, but almost always one of those plays a trivial role in the use of the language, because it is usually very difficult to get the semantics of the two to match and at the same time produce enough of a benefit to make the effort worthwhile. KenOn 14-Oct-05, at 9:29 AM, Alex Stapleton wrote:You can see that the entire, interpreted vs compiled debate is   utterly meaningless and that only implementation specific details   actually matter. e.g. Java is native if you compile it with GCJ. x86   is interpreted if you run it under a VM like VirtualPC. -- 
http://mail.python.org/mailman/listinfo/python-list

Re: UI toolkits for Python

2005-10-17 Thread Kenneth McDonald
Web interfaces are missing a lot more than this. Here are just a few things that cannot be done with web-based interfaces (correct me where I'm wrong):1) A real word processor.2) Keybindings in a web application3) Drag and drop4) Resizable windows (i.e. not the browser window) within the application.5) Anything other than absolutely trivial graphical programs.State is a very small part of the whole thing. Progress is being made, but web interfaces are still basically forms that can contain buttons, checkboxes, text fields, and a few other basic controls. I wish it were otherwise.KenOn 16-Oct-05, at 5:04 PM, Mike Meyer wrote:Malte Clasen <[EMAIL PROTECTED]> writes:  Claudio Grondi wrote: What is that complex, that it can't be solved using an Internet Browser as a GUI?  Nothing, but session management isn't trivial with http interfaces. You have to deal with the back button of the browsers, bookmarks to pages that result from posted forms, users leaving the application without notice, etc..  This fact seems to have escaped the notice of most developers of web applications. They just fail and/or misbehave under all those conditions. -- 
http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-10-17 Thread Kenneth McDonald
We all know all of the horrible things about Microsoft, and I suspect  
most of us agree they put out cruddy software. But why is this a  
topic for the Python list?

Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Yes, this is a python question, and a serious one at that (moving to Win XP)

2005-10-19 Thread Kenneth McDonald
Perhaps you didn't read my original post? I'm being forced to consider Windowsfor reasons beyond my control. Given that I wanted a decent shell in Windows,I thought I would ask about Python shells because I think Python is a great language,and such a beast would give me the flexibility I want on a machine I don't want touse. There is such a shell (though with a fifty page manual it'll be a little while beforeI start using it :-) ). End of matter, except for those who wish to discuss furtherPythonish/shell related issues. Why this demands an OS comparison and aninsult is beyond my understanding.KenOn 19-Oct-05, at 2:22 PM, James Stroud wrote:The OP is obviously a troll. Or he doesn't realize that you can use any shell  in OSX as the user default. I used OSX for 4 years and had to go 100% Linux  because of my employer. OSX is the best of Linux and Windows--anybody who  can't see that has obviously not worked with these three types of operating  systems enough and is basing conclusions on limited information...Or is a  troll. The OP probably works for microsoft.  James -- 
http://mail.python.org/mailman/listinfo/python-list

Re: UI toolkits for Python

2005-10-19 Thread Kenneth McDonald
I'd have to agree with this. Unfortunately, the only way to use Swing  
(in a
reasonable manner) from Python is to use Jython, and Jython has other
shortcomings that make me not want to use it.

Sigh.

Ken
On 19-Oct-05, at 9:59 AM, Ed Jensen wrote:

> Claudio Grondi <[EMAIL PROTECTED]> wrote:
>
>> I haven't seen any really platform-independent software yet and I  
>> don't
>> expect to see any in the future.
>> It is simply not possible to have one, even if much progress was  
>> done lately
>> in many areas in order to try to approach it as close as possible.
>>
>
> Java + Swing is probably as good as it gets when the goal is to write
> platform independent software.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>

-- 
http://mail.python.org/mailman/listinfo/python-list


Questions on embedding Python

2005-11-22 Thread Kenneth McDonald
We're looking at embedding Python into our product to provide users  
with the ability to write scripts for the programming. My knowledge  
of Python is excellent, I'm familiar with the concepts of converting  
back and forth between C and Python datatypes, but my knowledge of  
compiling and linking is almost nonexistent. So if I could get advice  
on the following, it would be most appreciated. The program currently  
runs on Mac and Windows.

1) When Python is embedded, is it typically compiled statically into  
the program, or provided as a dynamic library?

2) If provided as a dynamic library, does/should Python be recompiled  
into a tweaked dynamic library, or do we just use the python  
executable 'straight up', so to speak.

3) We would of course want to make sure that 'our' Python (so to  
speak) would have access only to 'our' library of Python code (which  
would include most of the standard Python libraries), so that it  
can't be confused by the presence of some other version of Python on  
the system. Is this normally done by compiling in the Python search  
path, making it relative to the main application?

4) I've never done this myself, but I understand that Python can  
import code from zip files in much the same way that Java can import  
from jar files. Is it possible to lump all of the python code we  
provide for use with the embedded Python into one big zip file, or  
would that cause problems such as slow loading when a module is  
imported? This would be nice because the fewer files we distribute,  
the better.

Many thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Looking for small, impressive 3D-related Python script

2005-11-28 Thread Kenneth McDonald
I'm not trying to persuade my company to offer Python as a scripting  
language for their product, but I am trying to give them examples of  
things that Python can do easily that cannot be done easily with  
their current proprietary scripting language. After that it would be  
their decision. As the product is a 3D package, I'm looking for  
something in this field.

This does _not_ have to use PyOpenGL, or for that matter, any Python  
3D package. In fact, my ideal would be a Python script that simply  
uses L-Systems (Lindenmayer systems) as in "The Algorithmic Beauty of  
Plants", to generate plantlike OBJ files that can then be displayed  
in our program. In general, something that generates an OBJ file  
would probably be preferable to something that actually uses  
PyOpenGL, Blender, etc, as then I can just display the OBJ file in  
our program to say, "This is the sort of thing that can be easily  
done by Python without recourse to any other programs".

So please, any suggestions are welcome.

As always, many thanks to this group,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for small, impressive 3D-related Python script

2005-11-28 Thread Kenneth McDonald
Thanks. Unfortunately, I then still need to write some sort of impressive OBJ-generating script, and it would really be nice if one existed already...I know there will be simple examples out there that will still look very good, but I don't know enough to quickly write one myself.KenOn 28-Nov-05, at 5:56 PM, Jack Diederich wrote:A quick google on "obj 3d python" brings up cgkit which has a tutorial page:  http://cgkit.sourceforge.net/tutorials/  It state it can export in OBJ format. -- 
http://mail.python.org/mailman/listinfo/python-list

Re: wxPython installation issues on Debian

2005-11-30 Thread Kenneth Pronovici
> Thanks for the suggestion, but an apt-cache search python2.4-wxgtk2.4
> returns no results for a package with that name. 

As you observed, the Debian wxPython packages currently only support one
version of Python at a time.  That decision ripples down and ends up
affecting a number of other things -- for instance, it's also the reason
that the Pythoncard Debian packages I maintain are only supported for a
single version of Python.

I'm sure that Ron (the Debian wxWidgets maintainer) has a good reason
for supporting only one Python version, but I don't personally know what
it is.  This package does seem to be rather difficult to maintain, and
that could be why he chose to do things this way.  Or, it might just be
that the default version of Python in Debian (even in etch) is still
2.3, and he's decided to support only the default version.  You could
try writing him to find out for sure.

If you really can't live with using Python 2.3, then I guess you have
two choices -- you can either download, modify and rebuild the Debian
package (apt-get source and dpkg-buildpackage) or try to get an upstream
binary distribution for your platform (which I guess could be
problematic unless you also get binaries for the underlying libraries,
etc.).  

Or, of course, you can also try building from the upstream source and
install to /usr/local or something.  Using that option, you might get
away with installing the underlying wxWidgets shared libraries from the
Debian package, and only the Python parts from source (if you're lucky).

I imagine that's not the answer you're looking for, but I hope that
helps a little,

KEN

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
http://www.cedar-solutions.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Installing Eric?

2005-12-04 Thread Kenneth McDonald
I'm wondering if anyone has experience/tips to offer on installing  
Eric on OS X and XP. Installation on both seems to require a number  
of steps, some of them seeming potentially fragile, and I'm wondering  
if I'm looking at a job of perhaps hours (days?), or if everyone  
manages in just a few minutes.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Profiling python 2.3

2005-01-27 Thread Kenneth Johansson
I wonder what would be a good way to profile a python program where the 
main thread starts two worker threads that do all the work.

I get no infomation at all from the threads.
I tried to use profile.run as the first thing in the new thread and the 
thread starts and works fine but when it exits I get this error

  File "/usr/lib/python2.3/profile.py", line 71, in run
prof = prof.run(statement)
  File "/usr/lib/python2.3/profile.py", line 403, in run
return self.runctx(cmd, dict, dict)
  File "/usr/lib/python2.3/profile.py", line 409, in runctx
exec cmd in globals, locals
TypeError: exec: arg 1 must be a string, file, or code object

The main problem I have is that when I add a small function to a program 
 the resulting code takes longer than it should. The program takes 
about 80% normally and end up taking more than 100%. I did a small test 
of the new funtions and when I run that alone it only takes 20%-25% so 
the result sould not take more than 50% and now I need to know where the 
time is spent.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Profiling python 2.3

2005-01-28 Thread Kenneth Johansson
On Fri, 28 Jan 2005 10:02:33 +, Stephen Kellett wrote:

> In message <[EMAIL PROTECTED]>, Kenneth 
> Johansson <[EMAIL PROTECTED]> writes
>>I wonder what would be a good way to profile a python program where the 
>>main thread starts two worker threads that do all the work.
>>
>>I get no infomation at all from the threads.
> 
> Python Performance Validator (beta)
> 
> http://www.softwareverify.com/pythonPerformanceValidator/index.html
> 
> Stephen

I develop on linux. 

Nice to see I do not have to recompile and relink to use the tool that's a
real problem with other python stuff ;)


-- 
http://mail.python.org/mailman/listinfo/python-list


Request for Feedback; a module making it easier to use regular expressions.

2005-01-31 Thread Kenneth McDonald
I'm working on the 0.8 release of my 'rex' module, and would appreciate
feedback, suggestions, and criticism as I work towards finalizing the
API and feature sets. rex is a module intended to make regular expressions
easier to create and use (and in my experience as a regular expression
user, it makes them MUCH easier to create and use.) 

I'm still working on formal documentation, and in any case, such 
documentation isn't necessarily the easiest way to learn rex. So, I've
appended below a rex interactive session which was then annotated
with explanations of the features being used. I believe it presents a
reasonably good view of what rex can do. If you have time, please
read it, and then send your feedback via email. Unfortunately, I do not
currently have time to keep track of everything on comp.lang.python.

Thanks,
Ken McDonald

=

 What follows is an illustration by example of how the 'rex' module works, for 
those already knowledgable of regular expressions as used in Python's 're' (or 
similar) regular expressions package. It consists of a quick explanation of a 
rex feature, followed by an interactive demo of that feature. You need to 
understand a couple of quick points to understand rex and the demo.
 
 1) To distinguish between standard regular expressions as constructed by hand 
and used with the 're' package, and regular expressions constructed by and used 
in 'rex', I'll call the former 'regexps', and the latter 'rexps'.
 
 2) The Rexp class, of which every rexp is an instance, is simply a subclass of 
Python's regular string class, with some modified functionality (for example, 
the __add__ method has been changed to modify the action of the '+' operation), 
and many more operators and methods. I'm not sure this was the wisest thing to 
do, but it sure helps when trying to relate rexps to regexps; just construct a 
rexp interactively or in a program and print it, and in either case you'll see 
the underlying string that is passed to the 're' module functions and methods.
 
 On to the tutorial.
  
 'rex' is designed have few public names, so the easiest way to use
 it is to import all the names:
>>> from rex import *

The most basic rex function is PATTERN, which simply takes a string or strings, 
and produces a rexp which will match exactly the argument strings when used to 
match or search text. As mentioned above, what you see printed as the result of 
executing PATTERN is the string that will be (invisibly) passed to 're' as a 
regexp string.
>>> PATTERN("abc")
'abc'

If given more than one argument, PATTERN will concatenate them into a single 
rexp.
>>> PATTERN("abc", "d")
'abcd'

The other rex function which converts standard strings to rexps is CHARSET, 
which produces patterns which match a single character in searched text if that 
character is in a set of characters defined by the CHARSET operation. This is 
the equivalent of the regexp [...] notation. Every character in a string passed 
to CHARSET will end up in the resulting set of characters.
>>> CHARSET("ab")
'[ab]'

If CHARSET is passed more than one string, all characters in all arguments are 
included in the result rexp.
>>> CHARSET("ab", "cd")
'[abcd]'

If an argument to CHARSET is a two-tuple of characters, it is taken as 
indicating the range of characters between and including those two characters. 
This is the same as the regexp [a-z] type notation. For example, this defines a 
rexp matching any single consonant.
>>> CHARSET('bcd', 'fgh', ('j', 'n'), ('p', 't'), 'vwxz')
'[bcdfghj-np-tvwxz]'
 
When using CHARSET (or any other rexp operation), you do _not_ need to worry 
about escaping any characters which have special meanings in regexps; that is 
handled automatically. For example, in the follwing character set containing 
square brackets, a - sign, and a backslash, we have to escape the backslash 
only because it has a special meaning in normal Python strings. This could be 
avoided by using raw strings. The other three characters, which have special 
meaning in regexps, would have to be escaped if building this character set by 
hand.
>>> CHARSET('[]-\\')
'[\\[\\]\\-]'
The result above is what you'd need to type using re and regexps to directly 
define this character set. Think you can get it right the first time?

CHARSET provides a number of useful attributes defining commonly used character 
sets. Some of these are defined using special sequences defined in regexp 
syntax, others are defined as standard character sets. In all cases, the common 
factor is that CHARSET attributes all define patterns matching a _single_ 
character. Here are a few examples:
>>> CHARSET.digit
'\\d'
>>> CHARSET.alphanum
'\\w'
>>> CHARSET.uspunctuation
'[EMAIL PROTECTED]&*()_\\-+={\\[}\\]|:;"\'<,>.?/

Best way to 'touch' a file?

2005-08-21 Thread Kenneth McDonald
I could've sworn python had such a command, but now I can't find it...

I'm looking for an easy way to perform a UNIX-style "touch", to  
update the modification time of a file without actually modifying it.  
I could do something (I imagine) like opening the file for appending  
and then immediately closing it, but that doesn't seem like a good  
idea--what if the file is already open for reading or writing? Anyone  
know of a nice, elegant solution?

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


How to start PEP process?

2005-08-25 Thread Kenneth McDonald
Should I just put a "Proposed PEP" message here? Or is there a more  
formal way?

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


pre-PEP: Object-oriented file module

2005-08-25 Thread Kenneth McDonald
I'd like to propose a new PEP [no, that isn't a redundant 'process'  
in there :-)--pre-PEP is a different process than PEP], for a  
standard library module that deals with files and file paths in an  
object oriented manner. I believe this module should be included as  
part of the standard Python distribution.

Background
==
Some time ago, I wrote such a module for myself, and have found it  
extremely useful. Recently, I found a reference to a similar module,  
http://www.jorendorff.com/articles/python/path/ by Jeff Orendorff.  
There are of course differences--I think mine is more comprehensive  
but probably less stable--but the similarities in thought are  
striking. Both work by creating a class representing file paths, and  
then using that class to unify methods from shutil, os.path, and some  
builtin functions such as 'open' (and maybe some other stuff I can't  
remember).

I haven't looked at Jeff's code yet, but for my own, a major enabler  
of the enhanced functionality has been the inclusion of generators in  
Python. This allows, for example, a method which yields all of the  
lines in a file and automatically closes that file after. The  
availability of attributes also makes certain things cleaner than was  
the case in previous versions of python.

Fit With Python Philosophy
=
One of the strengths of Python is that it is a highly object-oriented  
language, but this is not true when it comes to handling files. As  
far as python is concerned a file path is just a string, and there  
are a bunch of things you can do with it, but they all have to be  
done with function calls (not methods) since there is no concept of a  
file path object. Even worse, these functions are spread out across  
various modules, and often have cryptic names that hardly make it  
obvious what they do.

Given that two different people concluded that such a module was  
desirable, and independently implemented modules that are actually  
very similar, I suspect there is an 'object-oriented mindset' to  
which this way of addressing files and file paths is natural. And  
that should be part of Python.

Pragmatic Justification
=
I've been using my module for about a year and a half now. The ease- 
of-use and uniformity make a huge (I'm tempted to say 'vast')  
difference in dealing with files. I believe other users would  
experience an increase in efficiency when dealing with files ranging  
from 'significant' to 'very large' (in precise technical terms :-) )   
Also, I think this type of API would be much easier for new users to  
learn and use.

Examples

A few examples are in order. Again, these are from my own library,  
since I'm not too familiar with Jeff's. Also, this is stuff I'm just  
typing in right now as an illustration--there may be syntactic  
errors. (However, all of this functionality is present.) And these by  
no means represent the full functionality that is already defined.

# define a new path object
mydir = filepath("#&*$directory")

# Note that special characters are automatically escaped
# by filepath, as necessary for the current OS. If a character
# is illegal in a file name no matter what (cannot be escaped),
# an exception will be raised.


# A file in that directory
f = mydir / "some.txt"

# Go through the lines in the file. When all lines are done,
# the file will be closed automatically. If the file does not
# actually exist, an appropriate exception will be raised.
for line in f.iterlines():
 ...do something...

#The directory containing f is, of course, 'mydir'
assert f.parent == mydir

#Another path
aPath = filepath()

#In my module (not in Jeff's), a file path is considered
# semantically as a sequence of directory names terminated
# by the name of a file or directory. This makes it easy to
# obtain the name of the file at the end of a path:
theFile = aPath[-1]

# or the directory leading to that file
parentDir = aPath[0:-1]

#of course, these two common indexes/slices are accessible through  
attributes
theFile = aPath.basename
parentDir = aPath.parent

# A more powerful 'walk'-type method is included. Below,
# the 'recursive' indicates that directories should be recursively
# walked, and the 'preorder' indicates that directories should
# be included in the iteration _before_ their contents are given.
# There is also a 'postorder' argument, and both may be used to
# yield directories both before and after their contents.
aPath.iterfiles(recursive=True, preorder=True)

# With the advent of the 'itertools' module in python, there is no
# need to provide an argument taking a function that is applied
# during the walk process, so in that sense, iterfiles is actually  
simpler than walk.

#...and more. All of the various file capabilities available in  
Python are provided
#  in a unified package in this module.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pre-PEP: Object-oriented file module

2005-08-25 Thread Kenneth McDonald
Why would any of the issues below be any more difficult than they are withthe current file functions? I'm not proposing a C replacement for currentfunctions, merely a Python module that wraps all of those functions (andadds some additional ones) in an appropriate class.On Aug 25, 2005, at 5:28 PM, Martin v. Löwis wrote:I'd be personally curious as to how you would be dealing with Unicode file names. How to access file attributes is also an interesting question (e.g. how to find out whether it is a symlink, whether it is a hidden file, what the POSIX ACL is, and what the 8.3 short name is) -- 
http://mail.python.org/mailman/listinfo/python-list

Any projects to provide Javascript-style client-side browser access via Python?

2005-08-26 Thread Kenneth McDonald
I'm curious about this because, quite aside their function as web  
browsers, it is now possible to build some very useable interfaces  
using browsers with HTML, CSS, and JavaScript. (The biggest problem  
is still the lack of a decent text widget.) However, JavaScript isn't  
really a good language for building complex applications, and it  
would be very cool if there were some way to use Python to replace  
client-side JavaScript, in order to gain access the DOM.

So anyone know if there are projects underway on this?

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Any projects to provide Javascript-style client-side browser access via Python?

2005-08-26 Thread Kenneth McDonald
On Aug 26, 2005, at 3:04 PM, Paul Rubin wrote:Python isn't a good choice as a browser language because it doesn't have enough security.  Hostile scripts can take over the interpreter too easily.    There was a Python-based browser effort called Grail which I don't think got very far.  Personally I think there are very few good uses for complex client side browser scripts.  Most sites that use _javascript_ don't really need to. My belief is that if HTML/CSS/DOM can add a few more (admittedly difficult) features, then it will become a serious contender for fairly complex UI programs, i.e. ones that don't access web pages--it will be a replacement for existing UI libraries such as for Windows or OS X, wxWindows, Qt, etc. And if that's the case, then the security issue is irrelevant, and similarly, the need to be able to write significant programs becomes much greater.Ken-- 
http://mail.python.org/mailman/listinfo/python-list

Re: suggestion for Python graphing package, please

2005-08-30 Thread Kenneth McDonald
I haven't looked at it for a while, but when I was looking at it,  
MatPlotLib was great (though the API was still in flux). I'd assume  
it's become even better since then and I certainly hope so, because  
I'm planning on using it again soon :-).

Ken


On Aug 29, 2005, at 3:36 PM, Robert Kern wrote:

> Stewart Midwinter wrote:
>
>> I need a graphing library that I can access from within a Tkinter
>> application running on Windows.
>>
>
> http://matplotlib.sourceforge.net
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Two questions on PyDev for Eclipse

2005-09-19 Thread Kenneth McDonald
The first is general; what are users' experience with PyDev for  
Eclipse. It looks pretty good to me right now, but I've only started  
playing with it. Converting to Eclipse is a major effort, and if  
there are problems which would prevent pydev from being useful right  
now, I'd certainly appreciate knowing about them.

The second question is specific; is it possible to use Eclipse to  
edit a remote file, i.e. through SFTP or something equivalent? My  
current (limited) understanding of Eclipse is that it maintains an on- 
disk directory of files in a project. Unfortunately, for what I'm  
doing, a fair number of the files (mostly Python files) I'm editing  
are on a remote server, so whatever editor I use, the ability to edit  
remote files would be a big help.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


DHTML control from Python?

2005-02-14 Thread Kenneth McDonald
Are there any ways to use Python (rather than JavaScript) for controlling 
DHTML? I don't mind writing
JavaScript stubs which can be called by Python, so long as I need to do so only 
once for a particular
feature. I'm running Mac OS X 10.3, so comments as to the best browser for 
testing this would also be
appreciated.

If you could also email as well as posting a reply, I'd be grateful.

email to : kenneth.m.mcdonald _at_ sbcglobal.net

Thanks,
Ken McDonald
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: DHTML control from Python?

2005-02-14 Thread Kenneth McDonald
In article <[EMAIL PROTECTED]>, aurora <[EMAIL PROTECTED]> wrote:

What are the win 32 modules? Searching "OS X win 32" on Google gave me a bit
too much...

Thanks,
Ken

> IE should be able to do that. Install the win32 modules. Then you should  
> simply embed Python using 

LC_ALL and os.listdir()

2005-02-22 Thread Kenneth Pronovici
I have some confusion regarding the relationship between locale,
os.listdir() and unicode pathnames.  I'm running Python 2.3.5 on a
Debian system.  If it matters, all of the files I'm dealing with are on
an ext3 filesystem.

The real code this problem comes from takes a configured set of
directories to deal with and walks through each of those directories
using os.listdir().

Today, I accidentally ran across a directory containing three "normal"
files (with ASCII filenames) and one file with a two-character unicode
filename.  My code, which was doing something like this:
   
   for entry in os.listdir(path):   # path is 
  entrypath = os.path.join(path, entry)

suddenly started blowing up with the dreaded unicode error:

   UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in 
   position 1: ordinal not in range(128)

To add insult to injury, it only happend for one of my test users, not
the others.

I ultimately traced the difference in behavior to the LC_ALL setting in
the environment.  One user had LC_ALL set to en_US, and the other didn't
have it set at all.

For the user with LC_ALL set, the os.listdir() call returned this, and
the os.path.join() call succeeded:

   [u'README.strange-name', u'\xe2\x99\xaa\xe2\x99\xac', 
u'utflist.long.gz', u'utflist.cp437.gz', u'utflist.short.gz']

For the other user without LC_ALL set, the os.listdir() call returned
this, and the os.path.join() call failed with the UnicodeDecodeError
exception:

   [u'README.strange-name', '\xe2\x99\xaa\xe2\x99\xac', 
u'utflist.long.gz', u'utflist.cp437.gz', u'utflist.short.gz']

Note that in this second result, element [1] is not a unicode string
while the other three elements are.

Can anyone explain:

   1) Why LC_ALL has any effect on the os.listdir() result? 
   2) Why only 3 of the 4 files come back as unicode strings?
   3) The proper "general" way to deal with this situation?

My goal is to build generalized code that consistently works with all
kinds of filenames.  Ultimately, all I'm trying to do is copy some files
around.  I'd really prefer to find a programmatic way to make this work
that was independent of the user's configured locale, if possible.

Thanks for the help,

KEN

--
Kenneth J. Pronovici <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: LC_ALL and os.listdir()

2005-02-23 Thread Kenneth Pronovici
On Wed, Feb 23, 2005 at 01:03:56AM -0600, Kenneth Pronovici wrote:
[snip]
> Today, I accidentally ran across a directory containing three "normal"
> files (with ASCII filenames) and one file with a two-character unicode
> filename.  My code, which was doing something like this:
>
>for entry in os.listdir(path):   # path is 
>   entrypath = os.path.join(path, entry)
> 
> suddenly started blowing up with the dreaded unicode error:
> 
>UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in 
>position 1: ordinal not in range(128)

Sorry to reply to my own note, but after sleeping on it, I think I've
come up with a reasonable solution.  Now that I've dug further and my
eyes are less bleery, everything seems to work as long as I only pass in
simple strings to the filesystem functions.  

I think that I can solve my problem by just converting any unicode
strings from configuration into utf-8 simple strings using encode().
Using this solution, all of my existing regression tests still pass, and
my code seems to make it past the unusual directory.

>[u'README.strange-name', '\xe2\x99\xaa\xe2\x99\xac', 
> u'utflist.long.gz', u'utflist.cp437.gz', u'utflist.short.gz']
> 
> Note that in this second result, element [1] is not a unicode string
> while the other three elements are.

I'm still confused as to why this happens, but since I work around it, I
guess I don't care so much.

Thanks,

KEN

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: LC_ALL and os.listdir()

2005-02-23 Thread Kenneth Pronovici
On Wed, Feb 23, 2005 at 10:07:19PM +0100, "Martin v. Löwis" wrote:
> So we have three options:
> 1. skip this string, only return the ones that can be
>converted to Unicode. Give the user the impression
>the file does not exist.
> 2. return the string as a byte string
> 3. refuse to listdir altogether, raising an exception
>(i.e. return nothing)
> 
> Python has chosen alternative 2, allowing the application
> to implement 1 or 3 on top of that if it wants to (or
> come up with other strategies, such as user feedback).

Understood.  This appears to be the most flexible solution among the
three.

> >3) The proper "general" way to deal with this situation?
> 
> You can chose option 1 or 3; you could tell the user
> about it, and then ignore the file, you could try to
> guess the encoding (UTF-8 would be a reasonable guess).

Ok.

> >My goal is to build generalized code that consistently works with all
> >kinds of filenames.
> 
> Then it is best to drop the notion that file names are
> character strings (because some file names aren't). You
> do so by converting your path variable into a byte
> string. To do that, you could try
[snip]
> So your code would read
> 
> try:
>   path = path.encode(sys.getfilesystemencoding() or
>  sys.getdefaultencoding())
> except UnicodeError:
>   print >>sys.stderr, "Invalid path name", repr(path)
>   sys.exit(1)

This makes sense to me.  I'll work on implementing it that way.

Thanks for the in-depth explanation!

KEN

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
Personal Homepage: http://www.skyjammer.com/~pronovic/
"They that can give up essential liberty to obtain a little 
 temporary safety deserve neither liberty nor safety." 
  - Benjamin Franklin, Historical Review of Pennsylvania, 1759 
--
http://mail.python.org/mailman/listinfo/python-list


Popen3 and capturestderr

2005-03-08 Thread Kenneth Pronovici
Hi,

I have a problem with a popen2 pipe hanging partway through execution of
a command.  This happens in my function executeCommand() that is used
for every "shell" command execution in my program.  Source code for this
function is below.  My development environment is Debian unstable with
Python 2.3.5.

Within executeCommand(), output of every executed command is always
logged using a Python logger.  If outputFile is passed in, then output
will also be written into the outputFile, which might have been created
using open(), gzip.GzipFile() or bz2.BZ2File(), etc.  This functionality
exists so I have an equivalent of command-line redirection of stdout,
i.e. command > file.

If ignoreStderr=False, I use popen2.Popen4 so that stderr and stdout are
intermingled.  If ignoreStderr=True, I use popen2.Popen3 with
capturestderr=True so stderr doesn't appear in the output.  This
functionality exists so I have an equivalent of command-line redirection
of stderr, i.e. command 2>/dev/null.  

I am using popen2 rather than popen because I want to avoid all of the
issues around shell interpolation of arguments, etc.

This whole thing has been working pretty well for a while.  Then lately,
I started using it on commands that produce a large amount of output,
and it's begun to hang partway through execution.  A good way to
reproduce this behavior on my system is to use command "ls -laR /".  The
function hangs whever the output file reaches a certain size (around 20
MB).  When I interrupt the program, the stack trace shows that it's
stuck at pipe.fromchild.readline().

After some digging, I've decided that this behavior probably occurs
because I am ignoring the pipe.childerr file object.  Indeed, if I call
pipe.childerr.close() right after opening the pipe, my "ls" command that
had been hanging completes normally.  However, other commands which
actually attempt to write to stderr don't seem to like this very much.

What is the right way to discard stderr when working with a pipe?  I
want to consistently throw it away, and I don't see a good way to do
this with the popen2 implementation.

Thanks for the help,

KEN

--- snip ---

def executeCommand(command, args, returnOutput=False, 
   ignoreStderr=False, outputFile=None):
   """
   @param command: Shell command to execute in a list like [ "ls", ]
   @param args: List of arguments to the command, like [ "-laR", "/", ]
   @param returnOutput: Indicates whether to return the output of the command
   @param outputFile: File object that all output should be written to.
   @return: Tuple of C{(result, output)}.
   """
   output = []
   fields = command[:]
   fields.extend(args)
   if ignoreStderr:
  pipe = popen2.Popen3(fields, capturestderr=True)
   else:
  pipe = popen2.Popen4(fields)
   pipe.tochild.close()
   while True:
  line = pipe.fromchild.readline()
  if not line: break
  if returnOutput: output.append(line)
  if outputFile is not None: outputFile.write(line)
  outputLogger.info(line[:-1])
   if returnOutput:
  return (pipe.wait(), output)
   else:
  return (pipe.wait(), None)

--- snip ---

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Popen3 and capturestderr

2005-03-09 Thread Kenneth Pronovici
On Wed, Mar 09, 2005 at 06:17:50AM -, Donn Cave wrote:
> Quoth Kenneth Pronovici <[EMAIL PROTECTED]>:
> ...
> | If ignoreStderr=False, I use popen2.Popen4 so that stderr and stdout are
> | intermingled.  If ignoreStderr=True, I use popen2.Popen3 with
> | capturestderr=True so stderr doesn't appear in the output.  This
> | functionality exists so I have an equivalent of command-line redirection
> | of stderr, i.e. command 2>/dev/null.  
> ...
> | After some digging, I've decided that this behavior probably occurs
> | because I am ignoring the pipe.childerr file object.  Indeed, if I call
> | pipe.childerr.close() right after opening the pipe, my "ls" command that
> | had been hanging completes normally.  However, other commands which
> | actually attempt to write to stderr don't seem to like this very much.
> |
> | What is the right way to discard stderr when working with a pipe?  I
> | want to consistently throw it away, and I don't see a good way to do
> | this with the popen2 implementation.
> 
> Right, popen2 gives you about 3 options, out of probably dozens that
> you could get with shell redirections.  On the other hand, the source
> is available, and Python is an OOP language, so I assume there is no
> reason you can't make a derived class that does just what you want.
> In the present case I guess that would mean something like
>null = os.open('/dev/null', os.O_RDWR)
>os.dup2(null, 0)
>os.dup2(null, 2) (depending)
>os.close(null)
> along with other stuff you can just copy from Popen4.

Ah... ok, subclassing is an option I hadn't considered.  I'll give that
a whirl and see whether I can make it work.

KEN

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
Personal Homepage: http://www.skyjammer.com/~pronovic/
"They that can give up essential liberty to obtain a little 
 temporary safety deserve neither liberty nor safety." 
  - Benjamin Franklin, Historical Review of Pennsylvania, 1759 
-- 
http://mail.python.org/mailman/listinfo/python-list


Newbie: Designer Looking to Build Graphics Editor (PS/AI)

2015-10-02 Thread Kenneth L
I'm a graphic designer. I'm new to Python. I know html, css, alittle 
actioscript and little javascript. I actually build an iOS using Flash. I 
understand programming concepts I believe.

I'd like to build a Illustrator/Photoshop like program. Why, there are some 
features that I'd like to personally have. Example, randomizing the rotation, 
line height and sizing of text. You have to do this manually. It would be cool 
have a little program that is dedicated building logos. Not trying to reinvent 
the wheel. Just basic featuring of vector graphics program plus my enhancements.
Maybe this program could be base and it can export vector and bring into 
Photoshop to add finishing touches.

I heard Python is easy to learn. So my question is Python able to do this or 
connect with libraries? Plus where do I start? I watched python tutorials but 
they don't really show you how to build an application. How does one build a 
graphics program? LOL where do you start? How do you draw graphics on the 
screen?

I'm just confused.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie: Designer Looking to Build Graphics Editor (PS/AI)

2015-10-02 Thread Kenneth L
Well 15 years ago when I was 15 I wanted to model cars in 3D. It took me 100 
hours and 5-10 years but I can modeling a realistic vehicle and other objects 
in 3d. It was time consuming and challenging but it was worth it. And honestly 
I've used my 3d modeling skills to build displays and products. It has helped 
me land jobs and keep jobs. It was a hobby.

I'm not afraid of the hard work. I just didn't know were to begin. If this 
takes me a few years that's fine, lol. I have 20-40 years on earth, hopefully.

I'm not sure about the plugin route. I'm not looking to build a plug, lol. Just 
a finger to point me where to go/start.

1&2 sound good to me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie: Designer Looking to Build Graphics Editor (PS/AI)

2015-10-02 Thread Kenneth L
I tried to use gimp but as a photoshop user it was horrible. I was trying to 
like it. That is a great idea tearing down gimp. that is how I learn html and 
css. Breakin down websites.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Newbie: Designer Looking to Build Graphics Editor (PS/AI)

2015-10-02 Thread Kenneth L
No don't tell me what to do. I joined the military 3 years ago. You wouldn't 
believe the stuff I wasn't able to do before but now I am. You can keep your 
advice to yourself. I wasn't asking for something simple. I was asking for a 
starting point. The 3d was to show you I've learned hard stuff and it didn't 
scare me. I was building web pages when I was in grade school late 90s. I had 
no idea how to build an iPhone app but I created one, lol.

I want to build a graphics program or even a prototype. Maybe I can pass it 
over to a expert and hire then to build it. I have a dozen degree and 
certificates on my wall. And I didn't get that by going basic. Keep your advice 
Bartc.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python packages on OS X vs Windows

2005-12-14 Thread Kenneth McDonald
At the moment I'm doing most of my stuff on a Mac, but I've been  
considering also getting
a Windows laptop. One of the reasons is that I've found it very  
difficult to get certain
Python related things running on the Mac; for example, if one wants  
to use the most
up-to-date Python on the mac, rather than the one installed by Apple,  
things can get
a bit hairy, and then if one wants to go PyQT/wxPy/etc, it can get  
even worse with
trying to get all the compiling/linking to work.

On the other hand, it seems like most of this stuff is just available  
as installers for PCs.
Am I being naive to think that installation of most of this stuff  
(including getting it working)
will be much easier in the PC world?

And on a somewhat related note, do people find ipython to be a decent  
replacement
on Windows for the fact that the Windows shell is braindead?

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Questions about working with character encodings

2005-12-14 Thread Kenneth McDonald
I am going to demonstrate my complete lack of understanding as to  
going back and forth between
character encodings, so I hope someone out there can shed some light  
on this.  I have always
depended on the kindness of strangers... :-)

I'm playing around with some very simplistic french to english  
translation. As some text to
work with, I copied the following from a french news site:

 Dans les années 1960, plus d'une voiture sur deux vendues aux  
Etats-Unis était fabriquée par GM.
 Pendant que les ventes s'effondrent, les pertes se creusent :  
sur les neuf premiers mois de l'année 2005,
 elles s'élèvent à 3,8 milliards de dollars (3,18 milliards  
d'euros), et le dernier trimestre s'annonce difficile.
 Quant à la dette, elle est hors normes : 285 milliards de  
dollars, soit une fois et demie le chiffre d'affaires.
 GM est désormais considéré par les agences de notation  
financière comme un investissement spéculatif.
 Un comble pour un leader mondial !

Of course, it has lots of accented, non-ascii characters. However, it  
posted just fine into both
this email program (hopefully it displays equally well at the other  
end), and into my Python
editing program (jEdit).

To start with, I'm not at all cognizant of how either the editor or  
the mail program could even
know what encodings to use to display this text properly...

Next, having got the text into the Python file, I presumably have to  
encode it as a Unicode
string, but trying something like   text = u"""désormais considéré"""  
complains to the effect
that :

 UnicodeEncodeError: 'ascii' codec can't encode character u'\x8e'  
in position 13: ordinal not in range(128)

This occurs even with the first line in the file of

 # -*- coding: latin-1 -*-

which I'd hoped would include what I think of as the latin characters  
including all those ones with
graves, agues, circonflexes, umlauts, cedilles, and so forth.  
Apparently it does not :-)

So I really have two questions:

   1) How the heck did jEdit understand the text with all the accents  
I pasted into it? More
specifically, how did it know the proper encoding to use?

   2) How do I get Python to understand this text? Is there some sort  
of coding that will
work in almost every circumstance?

Many thanks for your patience with someone completely new to this  
aspect of text handling,

Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python packages on OS X vs Windows

2005-12-14 Thread Kenneth McDonald
I've often found the Linux world to be like falling off a log,specifically, a log above a deep chasm with sharp rocksat the bottom :-)Linux has its place (though I tended to use FreeBSD more),but it's been several years since I've wanted to actually knowhow to manage my own system. I'd suggest that the variety ofdistribution/installation schemes that have been developedfor these systems indicate that software installation is _not_that easy to do on them.IMHO, any installation procedure that requires the user tocompile a piece of software is fundamentally broken; thecompilation step is part of the software development process,and should be done at the source, so that compilation/linking/make/etc.bugs can be handled there. Hence my question about installingPython-related packages on Windows (in spite of all of my otherdislikes of Windows, which are numerous).On 14-Dec-05, at 9:16 PM, Dan Sommers wrote:On the other hand, it seems like most of this stuff is just available as installers for PCs.  Am I being naive to think that installation of most of this stuff (including getting it working) will be much easier in the PC world?  It can be like falling off a log in the Linux world. -- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python packages on OS X vs Windows

2005-12-14 Thread Kenneth McDonald
If the amount of time it saved me justified it, I wouldn't hesitate to spend250 pounds. To put it in a more measurable manner, I've found myselfspending so much time attempting to get packages compiled underUNIXes (OS X, Linux, FreeBSD, etc.) that I would have no difficultywhatsoever in spending $500/year (or more) simply to get librariesand programs in a precompiled format that I could just install and havework--even if, in theory, I could get all that stuff "for free" by doing a fullinstall myself.I'd hoped that most of this stuff would appear in precompiled formatfor OS X, but unfortunately it hasn't.Cheers,KenOn 14-Dec-05, at 10:16 PM, Alex Martelli wrote:On the other hand, it seems like most of this stuff is just available as installers for PCs. Am I being naive to think that installation of most of this stuff   (including getting it working) will be much easier in the PC world?  PyQt for Windows is not available under GPL (as it is for Mac).  If shelling out 250 pounds (plus VAT) is "much easier" for you than doing a little compilation, or you can't use the GPL version anyway, etc, etc, then, maybe. -- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python packages on OS X vs Windows

2005-12-15 Thread Kenneth McDonald
The two are equivalent; time=money, at least in terms of work. 5 minutesto install = easy. 2 days to install = hard.Thanks for the note about Komodo for OS X, I'll take a look...On 15-Dec-05, at 8:56 AM, Kevin Walzer wrote:I'll grant that PyQt is a pain. It takes a couple of days to build, andisn't very stable once you get it built. ... But even with that, PyQt isn't hard to build--just time-consuming. The instructions are very well-presented. -- 
http://mail.python.org/mailman/listinfo/python-list

Pydev questions: versions and keybindings

2005-12-22 Thread Kenneth McDonald
I'm trying to find out if I have the most recent version of Pydev for  
Eclipse installed, but can't find the version number in the Pydev  
user interface. Is it available anywhere in there?

And, the reason that I'm trying to find the most recent update is  
because I can't redefine one keystroke that appears to be hardwired  
into Pydev (?) I'd like to bind ^/ to forward-word, but it keeps on  
applying commenting to the current line. I actually went and deleted  
the Pydev binding for comment line (which was actually ^-Shift-/, if  
I remember correctly), but to no avail. A visual check of keybindings  
in all modes reveals that nothing else is bound to ^/, so I'm trying  
to figure out what's going on.

Many thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Interesting little "gotcha" with generators

2005-12-22 Thread Kenneth McDonald
I recently had need to write the following code:

 def compileOuter(self):
 if False: yield None
 else: return

"compileOuter" is a generator function which is implemented in  
various classes. In this particular class, it always yields nothing.  
However, none of the following work:

 def compileOuter(self):
 return

 def compileOuter(self):
 pass

 def compileOuter(self):
 yield

The first two don't work because in order to define a generator, you  
must have a yield statement inside it. The last doesn't work because  
every "yield" must have an argument.

I've been using "return" in generators ever since I started using  
generators, but on reflection, it seems to me that such a thing is in  
some ways inconsistent; "return" is (conceptually, at least  
originally) a function statement, where "return" by itself really  
stands in for "return None". But in generators, it is being used as a  
control flow command. For example, you can't have "return" with an  
argument inside a generator.

Too bad "return" wasn't entirely forbidden within generators, and  
"yield" without an argument mandated instead. Oh well, too let now I  
suppose...


Cheers,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Programming Eclipse plugins in Jython?

2006-01-11 Thread Kenneth McDonald
Is it easy or difficult to implement Eclipse plugins in Jython? And  
if the former, are there any starter's guides you could recommend?

The desire is an editor plugin for a syntactically very simple  
proprietary language. I'd like to have paren checking, syntax  
colorization and (to start with at least) a few other small features.  
Unfortunately, there's quite a hump in learning the Eclipse API well  
enough to do even simple things (or at least that's what my reading  
seems to indicate), and I was wondering if I can cheat and use Jython  
to simplify the process.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Pythonic wrappers for SQL?

2006-01-13 Thread Kenneth McDonald
I need to do some data manipulation, and SQLite is a nice little  
product for it, except of course that I'd need to write SQL. Are  
there any good libraries out there that let one write (basic) queries  
in a Pythonic syntax, rather than directly in SQL?

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Kenneth Long

>   Okay if one builds such from sources... but us poor
> Windows flunkies
> without a build environment have to wait for some
> kindly soul to build
> the installer compatible with the new Python
> version.
> 
especially since I havent got MS visual studio...
and mingw is not supported... :-(

hello

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Re: How to upgrade python from 2.4.3 to 2.4.4 ?

2006-10-21 Thread Kenneth Long

> 
> mingw32 is supported and can compile many
> extensions. See the following
> post:
> 
>
http://groups.google.com/group/comp.lang.python/msg/8e2260fe4d4b7de9
> 
> If you meant something else with your comment,
> please explain.
> 

thanks for the reference.. I just got the latest
source for python and reading contents in PC, PCbuild,
PCbuild8 directories. It would be nice if the windows
build was as simple as running ./configure and make...

The link for pexports-0.42h.zip is broken so I cant
test it on an extension.




hello

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
http://mail.python.org/mailman/listinfo/python-list


Any way of adding methods/accessors to built-in classes?

2006-10-25 Thread Kenneth McDonald
This is possible with pure Python classes. Just add the method as new 
attribute of the class. However, that won't work for the builtins.

I know that this is somewhat dangerous, and also that I could subclass 
the builtins, but not being able to do things like '[1,2,3]'.length 
drives me a little nuts. Python is about the only computer language I 
use, and I think it's certainly the best of the scripting languages, but 
there are inconsistencies in the object model and some other things I 
wish I could fix. If could could modify the builtins this way, I'd be 
willing to take the risk.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


How to identify generator/iterator objects?

2006-10-25 Thread Kenneth McDonald
I'm trying to write a 'flatten' generator which, when give a 
generator/iterator that can yield iterators, generators, and other data 
types, will 'flatten' everything so that it in turns yields stuff by 
simply yielding the instances of other types, and recursively yields the 
stuff yielded by the gen/iter objects.

To do this, I need to determine (as fair as I can see), what are 
generator and iterator objects. Unfortunately:

 >>> iter("abc")

 >>> def f(x): 
... for s in x: yield s
...
 >>> f

 >>> f.__class__


So while I can identify iterators, I can't identify generators by class.

Is there a way to do this? Or perhaps another (better) way to achieve 
this flattening effect? itertools doesn't seem to have anything that 
will do it.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Is there a python development site for putting up python libraries that people might be interest in working on?

2006-10-25 Thread Kenneth McDonald
Over the last couple of years, I've built a module called rex that lays 
on top of (and from the user's point of view, hides) the re module. rex 
offers the following advantages over re.

* Construction of re's is object oriented, and does not require any 
knowledge of re syntax.
* rex is _very good_ at combining small re's into larger re's. In fact, 
this sort of composition is almost effortless. It greatly simplifies the 
creation of complex re's, since you can build smaller re's, build test 
code for them, compose them, build test code for the composition, 
compose again, etc.
* Reading and understanding re's built with rex is much easier than 
understanding primitive re's.
* No re metacharacters are used by rex. for example, a pattern to match 
any character except a, b, or c is just
   'not CHAR("abc")' rather [^abc]. A pattern to recognize all of a, b, 
c and "^" is CHAR("^abc").
* Many useful predefined patterns are defined. For example PAT.float 
matches floating point numbers, so a simple pattern to recognize complex 
numbers is PAT.float + ALT("+", "-") + PAT.float + "i"
* The match result object returned by rex is much more flexible, and has 
many more functions than that returned by re. Commonly performed 
operations on match results can often be done with much less (and much 
clearer) code than re.

I had hoped to polish this for a 'true' 1.0 release, but it's become 
obvious to me that I won't get to do this in the foreseeable future. 
Here is the current status of the project.

* rex is already highly functional. I use it all the time, and I have 
had very few bugs emerge. The testing code is fairly comprehensive, and 
every time I do find a bug, I've put in another test case. I haven't use 
pure re's in over a year and a half.
* rex supports almost all re functionality. Backrefs and a couple of the 
new re features added in (I think) python 2.4 are not yet supported, but 
should be easy to put in.
* There are some other very useful functions I've partially implemented, 
but not finished to the point they can be used. This should be quite 
easy, I just haven't had the need.
* I'm not entirely sure the API is ideal. Some discussion is needed on this.
* Internal documentation is decent, but not great.
* Internal code is again decent, but not great.
* User's documentation is not bad, but somewhat out of date. One of the 
problems here is that rex makes use of a lot of constants, which cannot 
be documented using Python's docstrings. In addition, rex is complex 
enough that it needs an external manual or good html ref, and none of 
the multiple attempts at pure Python doc systems do this well for 
everything that is needed. Now that d'oxygen works with Python, I would 
like to redo all of the documentation in D'oxygen.
* Everything is in a single file. This should be split up.

I would like to avoid putting this up on sourceforge as I think it would 
do much better at a site aimed specifically at Python development.

Given the above, are people interested in seeing this as a project they 
might be interested in working on? And where should I created the project?

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to identify generator/iterator objects?

2006-10-25 Thread Kenneth McDonald
Thanks for all the feedback. Yes the original post was incorrect, it was 
an intellectual burp that had me asking about a instead of f(something).

Boy, that answer's something I would never have known...

Thanks,
Ken

Leo Kislov wrote:
> Michael Spencer wrote:
>   
>> Kenneth McDonald wrote:
>> 
>>> I'm trying to write a 'flatten' generator which, when give a
>>> generator/iterator that can yield iterators, generators, and other data
>>> types, will 'flatten' everything so that it in turns yields stuff by
>>> simply yielding the instances of other types, and recursively yields the
>>> stuff yielded by the gen/iter objects.
>>>
>>> To do this, I need to determine (as fair as I can see), what are
>>> generator and iterator objects. Unfortunately:
>>>
>>>  >>> iter("abc")
>>> 
>>>  >>> def f(x):
>>> ... for s in x: yield s
>>> ...
>>>  >>> f
>>> 
>>>  >>> f.__class__
>>> 
>>>
>>> So while I can identify iterators, I can't identify generators by class.
>>>
>>> Is there a way to do this? Or perhaps another (better) way to achieve
>>> this flattening effect? itertools doesn't seem to have anything that
>>> will do it.
>>>
>>> Thanks,
>>> Ken
>>>   
>> I *think* the only way to tell if a function is a generator without calling 
>> it
>> is to inspect the compilation flags of its code object:
>>
>>   >>> from compiler.consts import CO_GENERATOR
>>   >>> def is_generator(f):
>>   ... return f.func_code.co_flags & CO_GENERATOR != 0
>>   ...
>>   >>> def f1(): yield 1
>>   ...
>>   >>> def f2(): return 1
>>   ...
>>   >>> is_generator(f1)
>>   True
>>   >>> is_generator(f2)
>>   False
>>   >>>
>> 
>
> It should be noted that this checking is completely irrelevant for the
> purpose of writing flatten generator. Given
>
> def inc(n):
> yield n+1
>
> the following conditions should be true:
>
> list(flatten([inc,inc])) == [inc,inc]
> list(flatten([inc(3),inc(4)]) == [4,5]
>
>   -- Leo
>
>   

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What's the best IDE?

2006-10-25 Thread Kenneth McDonald
With the most recent edition of PyDev, I find Eclipse works quite well 
for me.

Ken

[EMAIL PROTECTED] wrote:
> Recently I've had some problems with PythonWin when I switched to
> Py2.5, tooka long hiatus, and came back. So now I'm without my god sent
> helper, and I'm looking for a cool replacement, or some advocation to
> reinstall/setup PyWin. But the Python website's list is irrefutably
> long. It would take a month or two to test all of those products. So
> I'm looking for experienced advocates.
>
> What's your favorite IDE?
> What do you like about it?
> It would be fine for a begginer, right?
>
>   

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 3d programming without opengl

2006-11-01 Thread Kenneth Long
you might find this interesting...

www.ogre3d.org/

and its python wrapper

http://www.ogre3d.org/wiki/index.php/PyOgre


With /without Hardware acceleration...
with /without OpenGL or DirectX...





hello


 

Get your email and see which of your friends are online - Right on the New 
Yahoo.com 
(http://www.yahoo.com/preview) 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: wxPython 2.7.2.0

2006-11-08 Thread Kenneth Long
Is there a new version of Demo Docs released also?

I get this error from Sourceforge after clicking on
the  link at wxPython page.

Could not read file.

Go back.
/home/ftp/pub/sourceforge//w/wx/wxpython/wxPython2.7-win32-docs-demos-2.7.2.0.exe
Nov 08, 2006 07:10


--- Robin Dunn <[EMAIL PROTECTED]> wrote:

> Announcing
> --
> 
> The 2.7.2.0 release of wxPython is now available for
> download at
> http://wxpython.org/download.php.  This is expected
> to be the last
> stepping stone in the path to the next stable
> release series,
> 2.8.x. We're pushing full speed ahead in order to
> get 2.8.0 included
> with OSX 10.5, and so far we are very close to being
> on schedule. This
> release has some house-keeping style changes, as
> well as some
> user-contributed patches and also the usual crop of
> bug fixes.  Source
> and binaries are available for both Python 2.4 and
> 2.5 for Windows and
> Mac, as well some pacakges for varous Linux
> distributions.  A summary
> of changes is listed below and also at
> http://wxpython.org/recentchanges.php.
> 
> 
> What is wxPython?
> -
> 
> wxPython is a GUI toolkit for the Python programming
> language. It
> allows Python programmers to create programs with a
> robust, highly
> functional graphical user interface, simply and
> easily. It is
> implemented as a Python extension module that wraps
> the GUI components
> of the popular wxWidgets cross platform library,
> which is written in
> C++.
> 
> wxPython is a cross-platform toolkit. This means
> that the same program
> will usually run on multiple platforms without
> modifications.
> Currently supported platforms are 32-bit Microsoft
> Windows, most Linux
> or other Unix-like systems using GTK2, and Mac OS X
> 10.3+, in most
> cases the native widgets are used on each platform.
> 
> 
> Changes in 2.7.2.0
> --
> 
> Patch [ 1583183 ] Fixes printing/print preview
> inconsistencies
> 
> Add events API to wxHtmlWindow (patch #1504493 by
> Francesco Montorsi)
> 
> Added wxTB_RIGHT style for right-aligned toolbars
> (Igor Korot)
> 
> Added New Zealand NZST and NZDT timezone support to
> wx.DateTime.
> 
> wx.Window.GetAdjustedBestSize is deprecated.  In
> every conceivable
> scenario GetEffectiveMinSize is probably what you
> want to use instead.
> 
> wx.Image: Gained support for TGA image file format.
> 
> wx.aui: The classes in the wx.aui module have been
> renamed to be more
> consistent with each other, and make it easier to
> recognize in the
> docs and etc. that they belong together.
> 
>  FrameManager -->   AuiManager
>  FrameManagerEvent -->  AuiManagerEvent
>  PaneInfo -->   AuiPaneInfo
>  FloatingPane -->   AuiFloatingPane
>  DockArt -->AuiDockArt
>  TabArt --> AuiTabArt
>  AuiMultiNotebook -->   AuiNotebook
>  AuiNotebookEvent -->   AuiNotebookEvent
> 
> wx.lib.customtreectrl: A patch from Frame Niessink
> which adds an
> additional style (TR_AUTO_CHECK_PARENT) that
> (un)checks a parent when
> all children are (un)checked.
> 
> wx.animate.AnimationCtrl fixed to display inactive
> bitmap at start
> (patch 1590192)
> 
> Patch from Dj Gilcrease adding the
> FNB_HIDE_ON_SINGLE_TAB style flag
> for wx.lib.flatnotebook.
> 
> wx.Window.GetBestFittingSize has been renamed to
> GetEffectiveMinSize.
> SetBestFittingSize has been renamed to
> SetInitialSize, since it is
> most often used only to set the initial (and
> minimal) size of a
> widget.
> 
> The QuickTime backend for wx.media.MediaCtrl on MS
> Windows works
> again.  Just pass
> szBackend=wx.media.MEDIABACKEND_QUICKTIME to the
> constructor to use it instead of the default
> ActiveMovie backend,
> (assuming the quicktime DLLs are available on the
> system.)
> 
> -- 
> Robin Dunn
> Software Craftsman
> http://wxPython.org  Java give you jitters?  Relax
> with wxPython!
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 


hello



 

Sponsored Link

Degrees online in as fast as 1 Yr - MBA, Bachelor's, Master's, Associate
Click now to apply http://yahoo.degrees.info
-- 
http://mail.python.org/mailman/listinfo/python-list


[OT] Prolog and Regular Expressions, Was: Re: perspective on ruby

2006-06-28 Thread Kenneth McDonald
Lawrence D'Oliveiro wrote:
> In article <[EMAIL PROTECTED]>,
>  Edward Elliott <[EMAIL PROTECTED]> wrote:
>
>   
>> XML?  Conceptually (and more elegantly) covered 
>> as LISP s-expressions. 
>> 
>
> "...Lisp is still #1 for key algorithmic techniques such as recursion 
> and condescension."
> -- Verity Stob 
> 
>
>   
>> XSLT?  Just a bastardized spawn of Prolog.
>> 
>
> As is any kind of pattern matching, including everyone's favourite 
> regular expressions. Prolog did it all.
>   
I'm assuming you're kidding--there is a lot of difference between an RE 
that produces a highly optimized finite state machine to quickly match a 
string, and a language that uses brute-force depth-first recursion, plus 
some nonobvious tricks, to do the same thing. Like many orders of 
magnitude in execution time :-)

That said, it'd be nice if there were some easy way to access a Prolog 
engine from Python. When Prolog is appropriate, it's _really_ appropriate.


Cheers,
Ken

-- 
http://mail.python.org/mailman/listinfo/python-list


Parsing HTML--looking for info/comparison of HTMLParser vs. htmllib modules.

2006-07-07 Thread Kenneth McDonald
I'm writing a program that will parse HTML and (mostly) convert it to 
MediaWiki format. The two Python modules I'm aware of to do this are 
HTMLParser and htmllib. However, I'm currently experiencing either real 
or conceptual difficulty with both, and was wondering if I could get 
some advice.

The problem I'm having with HTMLParser is simple; I don't seem to be 
getting the actual text in the HTML document. I've implemented the 
do_data method of HTMLParser.HTMLParser in my HTMLParser subclass, but 
it never seems to receive any data. Is there another way to access the 
text chunks as they come along?

HTMLParser would probably be the way to go if I can figure this out. It 
seems much simpler than htmllib, and satisfies my requirements.

htmllib will write out the text data (using the AbstractFormatter and 
AbstractWriter), but my problem here is conceptual. I simply don't 
understand why all of these different "levels" of abstractness are 
necessary, nor how to use them. As an example, the html text 
should be converted to ''text'' (double single-quotes at each end) in my 
mediawiki markup output. This would obviously be easy to achieve if I 
simply had an html parse that called a method for each start tag, text 
chunk, and end tag. But htmllib calls the tag functions in HTMLParser, 
and then does more things with both a formatter and a writer. To me, 
both seem unnecessarily complex (though I suppose I can see the benefits 
of a writer before generators gave the opportunity to simply yield 
chunks of output to be processed by external code.) In any case, I don't 
really have a good idea of what I should do with htmllib to get my 
converted tags, and then content, and then closing converted tags, 
written out.

Please feel free to point to examples, code, etc. Probably the simplest 
solution would be a way to process text content in HTMLParser.HTMLParser.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Idea/request for new python mailing list/newsgroup.

2006-07-07 Thread Kenneth McDonald
Would a mailing list and newsgroup for "python contributions" be of 
interest? I currently have a module which is built on top of, and is 
intended to semantically replace, the 're' module. I use it constantly 
to great advantage, but have not made it public for the following reasons:

* The API should probably be cleaned up in places.
* Documentation is reasonable, but should be more organized and put into 
D'Oxygen format. It also needs to be slightly updated.
* A few more unit tests should be added.
* A few features of regular expressions are not yet available.
* Some capabilities go well beyond those of the re module, and there is 
the potential for much more.

I'd very much likes a ML/newsgroup wherein potential python contributors 
could

* Post alphas/betas and seek feedback.
* Request volunteer help to finish a project.
* Discuss details of implementation (API, useful vs. nonuseful 
functionality, etc.)
* etc. etc. etc.

For example, my library is extremely useful as is, but I currently don't 
have much time to do the things (API cleanup, doc organization, 
potential additional features) that I'd like to see before a public 
release. I also don't have the time or knowledge to set it up as an 
online project. On the other hand, I'd certainly be willing to share my 
experiences and knowledge of the current codebase. An appropriate 
mailing list or newsgroup could give feedback for when I do have time 
and, if my library is interesting enough, possibly even provide some help.

One thing to emphasize is that this should not be a list/newsgroup where 
people post requests or ideas. Requests or ideas for additional 
functionality are a dime a dozen. The sole intent of this group would be 
to provide a forum for discussion and coordination for work which is 
well under way, but needs input or further help.

Cheers,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Lightweight embedding of Firefox Gecko into application whose top level is Python--possible?

2006-12-18 Thread Kenneth McDonald
Sorry for crossposting to several lists, but from what I can tell, what 
I want to do may involve several different areas of expertise. (None of 
which I have :-( )

I'd like to use Gecko as the UI for an application mostly implemented in 
Python. Ideally, I'd like to somehow come up with a Python module that 
wraps the Gecko, so that I can:

1) Create windows whose content is drawn by Gecko.
1) Dynamically manipulate what is shown by Gecko.
2) Respond to mouse events and keypresses occurring on the window Gecko 
is in.

I really don't need, or want, anything beyond this. Presumably Gecko 
does have some notion of the DOM, since it handles CSS (which I do want) 
and CSS needs the DOM to be meaningful. And I'm also assuming that Gecko 
has or requires JavaScript, in order to actually do things with the DOM, 
or at least to handle DOM events. (Or at the very least to handle mouse 
events, since key events could in theory be handled outside of the 
layout engine.) But I'd like to be able to build something with _just_ 
those features.

Given the above, using Firefox or even Xulrunner seems to be very 
heavyweight and unnecessary. It would be somewhat nice to be able to 
manipulate a XUL DOM to created panes, menus, etc. But even that is not 
necessary--so far as I can tell, DOM manipulation+CSS has the ability 
right now to do menus, scrollable sidebars, panes, etc.

I'd like to get away from the rest of the FF/Mozilla baggage (especially 
XPCOM) because:

1) I don't want to have to deal with XPCOM, chrome stuff, XUL, make 
details, XPIDL (or whatever it is), etc. etc. My brain is already too 
full. :-)
2) Even if I did want to deal with the above, I find the documentation 
for it disorganized and, more often than not, out of date. Not a 
criticism, just an unavoidable weakness of open source development with 
a large number of developers.

Given that the _only_ thing I really want to use is the Gecko layout 
engine with some sort of relatively rudimentary keyboard and mouse 
handling (I'll do all of the sophisticated handling in Python), it'd 
just be nice to be able to dispense with all of the rest of the stuff.

For the record, I do know that PyXPCOM is still being developed, and 
what little I've been able to glean suggests it's been going reasonably 
well. However, I'm not sure it will do what I want it to. It appears to 
be a way to write XPCOM components in Python, and I have no idea if that 
will allow me to just use Python in the same way JavaScript is used 
right now, which is what I want. From what little I've been able to 
track down it seems that PyXPCOM may only be the starting point for 
moving towards using Python for DOM scripting. Also, I'm not sure when 
it will actually be done. Up-to-date online info about PyXPCOM (aside 
from bug tracking) seems very sparse.

Given all of that, answers to the following questions (or suggestions 
related to the whole endeavour) would be appreciated.
1) Does this even seem feasible? Can Gecko be 'broken out' from the 
other Moz technologies to this extent?
2) Does anyone know of similar projects?
3) Can anyone point out a simple example of encapsulating Gecko in a 
small C/C++ app, and then running/communicating with Gecko from that 
code? (i.e. a Gecko embedding "Hello world") This is in some sense what 
I'd be doing, since using Gecko from Python would involve (I assume) 
wrapping Gecko in a Python-compatible C wrapper. I've come across a 
number of embedding Gecko tutorials, but nothing that starts at such a 
basic level.
4) Do I need to somehow provide/link in a windowing system of some sort, 
or do I get that with the version of Gecko appropriate for the target 
platform?
5) Will PyXPCOM let me do what I want? And is it close enough that I 
should just wait for it? (It doesn't bother me if all of the rest of the 
Moz/FF stuff is included in my app, just as long as I don't have to deal 
with it.)

Many thanks,
Ken McDonald
-- 
http://mail.python.org/mailman/listinfo/python-list


Simplest way to do Python/Ajax with server and client on same machine?

2006-12-19 Thread Kenneth McDonald
I'm doing some work with a Python program that works hand-in-hand with 
the DOM on a local client (processing DOM events, issuing DOM 
modification commands, etc.) I'm currently using cherrypy as the Python 
server for this communication, and simple AJAX on the client browser 
end. This works just fine, I'm simply wondering if there is a better 
(even easier) way to do this, if there are libraries I'm not aware of 
that I should be, etc.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Getting unicode escape sequence from unicode character?

2006-12-27 Thread Kenneth McDonald
Given a Python unicode character (string of length one), how would I 
find out the \u escape sequence for it? This isn't obvious from the 
docs I've been looking through.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


test, please ignore

2006-02-05 Thread Kenneth McDonald
My last several postings do not seem to have gone through, so here's  
trying again.

Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Is there any books such as 'effective python' or else about the performance?

2006-02-11 Thread Kenneth Xie
att, thx.
-- 
http://mail.python.org/mailman/listinfo/python-list


any ftpd written in python?

2006-02-15 Thread Kenneth Xie
I need a simple ftpd example in pure python. Is there already such a 
ftpd available?
Thank you very much in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: any ftpd written in python?

2006-02-20 Thread Kenneth Xie
[EMAIL PROTECTED] wrote:
> Kenneth Xie <[EMAIL PROTECTED]> wrote:
>   
>> I need a simple ftpd example in pure python. Is there already such a 
>> ftpd available?
>> Thank you very much in advance.
>> 
>
> self-advertising: http://melkor.dnp.fmph.uniba.sk/~garabik/pyftpd.html
> it is a bit dated and I do not develop it anymore, but as a base of your
> own server software it can be quite good.
>
>   
Exactly what I need now, thank you very much.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python Graphing Utilities.

2005-05-10 Thread Kenneth Miller
Hello All,

I am new to Python and i was wondering what graphing utlities would be
available to me. I have already tried BLT and after weeks of unsuccesful
installs i'd like to find something else. Anything someone would recommend?

Regards,
Ken


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Graphing Utilities.

2005-05-10 Thread Kenneth Miller
Ahh Thanks for the quick replies. I'm having a look through them now. What
would you consider the best for real time applications? The idea here is to
stream in the results from an A/D converter onto a 2d chart.

Regards,
Ken


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Graphing Utilities.

2005-05-10 Thread Kenneth Miller
Unix, not windows ><
"Ron Adam" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Kenneth Miller wrote:
>
> > Hello All,
> >
> > I am new to Python and i was wondering what graphing utlities would
be
> > available to me. I have already tried BLT and after weeks of unsuccesful
> > installs i'd like to find something else. Anything someone would
recommend?
> >
> > Regards,
> > Ken
>
>
> BLT doesn't install in the correct directories on Windows. I found this
> helpful.
>
> 1.  Install BLT 2.4u into C:/Python23/tcl, using BLT's installer
> (the one for Tcl/Tk 8.3). This gives you bin, include, and lib
> subdirectories of C:/Python23/tcl, with all the BLT stuff in them.
> 2. Copy C:/Python23/tcl/lib/blt2.4 into C:/Python23/tcl/tcl8.3.
> 3. Put the BLT DLLs in a directory on your PATH (not necessarily a
> system directory, it just has to be on your PATH)
>
> Clipped from: http://heim.ifi.uio.no/~hpl/scripting/software.html
>
>
> Cheers,
> _Ron
>
>
>
>
>
>
>


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Graphing Utilities.

2005-05-10 Thread Kenneth Miller
Beleive i'm going to try out PyX.

"Fernando Perez" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Bill Mill wrote:
>
> > On 5/10/05, Kenneth Miller <[EMAIL PROTECTED]> wrote:
> >> Hello All,
> >>
> >> I am new to Python and i was wondering what graphing utlities would
be
> >> available to me. I have already tried BLT and after weeks of
unsuccesful
> >> installs i'd like to find something else. Anything someone would
recommend?
> >
> > matplotlib is awesome:
> >
> > http://matplotlib.sourceforge.net/
> >
> > and gnuplot.py is passable:
> >
> > http://gnuplot-py.sourceforge.net/
> >
> > (a better version of gnuplot.py is available with the excellent
> > ipython interpreter at http://ipython.scipy.org/)
>
> Just to clarify: with ipython, you still need the default gnuplot-py
package,
> it's just that ipython enhances it a bit.
>
> And I'd also second the matplotlib suggestion, to which I've by now fully
> switched after years of faithful gnuplot usage.  Matplotlib is very good,
has
> an active development community, and it is designed from the ground up not
> only as a library for rendering plots to screen/disk, but also for
embedding
> into guis (with support for Tk, WX, GTK, QT and FLTK).  So it should
satisfy
> the OP's  needs well, and if he has any problems with it, feel free to
stop by
> the user list which is fairly active.
>
> As a disclaimer, while I've added support in ipython for interactive
matplotlib
> usage with most backends (except FLTK), I'm not a full-time developer.  So
I
> feel it's OK to cheer JDH's and all the rest of the team's excellent work
on
> matplotlib.
>
> Best,
>
> f
>


-- 
http://mail.python.org/mailman/listinfo/python-list


BLT with TCL/TK 8.4.9 and Python 2.4

2005-05-15 Thread Kenneth Miller
Has anyone acheived this?

Regards,
Ken


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EpyDoc problem

2005-05-22 Thread Kenneth Pronovici
> >EpyDoc is hosted in Sourceforge. This alone may answer your question
> >about a bug-tracker:
> >
> >http://sourceforge.net/tracker/?atid=405618&group_id=32455&func=browse
> >  
> >
> Well, I wrote to the bug tracker some days ago but no answer so far.

I am the maintainer of the Debian epydoc package.  Lately, I have also
found it difficult to contact epydoc's author, Edward Loper.  I'm
currently not sure whether my mail is getting spam-filtered or whether
something else has happened and he's not available any more.  Maybe
someone on the list knows what's going on?

I think your best bet is to file the bug (which you have done) and wait
for a reply, keeping in mind that it might be a while before someone has
time to deal with your bug.  Most people writing free software are
volunteers, after all. 

KEN

-- 
Kenneth J. Pronovici <[EMAIL PROTECTED]>
http://www.cedar-solutions.com/


pgp29qrUbCxdT.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

Questions on using Qt or wxWindows with Python and OS X

2005-05-30 Thread Kenneth McDonald
If this is not an appropriate newsgroup for this type of posting,
please let me know and (if possible) suggest an alternative. I've
done a fair bit of research on the net, but information is scattered
all over the place and I haven't been able to find mailing lists
relating specifically to python and UIs.

I'd like to start using Python for some GUI programming again. I'd
like to use Tk, but it seems to be dying a slow death, so it's
probably time to look at wxPython and PythonQt.

I'd appreciate any comments on the relevant merits of these two
libraries, both with respect to Python and more generally. I know
about the differences in licensing, that's not an issue. My most
specific concerns are ease of use (which includes how much in the way
of documentation or examples for using through Python are available,
and how easy the Python libs are to use in each case); availability of
a generally capable styled text widget, as one of the things I need to
build is an editor, which needs to be able to handle different fonts,
styles, tabs, and so forth; and ease of installation on a Macintosh,
since that is my preferred dev platform, and installing things made
for other UNIX variants can be a little wonky at times.

I'm also curious as to the quality of documentation available for
wxPython and wxWindows, and any differences between the
wxWindows text widget (which is generally Scintilla I believe),
and the Qt text widget classes. I've had a hard time finding good
docs for wxWindows or wxPython, and the bit of documentation
on Scintilla I've found and read seems to indicate that it has some
restrictions, such as needing to use the same line height for all lines
regardless of content.

Many thanks for any feedback you can give.


Cheers,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Matplotlib w/ TK Backend.

2005-06-07 Thread Kenneth Miller
Hello All,

I need a python module to do real time graphs so I chose Matplotlib. I 
am trying to compile matplotlib at the moment and I have some problems, 
well not really. It compiles fine, it's how it compiles that's the 
problem. I am attempting to build it with the Tkinter backend as opposed 
to the GTK+ backend. Whenever I build, install, and then try to import I 
receive an error stating that my version of PyGTK needs to be updated. 
Logically it shouldnt be looking for PyGTK if it is using the TKinter 
backend? Any help would be appreciated.

Regards,
Kenneth Miller
-- 
http://mail.python.org/mailman/listinfo/python-list


Which Python Wiki engine?

2005-06-13 Thread Kenneth McDonald
I'm looking for a Wiki engine to set up for my company, so that we  
can incrementally add user documentation for a fairly complex  
program, plus allow users to add their own comments for the benefit  
of others. I'd strongly prefer a Python-based Wiki, since that allows  
me the chance to add plugins with minimal effort (being a python  
enthusiast and programmer).

However, I'd also like something that can provide a little more  
structure than MoinMoin seems able to provide (correct me if I'm  
wrong.) Though there would be cross-references amongst various  
sections, the idea is that the structure of the wiki would be very  
much that of an outline, with topics divided into sub topics and then  
into sub sub topics, etc. A person at our company would be the  
"editor"; responsible for setting up the original structure, putting  
in the documentation we currently have, and periodically editing  
contributions from users.

Here are some of the features I'd greatly like to have that I haven't  
seen provided by the (relatively few) wiki engines I've looked at.  
Mind you, I don't claim to have looked at even these few  
exhaustively. (No time!) MoinMoin is the one I've looked at the most.

1) Automatically generated table of contents, based on the outline  
structure. This would be regenerated periodically (probably nightly)
2) Ability for users to add new subsections, but not to change that  
part of the document structure which has been locked by the editor.
3) Clear visual distinction between material added by the users, and  
material added or approved by the editor.
4) Legal-style numbering of sections, subsections, etc.
5) Ability to have single pages containing both locked text (which  
users cannot edit or delete) and unlocked text. Such a page would  
consist of one or more locked blocks of text, interspersed with  
comments put in by users. Users could put comments anywhere except  
side a locked text block.

Ideally, this would also be something that doesn't depend on a  
backend database or other things besides the web server and python  
packages. This is not likely to be a wiki where huge amounts of  
interactivity must be supported; there will probably be a moderate  
amount of reading, and a small amount of writing.

If you know of any Python wiki engines which can satisfy (even  
partially) this list, please let me know. I'd strongly prefer to have  
a Python engine. On the other hand, if you know of another type of  
wiki that matches well with these requirements, I won't complain if  
you mention it :-)

Thanks,
Ken McDonald
-- 
http://mail.python.org/mailman/listinfo/python-list


Comparing Dictionaries

2007-07-26 Thread Kenneth Love

Hello,

I am new to Python, but not programming.  I would like to start my
Python career by developing programs according to the "best practices"
of the industry.  Right now, that appears to be unit tests, patterns,
and source code control.

So, I am trying to write a unit test for some code that reads a Windows
style INI file and stores the section, key, and values in a dictionary
(recipe originally found on ASPN, but heavily modified for my needs).

--
class LoadIni(unittest.TestCase):
 knownDefault = {
 "database$dbms":"mysql",
 "database$name":"thelarch",
 "database$user":"nobody",
 "database$password":"special",
 "database$host":"127.0.0.1"
 }

 def testNoIniFilename(self):
 """A default configuration list should be returned."""
 result = ini.load()
 # These next two print statement show the same key/value pairs,
 # but in a different order.
 #print knownDefault
 #print result
 self.assertEqual(result, self.knownDefault)  # does not work
---

In this case, I need to compare the returned dictionary (result) with
the known default dictionary (knownDefault).  This needs to be a
comparison of the dictionary key/value pairs.  If all of the key/value
pairs are an exact match and no extra key/value pairs are in either
dictionary then I consider the two dictionaries to be equivalent.

In other words, I consider these two dictionaries to be equivalent:

 { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' }
 { 'mouse' : 'mickey', 'dog' : 'bone', 'cat' : 'fever' }

while these two are not:

 { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' }
 { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'michael' }

Any suggestions on how to compare these via some assert statement?

Am I even on the right track with the INI file storing results in a
dictionary?  When I found the code, it just "felt right".

NOTE: The code works, I can load the INI file, programmatically change
a few settings, save the results to a new INI file, and manually compare
the resulting files.  I get the expected results.  It is the automation
of this testing process that appears to be the stumbling block.

adTHANKSvance,
Kenneth Love


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kenneth Love   | Oklahoma Tax Commission
DP Programmer/Analyst  | Information Technology
(405) 522 - 5864   | http://www.tax.ok.gov/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Comparing Dictionaries

2007-07-27 Thread Kenneth Love
At 09:55 PM 7/26/2007, Ben Finney wrote:
>Kenneth Love <[EMAIL PROTECTED]> writes:
>
> > In other words, I consider these two dictionaries to be equivalent:
> >
> > { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' }
> > { 'mouse' : 'mickey', 'dog' : 'bone', 'cat' : 'fever' }
> >
> > while these two are not:
> >
> > { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' }
> > { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'michael' }
> >
> > Any suggestions on how to compare these via some assert statement?
>
>Dictionaries already know how to compare themselves to each other.
>
> >>> {'dog': 'bone', 'cat': 'fever', 'mouse': 'mickey'} == {'mouse': 
> 'mickey', 'dog': 'bone', 'cat': 'fever'}
> True
> >>> {'dog': 'bone', 'cat': 'fever', 'mouse': 'mickey'} == {'mouse': 
> 'michael', 'dog': 'bone', 'cat': 'fever'}
> False

After verifying this myself, I double checked my code.  It turns out,
the changes I made to get rid of the "import string" from the original
recipe were the problem.  Leaving the parenthesis off lower() and
strip() in the following code causes all sorts of problems:

 config["%s$%s" % (name, key.lower())] = cp.get(sec, key).strip()

That should teach me not to change working code at the same time I am
writing unit tests.  Even so, I realize it won't be the last time I
do something so silly.  Yes, I know about TDD's "write the test first",
but I'm not comfortable with the philosophy of these new fangled unit
tests yet.

Thanks for the help!

Sincerely,
Kenneth Love


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kenneth Love   | Oklahoma Tax Commission
DP Programmer/Analyst  | Information Technology
(405) 522 - 5864   | http://www.tax.ok.gov/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Comparing Dictionaries

2007-07-27 Thread Kenneth Love
At 04:42 AM 7/27/2007, Ali wrote:
>On Jul 26, 10:18 pm, Kenneth Love <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I am new to Python, but not programming.  I would like to start my
> > Python career by developing programs according to the "best practices"
> > of the industry.  Right now, that appears to be unit tests, patterns,
> > and source code control.
>
>I am not sure about "best", but one of my "favourite practices" is to
>not re-write code that other people have written, and have released
>under licenses that allow you to do anything with it.
>
> > So, I am trying to write a unit test for some code that reads a Windows
> > style INI file and stores the section, key, and values in a dictionary
>
>So, in the standard library: 
>http://docs.python.org/lib/module-ConfigParser.html
>And if you want a more involved approach: 
>http://www.voidspace.org.uk/python/configobj.html
>
>Ali

The published recipe (based on ConfigParser) did not handle my INI
files.  I have periods in both the section names and the key names.
The INI files contents were developed according to an internally
defined process that other non-Python programs rely on.  The published
recipe *did not work* with this scenario.

Believe me, not modifying 3rd-party code is something I prefer and
already practice.  The code has to work first.

In case anyone is curious, here is a link to the original:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334

I combined the load/save routines, slogged through the unfamiliar
syntax, changed the section/key separator to '$', and started
writing unit tests.

Sincerely,
Kenneth Love


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kenneth Love   | Oklahoma Tax Commission
DP Programmer/Analyst  | Information Technology
(405) 522 - 5864   | http://www.tax.ok.gov/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


-- 
http://mail.python.org/mailman/listinfo/python-list


Fwd: Re: Comparing Dictionaries

2007-07-30 Thread Kenneth Love

>From: "Steven D'Aprano" <[EMAIL PROTECTED]>
>Newsgroups: comp.lang.python
>Subject: Re: Comparing Dictionaries
>Date: Sat, 28 Jul 2007 10:21:14 +1000
>To: python-list@python.org
>
>On Fri, 27 Jul 2007 14:11:02 -0500, Kenneth Love wrote:
>
> > The published recipe (based on ConfigParser) did not handle my INI
> > files.  I have periods in both the section names and the key names.
> > The INI files contents were developed according to an internally
> > defined process that other non-Python programs rely on.  The published
> > recipe *did not work* with this scenario.
>
>I think you have made a mistake. ConfigParser as published certainly DOES
>accept periods in section and option names. It just *works*.

The recipe I'm using is based upon ConfigParser and creates a dictionary
that is based on the contents of the INI file.  The dictionary's key is
based on the section name and the key name from the INI file.  The two
are concatenated with a separator.

In the original recipe, the separator is a period.  To use your example
(deleted as an attempt at brevity), the dictionary would be:

{ "SECTION.FRED.option.wilma" : "45" }

As originally written, the section name is now "SECTION" when you write
the INI file back out.  The key is "FRED.option.wilma".

Here is the original recipe:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334

My version replaces the period with a dollar sign giving:

{ "SECTION.FRED$option.wilma" : "45" }

I also removed the "import string" and put both the load() and save()
functions in a file with proper comments and the Python equivalent of
Javadoc comments.

>Even if the existing ConfigParser doesn't do what you want, the right way
>to fix the problem is not to recreate the entire module from scratch, but
>to subclass it:
>[snip]

In no way did I rewrite ConfigParser.  I have a real job with time
pressures and I'm not so arrogant as to think I could whip something
up in an hour that would be anywhere close to correct.

I see that I wasn't as clear as I thought I was in my original post
as you are second person to think I was developing my own INI solution.

All I wanted to know was "How do I compare two dictionaries to see if
they are equal?".  It turns out that this functionality is built-in
and it is my own stupid fault that my unit test was failing (modifying
working code and writing a unit test at the same time is a recipe for
failure).

Oh well.  Next time I'll spend two hours trying to figure it out instead
of one before I post.  :-\

>--
>Steven.
>
>--
>http://mail.python.org/mailman/listinfo/python-list

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kenneth Love   | Oklahoma Tax Commission
DP Programmer/Analyst  | Information Technology
(405) 522 - 5864   | http://www.tax.ok.gov/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Comparing Dictionaries

2007-07-30 Thread Kenneth Love
At 03:23 AM 7/28/2007, you wrote:
>Hi Kenneth,  being new to Python i wondered if you at least considered
>Doctests as part of your testing solution.
>Other languages don't have Doctest.
>
>- Paddy.

Until I read your post, I had never even heard of Doctest.  I will look
into it.

Here is the list of online sources I've found:

http://www.ibiblio.org/obp/thinkCSpy/index.html
http://www.diveintopython.org/toc/index.html
http://aspn.activestate.com/ASPN/Cookbook/Python


Here are the O'Reilly books I purchased from Barnes & Noble:

Python in a Nutshell (2nd ed.)
Python Cookbook (2nd ed.)
Programming Python (3rd ed.)

I am a slow reader.  So, if Doctests are mentioned in any of the above,
I haven't encountered it yet.

Specifically, my information on unit testing comes from reading about
half of this online chapter:

http://www.diveintopython.org/unit_testing/index.html

I will search on Google for more info on Doctest.

Thanks!

Sincerely,
Kenneth Love


-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kenneth Love   | Oklahoma Tax Commission
DP Programmer/Analyst  | Information Technology
(405) 522 - 5864   | http://www.tax.ok.gov/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


-- 
http://mail.python.org/mailman/listinfo/python-list


Accessing docstrings at runtime?

2007-08-29 Thread Kenneth Love
How do I print the docstring for a class property?

When I run the code below, I get the docstring for the string module
and not the one I set for the property.

-
# NOTE: Found in Python docs defining built-in functions (such as
#   property()).  FIXED: Bug in getx, setx, and delx where "__x"
#   was misreferenced as "_x".
class C(object):
def __init__(self):
self.__x = None
def getx(self):
return self.__x
def setx(self, value):
self.__x = value
def delx(self):
del self.__x
x = property(getx, setx, delx, "I'm the 'x' property.")

if __name__ == "__main__"
y = C()
y.x = 'test'
print y.x
print y.x.__doc__
-

I get the following output:

-
test
str(object) -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
-----

What am I doing wrong?

adTHANKSvance,
Kenneth Love

P.S. If I want a docstring and I do not want a delete function,
 do I just pass 'None' (minus quotes) for that parameter?

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  
Kenneth Love   | Oklahoma Tax Commission
DP Programmer/Analyst  | Information Technology
(405) 522 - 5864   | http://www.tax.ok.gov/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Accessing docstrings at runtime?

2007-08-29 Thread Kenneth Love
On 08/29/07, Chris Mellon <[EMAIL PROTECTED]> wrote:
> On 8/29/07, Kenneth Love <[EMAIL PROTECTED]> wrote:
>> How do I print the docstring for a class property?
>>
>> [[[ SNIP EXAMPLE ]]]
>>
>> What am I doing wrong?
>>
>
> You're looking at an instance, not at the class. y.x is going through
> the descriptor lookup and is returning the string, so the __doc__ is
> the the __doc__ of the string object, as you see.
>
> If you want to look at the property directly, look it up in the class 
> object:
>
> C.x.__doc__

That worked.  Thanks!

Kenneth 


-- 
http://mail.python.org/mailman/listinfo/python-list


How best to dynamically define methods (and functions)?

2007-09-01 Thread Kenneth McDonald
I can see an obvious but hacky way to define a Python function at 
runtime. I can't see any obvious way to add a method to a class at 
runtime (though I'm sure one could do just about anything by digging 
into the metaclass stuff, which I will do if needed). But pointers to 
cleaner or easier existing ways to do this would be most appreciated.

In case it's of interest in the context of the question, I need to 
define a largish set of functions (and similar methods) that define a 
XML-type markup language. Most of these functions will just be of the form

def fun(...):
return Node('fun', ...)

so it'd definitely be nice to just create most of them automatically, 
and only do the special cases by hand.


Many thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Questions on FOX GUI and Python

2007-09-04 Thread Kenneth McDonald
Would anyone care to offer their opinions as to using Python with the 
FOX GUI toolkit? Ease of use, stability, power,
speed, etc., all thoughts would be appreciated.


Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Any syntactic cleanup likely for Py3? And what about doc standards?

2007-09-05 Thread Kenneth McDonald
The reading I've done so far on Python 3 (alpha announcement, meta-PEP, 
some other PEPs) is generally encouraging, but there doesn't seem to be 
much on cleaning up the syntax, which has become uglier over time as 
features have been added on to an original syntax that wasn't designed 
to support them. It seems to me (from what little I've read--I admit 
that it's impossible to know for sure without experimenting quite a bit, 
for which I don't currently have the time) that new features such as 
multimethods might just make things more confusing (especially for 
newbies) in a lot of ways, without appropriate syntactic support.

Currently the most obvious example of this is Python 2.5's way of 
defining properties, which is ugly. leads often to writing of 
unnecessary code, and certainly doesn't make property code clear to a 
reader. Contrast this to the way properties (things that look like an 
instance variable but are actually bound to methods) are handled in Ruby 
and (IIRC, this also does a decent job) C#.

On the other hand, it does seem that some new syntactic support for 
other features will be added, so perhaps I'm just missing whichever PEPs 
talk about going back and adding cleaner syntax for existing features...?

Finally, another thing I've perhaps missed, but I can't see anything in 
what I've gone through, about correcting of of what I see to be one of 
Python's most long-standing really serious flaws, which is the lack of 
an official standard documentation markup syntax for writing 
documentation in code. This isn't even a matter of getting something 
developed, it's simply a matter of Guido and the Powers That Be 
bestowing their benediction on one of the several adequate or better 
documentation toolsets out there, so that more of us (slowly) start 
using it. Eventually this will result in work on the toolset itself, 
more people will be willing to use it, and there'll be a nice virtuous 
circle. Given how much more capable D'Oxygen is than any of the 
Python-specific solutions, I'd vote for D'Oxygen myself, but I'd prefer 
to have almost anything fill in this vacuum, rather than continue things 
the way they are.

As I say, I don't get the time I'd like to put into reading up on Py3, 
so please feel free to correct, point out references, etc. etc.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


curses module

2007-04-02 Thread Kenneth McDonald
I know that the curses module has a long-standing bug wherein cursor 
visibility can't be set. I'm looking at using the module for certain 
uses, and this isn't a problems (as long as I hide the cursor offscreen) 
as I would control visuals to provide a simulated cursor anyway. I'm 
wondering, though, if there are any other elements of the curses module 
I should be aware of before I commit to it, i.e. bugs that could cause 
serious difficulties at some point.

This isn't criticism, I just know that the curses module is the sort of 
thing that probably isn't being maintained consistently, and I for one, 
have no idea how well all the new terms in common use maintain the sort 
of backwards compatibility python curses will need to do its job.


Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Calling Python from Javascript?

2007-04-11 Thread Kenneth McDonald
I know that there's some work out there to let Python make use of 
Javascript (Spidermonkey) via (I assume) some sort of bridging C/C++ 
code. Anyone know of efforts to allow the reverse? I'd really like to 
make use of Python when doing Mozilla DOM programming, and I can never 
get a clear idea of when PyXPCOM might be available to those of us who 
don't know the ins and outs of compiling Mozilla, and its XPCOM 
structures. So if there was an easy way to simply and quickly pass even 
just strings back and forth between Python and Moz Javascript, that 
would make certain things a heck of a lot easier.

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Python plugins for netbeans 6 IDE?

2007-09-22 Thread Kenneth McDonald
Do any such exist? And do you find them worthwhile? I couldn't see any 
browsing the netbeans pages, but that doesn't mean they're not out there...

Thanks,
Ken
-- 
http://mail.python.org/mailman/listinfo/python-list


Overriding Logging Config FileHandler Filename

2007-09-25 Thread Kenneth Love
I have a Python logging config file that contains a RotatingFileHandler
handler.  In the args key, I have hard-coded the log filename.  Everything
works great.

However, I find that I now need to override this filename at application
runtime.  Is there a good way to do this?

Here is a bit of sample code that (hopefully) clarifies my question.

--- log.ini -
[loggers]
keys=root,processor

; Lots more stuff here: handlers, formatters, and loggers...

[handlers]
keys=consoleHandler,fileHandler

[handler_fileHandler]
class=handlers.RotatingFileHandler
level=DEBUG
formatter=standard
args=('D:\Projects\Python\src\log.log', 'a', 9, 10)

-- mymain.py -
import logging.config

logging.config.fileConfig('log.ini')

# TODO: Override log filename with new name (e.g. 'd:\\logs\\mymain.py.log')

log = logging.getLogger('mymain')

log.info('START: mymain.py')
log.info('FINISH: mymain.py')
--

adTHANKSvance,
Kenneth Love

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Kenneth Love   | Oklahoma Tax Commission
DP Programmer/Analyst  | Information Technology
(405) 522 - 5864   | http://www.tax.ok.gov/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overriding Logging Config FileHandler Filename

2007-10-01 Thread Kenneth Love
> On Sep 26, 1:07 am, "Vinay Sajip" <[EMAIL PROTECTED]> wrote:
>> On Sep 25, 9:15 pm, "Kenneth Love" <[EMAIL PROTECTED]> wrote:
>> I have a Pythonloggingconfig file that contains a RotatingFileHandler
>> handler.  In the args key, I have hard-coded the log filename. 
>> Everything
>> works great.
>>
>> However, I find that I now need to override this filename at application
>> runtime.  Is there a good way to do this?
>>
>
> Are you using the original file name mentioned in the config file at
> all? Why and under what conditions do you need to switch? You could
> easily do this programmatically - have two handlers and when you need
> to, remove one from the logger and add the other. I see you are using
> a rotating handler, which itself does rollover to new log files every
> so often.
>
> Regards,
>
> Vinay Sajip


Sorry for the delay in my response.

This post is a little long.  Just bear with me and remember... You did
ask.  :-)

We want to move all of my logging, command line processing, and other 
generic
application initialization to a module (or set of modules) that can be used
in roughly 90% of our processing tasks. In other words, we are developing a
framework that is highly tailored to our needs.  We have most of what we 
need
already done.  Logging is one of the last steps to be completed because of
this issue.

One of the requirements for our processing is a log file name that is
specific to each task.  The format and behavior must be the same across all
tasks.  We determined that using a common logging configuration would be the
most expedient way of implementing this.  This method has the added benefit
of being easily modifiable outside of code (when our needs change).

The logging filename follows a specific behavior by "falling back" to a less
desirable method when the current one fails.  This determination is made
ONLY at application initialization.  In order of most to least
desirable, below is a list of the desired behavior:

1) Retrieve a predetermined key that is stored in an INI file passed via
   the command line.  The fully qualified path should be specified in the
   INI file, but it could be relative.
2) The name of the INI file passed via the command line with ".log" 
appended.
   Preferably stored in the same location as the INI file.  The INI file 
will
   not be stored in the same location as the Python script.
3) The name of the original calling script with ".log" appeneded (from the
   example in my original post this would be "mymain.py.log").  Submodules
   do not override this name (e.g. "mymain.py" calls "mysub01.py" and the
   log filename used is still "mymain.py.log").  This log file would be
   stored in the same directory as the main script.
4) Use the default log name stored in the INI file.  Again this should be
   the fully qualified path, but could be relative.
5) Raise an error (resulting in a message being sent to the console and via
   an e-mail).

My (probably erroneous) speculation is that I can retrieve a handler
specified in the INI file and dynamically change the filename argument to
the desired value.  So far, I have been unable to figure out how to do this.

In summary, we need a way to override, at runtime, the filename stored in
the logging configuration file.

adTHANKSvance,
Kenneth Love


-- 
http://mail.python.org/mailman/listinfo/python-list


Possible to access MS Access 2007 password-protected database from Python?

2009-02-06 Thread Kenneth McDonald
Googling has shown me various ways of connecting to a non-password- 
protected Access database, but I was wondering if someone could point  
to code illustrating how to use an Access db that's password- 
protected. I haven't been able to find anything on this.


Thanks,
Ken
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   >