capturing ESC, page up/down in Python

2008-10-26 Thread jordilin
Is there any way to capture the keyboard events ESC, page up (next
page), page down (previous page) in Python?. I mean, how can I capture
if user presses one of those keys in a terminal based application? I
was thinking about pygame.key.get_pressed from the pygame module, but
I don't feel really happy about importing pygame in a non related game
project.
--
http://mail.python.org/mailman/listinfo/python-list


RotatingFileHandler key error when parsing a logging config file

2009-12-21 Thread jordilin
Hi,
 I've a config for logging where I set up a file rotation with
handlers.RotatingFileHandler and when the app parses the logging
config it says keyError when trying to parse that section
('RotatingFileHandler' is not defined). Curiously enough, I can do
import logging and from logging.handlers import RotatingFileHandler.

Example:

[handlers]
keys=handlers.RotatingFileHandler

[formatters]
keys=simpleFormatter

[logger_root]
level=DEBUG
handlers=handlers.RotatingFileHandler

[handler_handlers.RotatingFileHandler]
class=handlers.RotatingFileHandler
level=DEBUG
formatter=simpleFormatter


I'm using python 2.4 in the servers. I'm having this in a particular
one, which seems like there must be some kind of configuration error.
Any suggestions,
Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: postprocessing in os.walk

2009-10-11 Thread jordilin
Well, you could use the alternative os.path.walk instead. You can pass
a callback as a parameter, which will be invoked every time you
bump into a new directory. The signature is os.path.walk
(path,visit,arg). Take a look at the python library documentation.


On 11 Oct, 00:12, kj  wrote:
> Perl's directory tree traversal facility is provided by the function
> find of the File::Find module.  This function accepts an optional
> callback, called postprocess, that gets invoked "just before leaving
> the currently processed directory."  The documentation goes on to
> say "This hook is handy for summarizing a directory, such as
> calculating its disk usage", which is exactly what I use it for in
> a maintenance script.
>
> This maintenance script is getting long in the tooth, and I've been
> meaning to add a few enhancements to it for a while, so I thought
> that in the process I'd port it to Python, using the os.walk
> function, but I see that os.walk does not have anything like this
> File::Find::find's postprocess hook.  Is there a good way to simulate
> it (without having to roll my own File::Find::find in Python)?
>
> TIA!
>
> kynn

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


Re: Data visualization in Python

2009-08-17 Thread jordilin
On 17 ago, 21:10, kj  wrote:
> I'm looking for a good Python package for visualizing
> scientific/statistical data.  (FWIW, the OS I'm interested in is
> Mac OS X).
>
> The users of this package will be experimental biologists with
> little programming experience (but currently learning Python).
>
> (I normally visualize data using R or Mathematica, but I don't want
> to saddle these novices with the task of learning yet another
> language.)
>
> TIA!
>
> kynn
Matplotlib is the one. There is Google Chart api which seems fairly
easy to understand and use thanks to pygooglechart bindings.
-- 
http://mail.python.org/mailman/listinfo/python-list